This can be used in /etc/security to allow special.local to override
types of entries in special (e.g, replacing a dir with a link).
Rename Wflag to mtree_Wflag, to be more "external namespace" friendly.
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
and then all the other fields. (I.e, like -D except with the name
first instead of last).
Consistenly strsvis(3) encode path names (even for -C and -D).
round has been tested on Solaris/x86 and Linux hosts.
* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
- Add -L to walk the tree `logically', by following symbolic links in
the heirarchy.
- Add -P to walk the tree `physically'. This is the current behaviour,
and the default.
- Add "-X excludes-file" to give mtree the ability to exclude files and
directories from its traversal. excludes-file contains fnmatch(3)
patterns to exclude from the walk.
- Add "md5digest" synonym for "md5".
- Add "rmd160" keyword for RMD-160 message digest, and "rmd160digest" synonym.
- Add "sha1" keyword for SHA-1 message digest, and "sha1digest" synonym.
- Don't try to compare() other attributes if the type doesn't match;
it's nothing but trouble, and no use anyway.
- In -c, only emit "/set" records if something has changed since the
previous one.
User interface changes by me:
- Check a device's parameters before checking uid/gid/mode.
- If updating (-u), modify the following to match the specification:
- Device type (retaining existing ownership).
- Symlink target.
Fixes from (or inspired by) FreeBSD:
- Use p->ftslevel instead of own code to keep track of the level ourself.
The previous code got majorly confused if fts(3) couldn't descend
into a subdir, resulting in leaf nodes getting attached to the wrong
directory.
XXX: This new method is much much more robust, even though it's not 100%
perfect; it might result in a couple of following entries in the spec
to be incorrectly tagged as missing.
- Pass a useful pathname to rlink(), so that logical (-L) traversal
doesn't confuse symlink checking.
- Consistently use MAXPATHLEN+1 sized buffers for pathnames, so that
there's room for the NUL.
- Use mtree_err() and strerror(p->fts_errno) to report errors during
the fts(3) walk.
Fixes by me:
- Remove now-unused `const char *name' argument from compare().
- Change crc_total from an int to a u_int32_t, to match usr.bin/cksum/crc.c.
- Remove trailing whitespace.
- Remove unnecessary (void) casts on functions.
- Reorder entries in the getopt() switch.
- Replace strtoq() with strtoll(), and use strtoul() appropriately.
- Renumber F_ flags to be in alphabetical order.
of tv's previous code, which skips uname or gname parsing if -W is enabled.
- rename "lineno" to "mtree_lineno", to reduce possibility of name
clashes in code that yanks in spec.c & misc.c (unlikely, but you never know)
various potential problems when intermixing full and relative paths
- changes to make it much easier to use spec() - the specfile parser - in
other programs (via .PATHing spec.c and misc.c):
- move excludetags, includetags and keys from mtree.c to misc.c
- implement mtree_err() using vwarnx() instead of assuming name is
"mtree"
- move inotype() and nodetype() from compare.c to misc.c
- add nodetoinode(), to convert from an mtree F_* type to a
mode_t S_IF* type
- clean up #include use; don't assume "mtree.h" pulls in some
standard includes
- change spec() to take a FILE * arg (where the specfile is read from)
is one that contains a `/' character that is not the first character.
All parent directories referenced in the path must exist.
* Add copyright for all the work I've done.
* Document the history of various features added since 4.3-Reno.
- parsekey(): support "all" as a keyword which returns a value with all bits
set that pertain to a valid keyword.
- dump_nodes():
- only print out a keyword if it's requested AND it's set in the node
- UNAME falls back to UID if the user name can't be determined
- GNAME falls back to GID if the group name can't be determined
- rework man page:
- use Sy instead of Cm
- use Pq, Dq, Ql, etc instead of ``...''
- create a typedef struct slist_t to hold stuff in (avoid stringlist(3)
because it's less portable)
- move the tag manipulate stuff into misc.c
- add matchtags(), which returns 0 if the node is explicitly excluded,
or not included if an include list is given; or 1 otherwise
- in -D, change tags support from files-only to all-non-directories
(xxx; still considering implementing tags support for -c and !-D)
- add a new keyword - "tags" - which is a comma separated list of tags
associated with that file.
- add "-E tags"; exclude files in -D output with matching tags
- add "-I tags"; only include files in -D output with matching tags
(default is to list all)
fixes:
- move all extern variable references from individual files into extern.h
- `quote' some more user-specified strings in error messages
- man page: list an options arguments in the description, and sort xrefs.
by various tools
- implement -R key - remove the given key(s) from the list of keys to print
(now it's possible with "-k type -R type" to remove all keys :)
- rename ftype() to nodetype(), and make it public
- use pwcache(3) functions instead of get{gr,pw}{nam,uid}(3)
- add dump_nodes(), which provides the guts for -D.
the error detection for invalid types, as well as shrinking binary size
- implement inotype() using ftype(), rather than duplicating the switch
- change "char *" arguments to "const char *"
Escape white space characters and `#' characters. Do the inverse
when reading specs.
This is a temporary fix until we have strzouvis(3) (or some such)
which is an improved version of strvis (taking an additional list
of characters to encode).
Fixes PR 5006 and PR 7663
checksum of the file in question, optionally preceeded by `0x'.
This has been tested, and does work, AFAICT. There is currently no md5 equivalent
of the '-s' flag for use with checksum.