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>
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>
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>
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>
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>
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>