Giter VIP home page Giter VIP logo

hardlinkable's People

Contributors

chadnetzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jamescassell

hardlinkable's Issues

RFE: "oldest" behavior, opposite of "newest" behavior

Would be helpful to my use case to have an option to reverse the default "newest" behavior to have the program link instead against the oldest candidate.

Is this something you'd consider adding?

Seem like it'd be a customization or duplication of your code here:

hardlinkable/dolink.go

Lines 55 to 81 in 29ad3a2

if fs.Options.UseNewestLink {
// Use destination file times if it's most recently modified
dstTime := dst.Mtim
if dstTime.After(src.Mtim) {
err := os.Chtimes(src.Pathsplit.Join(), dstTime, dstTime)
if err != nil {
fs.Results.FailedLinkChtimesCount++
// Ignore this error, and just return early, as we
// don't want to abort the Run().
return nil
}
// Keep cached inode.StatInfo time updated
si := fs.inoStatInfo[src.Ino]
si.Mtim = dst.Mtim
// Change uid/gid if possible
err = os.Lchown(src.Pathsplit.Join(), int(src.Uid), int(src.Gid))
if err != nil {
fs.Results.FailedLinkChownCount++
return nil
}
// Chown succeeded, so update the cached stat structures
si.Uid = dst.Uid
si.Gid = dst.Gid
}
}

Edit: note to add that this would be an additional option; keep the current behavior as your preferred default

Update file.Read() to process read bytes before checking error results

In the following golang/go commit by Rob Pike:

golang/go@7c2718b
golang/go#27818

it is demonstrated that for Go Read() errors with a non-zero byte count, it is
important to first process the returned bytes. In particular an EOF can be
returned with a non-zero read. This is documented for the io.Reader
interface, but not mentioned for the os.File type (and in fact implies
otherwise, imo).

In any case, our readerContentsEqual() func should probably be made to only
accept *os.File, instead of reader interfaces, because we specifically only
intend to support file comparisons. Further, adjusting the processing to
support the wording of the io.Reader() docs and the above example is probably
preferred; perform the comparison of any bytes returned before handling the
Read() error conditions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.