1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-11-05 00:15:58 +00:00
Commit graph

20 commits

Author SHA1 Message Date
ed464af779
*: xattr can Update()
This is a gnarly patchset that has been mashed together.
It uncovered that some aspects of Check were never really working
correctly for `xattr` keywords, but also the `Update()` had been left
undone for a while.

This includes some API changes around the `Keyword` and `KeyVal` types.

Also I would like to update the signature for the `UpdateKeywordFunc` to
just accept a `KeyVal` as an argugment, rather than a keyword AND the
value. with this context there would be no need to guess on the value of
what's passed to the xattr update function of whether it needs or
already is base64 encoded.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-24 15:05:24 -04:00
0ee52f7faf check: test times weren't different enough
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-15 18:02:14 -05: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
21723a3974
*: fix comparison of missing keywords
Adding another test validated from the FreeBSD workflow.

Just because the keywords requested to be validated are not present in
the manifest, it is not an error.
Also, if the keywords from a new manifest are not present in a prior
manifest, then only compare the common keywords.

Fixes https://github.com/vbatts/go-mtree/issues/86

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-11-17 21:38:10 -05:00
4eec68be4b
*: make Keyword and KeyVal pervasive
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-11-17 21:38:01 -05:00
627c6e9ddd
DirectoryHierarchy: UsedKeywords is a of the struct
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-11-16 14:43:05 -05:00
Aleksa Sarai
d214ab47e8
check: re-implement *Check() using Compare()
This removes all of the special handling code for both TarCheck() and
Check() so that everything now uses the new (generic) Compare() code. In
addition, the tests had to be modified to reflect the new classes of
errors.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-11-10 11:30:06 +11:00
fdf37fcebf test: cleanup testdir after testing
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-08-17 10:25:15 -04:00
Stephen Chung
2facedc401 check: functionality for symlinks
Default behavior (according to upstream mtree) for validating symlinks
is to just validate the link itself, not to follow it.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-08-10 15:01:07 -04:00
Stephen Chung
773763fb87 vis: refactored code to reflect using vis/unvis for file names
Added some more test cases for `vis`ing and `unvis`ing
strings, and a test case that walks/checks a directory with
filenames that require encoding. Had to change Path() to account
for possible errors Unvis() could return. Refactored Vis()/Unvis() into
go-mtree tar functionality as well.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-25 16:41:06 -04:00
Stephen Chung
656e577ecc *: have gomtree always evaluate tar_time if it is present
if the keyword "tar_time" is present when evaluating
an Entry, gomtree should use the tar_time when evaluating
the "time" keyword as well. This commit also adds a test that
makes sure "tar_time" wins against "time" if both are present.
Some minor clean-ups as well, such as checking if KeywordFunc[keyword]
actually retrieves a function.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-23 12:07:43 -04:00
61dd456524 Merge pull request #22 from stephen679/set_aliasing
check: creator.curSet pointer aliasing
2016-07-20 07:40:19 +09:00
Stephen Chung
f3fc3d06d6 parse: ignore leading whitespace for comments
Comments were only ignored if the string parsed
started with "#". This commit trims leading whitespace
and tab characters to make sure all lines with "#" being the
first non-whitespace character are ignored.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-17 12:21:52 -04:00
Stephen Chung
c99862ee53 check: creator.curSet pointer aliasing
When iterating over creator.DH.Entries using the variable
e, and then setting creator.curSet to &e, this causes aliasing
that results in the underlying Entry of creator.curSet to
change on each iteration. Instead we want to get the address of
the actual Entry in creator.DH.Entries.

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-15 08:58:26 -04:00
6adcc98b22 keywords: time keyword 9 postition decimal
Matching with the FreeBSD standard format

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-06-27 13:24:03 -04:00
fca9d4b5b6 check: failing test case for #8
https://github.com/vbatts/go-mtree/issues/8

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-06-27 13:19:23 -04:00
5399fd04d0 check: add an example for the docs
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-13 16:04:48 -04:00
b11b9c6a78 check: keyword filtering the checks
Allow for Check() to be narrowed to a set of keywords.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-13 15:50:59 -04:00
9c6b4257f4 check: now the simple test passes
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 18:13:27 -04:00
2fd41fb43f check: an initial pass at a validation check
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00