including new version of golang. Switch to go1.14 for linting.
and remove the build of `dep`. We're on go modules for vendoring now.
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
with the update to `golang.org/x/crypto`, the commit
c7dcf104e3
depends on a stdlib package introduced in go1.9
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
I have a use case where I'd like to know the files that are the same in the
tree, as well as the differences.
I could do this with a separate walk and excluding the paths that were
different, but since mtree is already doing all of this for me, it makes
sense to include it here. I've added a new function so that the behavior
stays the same for existing users of Compare(), since I assume mostly this
will be slower given that most files stay the same. I'd be happy to merge
it into one, though.
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
The core issue comes about when you consider a trivial example of a path
like "./README". This path is lexically equivalent within mtree to
"README", but a simple string comparison will yield the wrong result.
Instead you need to lexically clean the path first (filepath.Clean isn't
enough here -- you need to prepend a "/" and then do filepath.Clean).
In gomtree we generate spec files in the same style of FreeBSD's
mtree(8), so you would be very hard-pressed to find an example of such
an inconsistency. However casync's mtree implementation does not
generate leading "./" for root paths which results in "missing" entries.
The implementation of CleanPath was written by me for umoci originally,
then later I copied it to runc for other uses, and now I've copied it
here. Since I'm the sole author I'm effectively dual-licensing it under
this project's license to avoid having to relicense go-mtree for no good
reason (or deal with the multiple-license hassle).
Signed-off-by: Aleksa Sarai <asarai@suse.de>
This allows people to create synthetic InodeDeltas, which is something
that umoci would like to be able to do in order to nicely create 'umoci
insert' layers.
Signed-off-by: Aleksa Sarai <asarai@suse.de>
Use UtimesNanoAt from golang.org/x/sys/unix instead of manually crafting
the syscall.
Since UtimesNanoAt is provided for all unix-like OSes, factor out
lchtimes to its own file with appropriate build tags. This allows to
make use of it on darwin, dragonfly, freebsd, openbsd, netbsd and
solaris in addition to linux.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Vendor golang.org/x/sys to get the UtimesNanoAt function defined for all
unix-like OSes. The function will be used in a successive commit.
This also re-vendors the other dependencies from glide.yaml.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
During the rework of how xattr fields are handled, the comparison code
was not correctly updated. As a result, changes to xattrs would not be
detected in any form. This was detected in the umoci integration suite.
In addition, fix the dh.UsedKeywords logic so auto-detection works
correctly with prefix-based xattrs.
Fixes: ed464af779 ("*: xattr can Update()")
Signed-off-by: Aleksa Sarai <asarai@suse.de>
Fixes#16
In attempt to close https://github.com/vbatts/go-mtree/issues/16 I've
uncovered that the update was missing a function for symlink.
Additionally the update was not even opperating on the correct directory
hierarchy.
I've uncovered that os.Chtimes follows the symlink, and presumably only
Linux has an obscure way to set the mtime/atime on a symlink itself. So
I've made a custom lchtimes().
Also Mode follows through the symlink, and symlinks only ever have a
mode of 0777, so don't set them.
Lastly, directories need to have their mtime/atime set in a reverse
order after all other updates have been done. This is going to require
something like a `container/heap` to be unwound.
Also, each updateFunc will _only_ perform the update if it is needed. Much less
invasive this way.
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>