Commit Graph

365 Commits

Author SHA1 Message Date
Aleksa Sarai 44391840b6
vis: partial vis(3) port
This is a stopgap while I figure out how I should go about implementing
vis(3). It's also important to have some vis(3) implementation so I can
do integration tests on round-trips.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-12 04:07:37 +11:00
Aleksa Sarai cd1de45ba5
unvis: implement partial unvis(3) implementation
Also add some unit tests -- one of which currently fails due to ongoing
design discussion about how certain escape codes should be handled.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-12 04:06:25 +11:00
Aleksa Sarai 1e8de82690
*: license under Apache 2.0
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-11 21:10:12 +11:00
Aleksa Sarai 4c009fc4b2
README: add stub readme
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-11 21:09:06 +11:00
Aleksa Sarai 85e7fd2d50
initial commit
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-11 21:07:17 +11:00
Vincent Batts 5685419c3e Merge pull request #119 from cyphar/unvis-utf8
unvis_go: leave unicode unchanged with Unvis()
2017-02-10 09:19:18 -06:00
Aleksa Sarai f6dd726b66
unvis_go: leave unicode unchanged with Unvis()
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>
2017-02-10 23:08:00 +11:00
Vincent Batts 0185fe9b62 Merge pull request #117 from vbatts/release
release: add some steps to remember
2017-01-23 15:06:15 -05:00
Vincent Batts 67b30e3e57
release: add some steps to remember
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-01-23 14:40:40 -05:00
Vincent Batts 1a3d369341 Merge pull request #116 from vbatts/stdin
gomtree: allow manifest to be provided on stdin
2017-01-20 13:17:52 -05:00
Vincent Batts 21a2577f01
gomtree: allow manifest to be provided on stdin
like `gomtree -c -p /tmp/dir1 -K sha1 | gomtree -p /tmp/dir2`

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-01-20 13:13:59 -05:00
Vincent Batts b7967864aa
cli.test: failing test on stdin manifest
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>
2017-01-20 13:08:15 -05:00
Vincent Batts b9e743fdf0 Merge pull request #115 from vbatts/tmpdir
cli.test: passthrough and use TMPDIR
2017-01-20 11:33:57 -05:00
Vincent Batts 235566d9e0
cli.test: passthrough and use TMPDIR
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-01-20 11:30:54 -05:00
Vincent Batts d1073b349b Merge pull request #114 from vbatts/xattr_test
cli.test: setting xattr requires a value
2017-01-20 11:27:18 -05:00
Vincent Batts b71ad0f21e
cli.test: setting xattr requires a value
this early check was not valid as it required a value before it would
attempt to set the xattr

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-01-20 11:16:38 -05:00
Vincent Batts 97e571a55a Merge pull request #112 from vbatts/carry_pr111
Carry pr111
2017-01-20 11:00:04 -05:00
Vincent Batts 2b97fe83d3 Merge pull request #110 from cyphar/xattr-encode-spaces
keywords: encode xattr.* keywords with Vis
2017-01-20 10:57:30 -05:00
Vincent Batts a4e826f189
glide: add project info
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-01-20 10:55:48 -05:00
Vincent Batts 1f53bd1b61
test: only work with non-vendored source
by vendoring source, now './...' includes loads of vet/test/lint errors.
Let's ignore those.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-01-20 10:52:37 -05:00
Lokesh Mandvekar c9762c4d0e
vendor golang.org/x/crypto using glide
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>
2017-01-19 17:31:32 -05:00
Aleksa Sarai 071977cef6
test: cli: add xattr tests
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-01-17 00:48:06 +11:00
Aleksa Sarai 9cdd9152b3
cmd: gomtree: re-enable errors when there is a Modified entry
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-01-17 00:46:28 +11:00
Aleksa Sarai 3c76a35588
test: cli: add information about which test failed
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-01-17 00:46:28 +11:00
Aleksa Sarai f9adee80f4
keywords: encode xattr.* keywords with Vis
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>
2017-01-17 00:46:24 +11:00
Vincent Batts 94d7041e8e Merge pull request #108 from cyphar/107-xattr-always-diff
compare: always diff "xattr" keys
2017-01-16 07:32:03 -05:00
Aleksa Sarai ad35cae482
compare: always diff "xattr" keys
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>
2016-12-17 20:14:17 +11:00
Vincent Batts 0dc720e861 Merge pull request #96 from cyphar/add-unpriv-walking
walk: implement "unprivileged manifest generation"
2016-12-14 13:32:14 -05:00
Aleksa Sarai 08004a9a8c
fseval: add tests for FsEval
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-12-14 17:14:51 +11:00
Aleksa Sarai e22043cb86
walk: implement FsEval hooks
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>
2016-12-14 16:26:31 +11:00
Aleksa Sarai 98824a87da
check: simplify Compare
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-12-14 16:26:14 +11:00
Vincent Batts d42d5761a6
version: back to dev
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-12-08 15:16:57 -05:00
Vincent Batts 58660bbd83
version: make this v0.3.0
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-12-08 15:15:21 -05:00
Vincent Batts 556bb352d2 Merge pull request #105 from vbatts/compare_test_openbsd
compare: make the test output more readable
2016-12-08 09:59:00 -05:00
Vincent Batts d857d58104 compare: make the test output more readable
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-12-08 08:26:05 -05:00
Vincent Batts 26ccc7a48c Merge pull request #104 from vbatts/multiple_builds_test
make: build for several platfom/arches
2016-12-07 22:17:11 -05:00
Vincent Batts f15c0ad821 keywords: fix keyword failure for windows
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-12-07 22:10:00 -05:00
Vincent Batts 9fc0375857 make: build for several platfom/arches
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-12-07 21:59:17 -05:00
Vincent Batts 0b88377e28 Merge pull request #103 from vbatts/xattr_lint
xattr: the unsupported features weren't linted
2016-12-07 20:11:26 -05:00
Vincent Batts 1f7a3d3784 xattr: the unsupported features weren't linted
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-12-07 20:07:59 -05:00
Vincent Batts ca8faa91ae Merge pull request #102 from vbatts/tags_target
make: add a specific target for tags
2016-12-07 20:07:52 -05:00
Vincent Batts 83dff044b3 make: add a specific target for tags
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-12-07 20:03:41 -05:00
Vincent Batts e2575bffa5 Merge pull request #101 from vbatts/golang_vis
Golang implementation of vis() and unvis()
2016-12-07 16:28:06 -05:00
Vincent Batts 05a295f267
test: discovered vet issue, masked by tags
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-12-07 16:26:04 -05:00
Vincent Batts 812981d95d
vis: switch to the golang vis by default
and have the C vis()/unvis() available as a 'cvis' build tag.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-12-07 16:16:30 -05:00
Vincent Batts 08b1000418
vis: adding a pure golang Vis()
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>
2016-12-07 16:12:28 -05:00
Vincent Batts e42c679e89 Merge pull request #100 from vbatts/test
cli.test: add case from #90
2016-11-30 21:50:47 -05:00
Vincent Batts e2640e6dfa
cli.test: add case from #90
Closes #90

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-11-30 21:41:39 -05:00
Vincent Batts efe17f56ae Merge pull request #99 from vbatts/cli.test
cli.test: fail on cli tests
2016-11-29 13:59:59 +00:00
Vincent Batts f49f66f61e
cli.test: fail on cli tests
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>
2016-11-22 10:57:47 -05:00