Commit Graph

399 Commits

Author SHA1 Message Date
Vincent Batts 14721e6869 keyval: cleaner struct functions
KeyVal specific functions can be a part of the struct.
Also add tests and fix the NewValue functions for suffixes

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-24 07:01:29 -04:00
Vincent Batts 64ecdb40ec Merge pull request #132 from vbatts/no_nsec_in_test
fseval: not nanosecond for mock test
2017-06-15 23:11:47 -05:00
Vincent Batts 9533b02a8e fseval: not nanosecond for mock test
while testing on osx, it seems that it doesn't support nanoseconds so it
fails this check because the mockFsEval returns the nsec precision, but
the actual expected results is:

		        "old": "1337888911.288518233"
			"new": "1337888911.000000000"

Ideally there will be a way to detect when the fs supports nsecs

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-15 22:54:59 -05:00
Vincent Batts bc45166bfc Merge pull request #131 from vbatts/firmer_test_time
check: test times weren't different enough
2017-06-15 20:10:43 -05:00
Vincent Batts 0ee52f7faf check: test times weren't different enough
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-15 18:02:14 -05:00
Vincent Batts abdee6fe11 Merge pull request #129 from vbatts/fix_gname
keyword: add missing `gname` keyword functions
2017-06-15 12:42:29 -05:00
Vincent Batts bbedbb3eaa lookupGroupId: add implementation for go1.6
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-15 12:36:11 -05:00
Vincent Batts f09463164c Merge pull request #130 from vbatts/fix_block_device_value
keyworrd: fix block device value for `type=`
2017-06-15 12:08:27 -05:00
Vincent Batts 5db2376250 keyworrd: fix block device value for `type=`
Fixes: #127

Reported-by: Lennart Poettering lennart@poettering.net
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-15 11:51:26 -05:00
Vincent Batts 68651d77d6 keyword: add missing `gname` keyword functions
Fixes: #128

Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-15 10:59:57 -05:00
Vincent Batts 469590a575 Merge pull request #126 from mjg59/master
test: Allow using an environment variable to override the test dir
2017-04-13 15:14:15 -04:00
Matthew Garrett cb1fb5dded test: Allow using an environment variable to override the test dir
Some build systems may not permit writing to . during build, so allow
that path to be overridden with an environment variable.
2017-04-13 11:35:01 -07:00
Vincent Batts 93776cd69e Merge pull request #125 from vbatts/restore
add an update/restore functionality
2017-03-17 12:51:27 -04:00
Vincent Batts fc5450ed71
*: add an update/restore functionality
This allows for restoring some attributes of files from the state in an
mtree Manifest

Reported-by: Matthew Garrett <Matthewgarrett@google.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-03-17 12:42:57 -04:00
Vincent Batts 0b9f227e4e
README: adding a go report card
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-03-13 18:30:01 -04:00
Vincent Batts e359fa7d2d Merge pull request #124 from vbatts/comment_update
Comment update
2017-02-16 07:51:21 -08:00
Vincent Batts 6e336a525d
git: add an ignores
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-02-16 10:45:15 -05:00
Vincent Batts eca64ff621
walk: update the comment
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-02-16 10:44:52 -05:00
Vincent Batts f165f4b7cc Merge pull request #123 from cyphar/test-unicode-integration
test: cli: add unicode verification test
2017-02-15 17:42:38 -08:00
Aleksa Sarai f6c295f2e9
test: cli: add unicode verification test
This wraps up the govis changes. While umoci has much more hardcore
tests for unicode, this is done to ensure that go-mtree won't break
before its vendored into umoci.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-16 09:28:21 +11:00
Vincent Batts 711a89aa4c Merge pull request #122 from cyphar/remove-govis-travis
pkg: govis: remove travis-ci files
2017-02-15 13:37:36 -05:00
Aleksa Sarai 4ad871ca46
pkg: govis: remove travis-ci files
Since govis is now a subpackage, drop references to the project as a
govis package.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-16 05:18:02 +11:00
Vincent Batts 7b6f89f33d Merge pull request #121 from cyphar/switch-to-govis
*: switch everything to govis
2017-02-15 13:14:38 -05:00
Aleksa Sarai c5ec1c9f3a
*: switch everything to govis
Now that we have govis, move everything to using govis.{Vis,Unvis} and
then remove the cvis build tags (because that code no longer exists).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-16 03:21:43 +11:00
Aleksa Sarai 91d7ec8c89
subtree merge: cyphar/govis
govis is a reimplementation of vis(3) and unvis(3) specifically made to
be unicode aware. It was specifically rewritten to replace cvis and the
other go vis reimplementation we have in go-mtree.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-16 03:08:51 +11:00
Aleksa Sarai c889416068
*: fix go-vet errors
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-16 03:08:07 +11:00
Aleksa Sarai c9551d5820
README: add travis-ci build
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-16 01:11:32 +11:00
Aleksa Sarai cbe20d4292
govis: extend roundtrip testing
This is necessary to ensure that strings I don't have examples of work
properly. The same thing applies for double-encode and double-decode
usecases.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-16 01:07:51 +11:00
Aleksa Sarai 4045484afb
vis: rewrite to use byte slices
This results in all multi-byte characters to be encoded in a way that
naive unvis(3) implementations will not bork up the encoding. In
addition, it also ensures that the output of Vis will always be ASCII
*only*.

Also test far more cases in *_test.go when it comes to different flags,
and do far more tests to ensure that the output of Vis() makes sense.
These outputs come directly from vis(3) and so are useful regression
tests to ensure that the handling of Vis() is identical to the original.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-16 01:07:16 +11:00
Aleksa Sarai c2a9f1a56d
flags -> govis
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-14 02:11:41 +11:00
Aleksa Sarai de223ffc92
unvis: implement meta and ctrl characters ('\M__' and '\^_')
While these characters are really weird to handle, here is a fairly
simple implementation that need some more testing (and a proper
secondary source to compare against).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-13 08:03:04 +11:00
Aleksa Sarai 7b16f3a307
travis: add .travis.yml
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-13 07:43:24 +11:00
Aleksa Sarai 35708696fe
unvis: implement proper '\xff' and '\377' escape handling
In particular, previously such escape handling would break because we
would attempt to encode characters >0x7f as runes -- which would then
result in escapes that want to encode multi-byte characters breaking.

There's still some work necessary in Vis() to make it act sanely when it
comes to arbitrary bit streams. Not to mention that we need to figure
out what we actually want to do there...

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-13 04:53:14 +11:00
Aleksa Sarai 3b18d38388
govis: add integration tests
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-12 04:08:21 +11:00
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