Commit Graph

12 Commits

Author SHA1 Message Date
thesayyn 17374843eb
visitor pattern 2023-10-24 15:58:31 -07:00
Aleksa Sarai 07c8c8e17a
parse: clean path after checking if entry is a FullType
The spec[1] doesn't mention anything about cleaning paths, but it does
explicitly refer to the path containing a "/". Cleaning the path before
checking if the entry is a FullType would result in the simplest way of
forcing directories to be FullTypes (appending a "/" to the pathname of
any directory) not working with go-mtree.

[1]: https://man.netbsd.org/mtree.5

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2023-06-04 20:14:00 +10:00
Aleksa Sarai 63dc31a80a
parse: do not allow FullType entries to affect the current directory
As per the spec[1], Full entries must not affect the current directory.
Handling this incorrectly caused us issues with certain manifests (ones
with mixed Relative and Full entries, which is something casync does by
accident).

This is a partial fix for the issues with verifying casync-mtree's
output but there are a few other issues to iron out (including one
within casync).

[1]: https://man.netbsd.org/mtree.5

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2023-06-04 20:13:30 +10:00
Vincent Batts 4eec68be4b
*: make Keyword and KeyVal pervasive
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-11-17 21:38:01 -05:00
Aleksa Sarai 36372dd3c8
mtree: remove use of dhCreator for iterators
Fix a bug in the parser that caused all iterators to have to handle the
/set and /unset semantics separately. In addition, provide a helper
function to correctly generate the merged set of keywords for a
particular entry.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-11-10 11:30:06 +11:00
Stephen Chung decc72b335 tar: create and validate a manifest from a tar stream
This commit contains added features to go-mtree that allows
user to create an mtree spec with '-T' option when specifying
a tar archive. Users can also validate an mtree spec against
a tar archive with an mtree spec. Also for the test archive,
there is a mixture of files, and folders (empty & non-empty),
and symlinks (broken & unbroken).

Signed-off-by: Stephen Chung <schung@redhat.com>
2016-07-23 12:07:43 -04: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
Vincent Batts c3855dab6d travis: add travis check
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-06 13:57:11 -04:00
Vincent Batts 05f9b75a19 check: fix the checking of a hierarchy
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 16:20:04 -04:00
Vincent Batts a05d8ebbbd *: cleaner Parent handling
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
Vincent Batts 455edf6d21 *: loads of walking features
For the most part, all the keywords for a standard mtree spec now have a
function to produce the contents for a creator.

These are used in the "walk" function, and will be used next in the
"check" logic.

This is still a WIP, as the DirectoryHierarchy produced from the current
Walk() is not all-together a valid document.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-24 16:35:09 -04:00
Vincent Batts fe68ca2065 *: parsing a spec to a Hierarchy struct
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-03-11 15:58:18 -05:00