Because the original code for vis() was ported to Go using the []byte{}
notion, this causes issues for multi-rune bytes (which were not
correctly treated -- and caused loss of information).
Fix this by dealing with []rune instead, which better conveys the
concept at hand. In addition, add tests to ensure that this does not
happen again.
Though, we _really_ should move this code into a library which has a
better test suite -- and the parser itself should be reimplemented to be
less ... 80s.
Fixes: #118
Signed-off-by: Aleksa Sarai <asarai@suse.de>
behavior ought to be, when `-f <file>` is not provided, then expect the
manifest to be provided on stdin.
Currently gomtree just fails if there is no `-f` (and it is not `-c`)
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This would help us build go-mtree on RHEL/CentOS and
distros where golang.org/x/crypto isn't provided or supported.
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This allows for xattr keywords to include spaces and other such options
(which is perfectly valid according to the definition of Lsetxattr --
any character except '\x00' is fair game).
Signed-off-by: Aleksa Sarai <asarai@suse.de>
Because of how xattr works (it will not be set on all files, but it's
possible for it to be added to a file without changing any other key)
it's necessary that we _always_ compute a diff when we hit an inode that
has xattr keys set.
Signed-off-by: Aleksa Sarai <asarai@suse.de>
In certain circumstances (such as the manifest generation of a
filesystem as an unprivileged user) it is important to provide hooks
that override the default os.* implementation of filesystem-related
functions.
In order to avoid merging too much code from outside projects (such as
umoci) this is implemented by providing FsEval hooks to Walk() and
Check(). This allows for users of go-mtree to modify how filesystem
checks are done, without compromising the simplicity of go-mtree's code.
Signed-off-by: Aleksa Sarai <asarai@suse.de>
The current Vis() and Unvis() are using the C implementation from
MTREE(8).
But that means that cgo is used, which is not always desired.
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This cleans up the Makefile target, and drops the dependency to point to
the $root path of the repo.
Fixes https://github.com/vbatts/go-mtree/issues/98
Reported-by: Aleksa Sarai <asarai@suse.de>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
The BSD format needed a slight tweak to handle mtree.Extra
and mtree.Missing cases. It currently only handled the 'Modified'
cases and therefore was not showing missing or extra files during
validation.