Fixes#7. Upper 3 bits are 'special' mode bits, and are not
included when calling info.Mode().Perm(). Need to mask
the info.Mode() with the corresponding mode bit defined
by the go library to see if these bits are set or not.
Signed-off-by: Stephen Chung <schung@redhat.com>
Resolves#21. When using `-k` option, gomtree should use
only the keywords specified by the user, as well as the 'type'
keyword if it wasn't specified.
Signed-off-by: Stephen Chung <schung@redhat.com>
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>
Fixes#11. Check() changes its working directory to `root`, which
is specified as an argument. Thus, it shouldn't open
a file using its absolute path; instead it should open the file
with the relative path to the root.
Signed-off-by: Stephen Chung <schung@redhat.com>
Make sure a keyword is valid before checking if
the keyword exists in the set of KeyVals that
Check() is supposed to validate.
Signed-off-by: Stephen Chung <schung@redhat.com>
Setting up sibling and parent relationships for entries, so they can be
easier to walk.
Also, making "keyword=value" easier to parse. This helps filtering.
Both of these ready us for checking/validating a hierarchy.
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Initially only on linux platform, but could accommodate BSDs as well.
The keyword is rather a prefix of the key. So xattr keyword will have a
prefix of "xattr." followed by a suffix of its namespace and name.
The value stored in the manifest is the SHA1 digest of the extended
attribute's data.
Signed-off-by: Vincent Batts <vbatts@hashbangbash.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>