Subject: CVS commit: basesrc/usr.sbin/mtree
To: None <source-changes@netbsd.org>
From: Luke Mewburn <lukem@netbsd.org>
List: source-changes
Date: 11/07/2001 10:01:53
Module Name:	basesrc
Committed By:	lukem
Date:		Wed Nov  7 08:01:53 UTC 2001

Modified Files:
	basesrc/usr.sbin/mtree: Makefile compare.c create.c extern.h misc.c
	    mtree.8 mtree.c mtree.h spec.c verify.c

Log Message:
User interface changes from (or inspired by) FreeBSD:
- 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.


To generate a diff of this commit:
cvs rdiff -r1.19 -r1.20 basesrc/usr.sbin/mtree/Makefile \
    basesrc/usr.sbin/mtree/misc.c
cvs rdiff -r1.33 -r1.34 basesrc/usr.sbin/mtree/compare.c
cvs rdiff -r1.35 -r1.36 basesrc/usr.sbin/mtree/create.c
cvs rdiff -r1.18 -r1.19 basesrc/usr.sbin/mtree/extern.h
cvs rdiff -r1.26 -r1.27 basesrc/usr.sbin/mtree/mtree.8
cvs rdiff -r1.23 -r1.24 basesrc/usr.sbin/mtree/mtree.c \
    basesrc/usr.sbin/mtree/verify.c
cvs rdiff -r1.17 -r1.18 basesrc/usr.sbin/mtree/mtree.h
cvs rdiff -r1.39 -r1.40 basesrc/usr.sbin/mtree/spec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.