Commit Graph

133 Commits

Author SHA1 Message Date
Tim Kientzle
9feaf24750 Write timestamps with exactly 9 digits after the period.
This ensures that the value written is both compatible with
older mtree versions (which expect the value after the period
to be an integer count of nanoseconds after the whole second)
and is a correct floating-point value.

Leave the parsing code unchanged so it will continue to read
older files.
2009-01-31 05:17:28 +00:00
Tim Kientzle
bbc14adaed Accept integer times. Previously, the field "time=1233294539" would be
rejected as invalid.
2009-01-30 05:49:27 +00:00
Tim Kientzle
66cbdc8aab Add the mtree.5 manpage. I'll come back soon and
remove the format specification from mtree.8.
I also need to reconcile a few issues between this
mtree.5 and what is actually implemented in FreeBSD's
mtree utility.

MFC after: 30 days
2008-01-01 06:15:57 +00:00
Dag-Erling Smørgrav
afe54b5818 When applying a spec, traverse the existing directory tree in lexical
order.  This allows direct comparison of the output of two different
runs, regardless of the order in which readdir(2) returns directory
entries.

MFC after:	3 weeks
2007-12-07 12:22:38 +00:00
Giorgos Keramidas
1d916e2c71 mtree should use getcwd() instead of getwd(). getcwd() is safer,
because it includes checks for the length of the buffer it uses.

Reviewed by:	phk, cperciva
MFC after:	3 days
2007-11-02 15:11:53 +00:00
Maxim Konovalov
346e07c1ba o Add an example how to create /etc/mtree style mtree(8) files.
PR:		docs/113667
Submitted by:	edwin
MFC after:	1 week
2007-06-16 08:26:00 +00:00
Ruslan Ermilov
bc84aa4ba3 Markup fixes. 2006-09-29 17:57:04 +00:00
Maxim Konovalov
190483c011 o Add an 'optional' keyword, which allows files to be in the
specification, but not in the file hierarchy.

PR:		bin/99531
Submitted by:	skv
Obtained from:	NetBSD, originally from Ed Symanzik
Regress. test:	test/test05.sh
MFC after:	1 month
2006-07-03 10:55:22 +00:00
Brian Somers
6e03259288 If we fail in chown(2), try to just change the group and continue on to
change the permissions.  Failures are still recorded.

This allows mtree to do a generally better job of things when uid != 0.

Sponsored by:		ActiveState/Sophos
Partially submitted by:	neilw at ActiveState dot com
Reviewed by:		neilw at ActiveState dot com
MFC after:		3 weeks
2005-08-11 15:43:55 +00:00
Giorgos Keramidas
6fb9b618f5 Fix all the spelling mistakes I could find in the man pages for words
that have at least 3 characters.

MFC after:	1 week
Thanks to:	Music band ``Chingon''
		for keeping me company while searching for these.
2005-07-31 03:30:48 +00:00
Ruslan Ermilov
9d73fabda7 Markup fixes.
Approved by:	re (blanket)
2005-06-14 12:26:36 +00:00
Anton Berezin
b6a9d20adc Adds sha256 support. While it is a good idea to also add sha384 and
sha512, I did not do that since it is not entirely clear where "the one
true place" to hold their implementations is going to be.  Sha256 is
different since mtree already links against libmd.

Make recommended procedure for integrity checking in the manpage
consistent.

Fix a bug with -f spec1 -f spec2 comparison, which prevented
test/tes03.sh from running successfully.

Reviewed by:	phk, cperciva
2005-03-29 11:44:17 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
59a3c79da6 Sort sections. 2005-01-18 20:02:45 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Hidetoshi Shimokawa
e379c1ada3 Remove extra "*/". 2004-08-07 10:04:29 +00:00
Warner Losh
486c8cc4c6 Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived software
(with permission of addtional copyright holders where appropriate)
2004-08-07 04:28:56 +00:00
Ruslan Ermilov
455fb174df Eliminated double whitespace. 2004-07-03 18:35:53 +00:00
Ruslan Ermilov
07bfccd71e Mechanically kill hard sentence breaks. 2004-07-02 23:13:00 +00:00
Poul-Henning Kamp
987bbe23e8 Improve spec to spec comparison output. 2004-06-14 07:28:22 +00:00
Ruslan Ermilov
8a9a490ba2 Added forgotten -w to the usage(). 2004-06-04 19:29:28 +00:00
Ruslan Ermilov
b6f078071f Added forgotten -w to the SYNOPSIS.
Trim whitespace at EOL.
2004-06-04 19:25:47 +00:00
Poul-Henning Kamp
5e4b861c50 Get rid of "lineno: 0" in error messages from create mode.
Add -w(arning) flag which makes failure to look up uid/gid
a nonfatal warning instead of an error.
2004-01-11 19:38:48 +00:00
Poul-Henning Kamp
d8e4c710eb collect all "extern bla" stuff in extern.h in order to get cross-file
type checking.  No bugs found.
2004-01-11 19:25:56 +00:00
Poul-Henning Kamp
ed283fb506 Do not emit comments when -n is specified. 2004-01-08 22:21:45 +00:00
Poul-Henning Kamp
7e4687f1aa The new "spec against spec" comparison code was yet another time
victim of the special sort order employed where files come before
directories and alphabetic inside these two groups.

Approved by:	re@
2003-11-30 18:06:02 +00:00
Poul-Henning Kamp
dbed417dab Off by one error in malloc.
Approved by:	re@
2003-11-19 15:28:21 +00:00
Poul-Henning Kamp
af8e163ec3 Fix a bug relating to the "files before directories" sort order when
comparing two spec files.
2003-11-13 11:02:57 +00:00
Poul-Henning Kamp
d26516132c Add a small testcase for the new -f-f mode. 2003-11-05 22:26:39 +00:00
Poul-Henning Kamp
b3e66ec9df Give mtree(8) the ability to take [two -f spec] arguments and compare
the two specifications to each other.
2003-11-05 22:26:08 +00:00
Poul-Henning Kamp
93347ded1a Rename spec() and verify() functions to have mtree_ prefix and take
explicit file descriptor instead of assuming stdin.
2003-11-05 20:07:40 +00:00
Poul-Henning Kamp
11333b51ca Take advantage of the fact that we know the err(3) function does not
return to eliminate some else clauses and gain some "outdenting".
2003-11-05 20:05:05 +00:00
Bruce Evans
7ee49c89f7 Fixed breakage of my world in rev.1.30. #include <sys/time.h> instead of
depending on namespace pollution in <sys/stat.h> for the declarations of
struct timeval and utimes().

Fixed some style bugs in rev.1.30 and some nearby style bugs (mainly
unsorting and missing or extra blank lines).

Removed a wrong comment that was obtained from NetBSD in rev.1.14.  It said
that chflags() reset the times that were set "above" by utimes(), but
utimes wasn't "above" in FreeBSD until rev.1.30, and chflags() does't
actually reset the times.
2003-11-01 08:43:54 +00:00
Poul-Henning Kamp
671d15ef2a Make mtree's update function update the modification time too.
Submitted by:	Dan Nelson <dnelson@allantgroup.com>
PR:	53063
2003-10-31 13:39:19 +00:00
Poul-Henning Kamp
b585dc87cc Update test-case to also fail on filenames containing '#' 2003-10-30 12:40:54 +00:00
Poul-Henning Kamp
5d9f6ca65c Use vis(3) to encode/decode the target for symlinks.
Make vis(3) decode errors fatal for both symlink targets and fienames.
2003-10-30 12:03:25 +00:00
Poul-Henning Kamp
13b31fb0d8 Add another test-script for mtree(8): Check symlinks with space in them. 2003-10-30 12:01:32 +00:00
Poul-Henning Kamp
d474d12b52 Fix bug in mtree(8)'s create mode where files or directories with had
names containing glob(3) expressions would appear verbatim in the
output.

If such an mtree file were used by mtree in update mode, wrong things
would happen.
2003-10-30 10:48:43 +00:00
Poul-Henning Kamp
92817d311f Add a test script which Mtree fails. 2003-10-30 10:46:23 +00:00
Poul-Henning Kamp
3206e56993 Remove clause 3 in the copyrights (according to permission in src/COPYRIGHT)
Remove trailing whitespace.
2003-10-21 08:27:05 +00:00
Poul-Henning Kamp
4d169ae131 Remove "register" keywords.
Use newspeak functions definitions.
2003-10-21 07:58:52 +00:00
Ruslan Ermilov
959d6c24f6 Get rid of duplicates. 2003-09-14 13:41:59 +00:00
David E. O'Brien
b728350ee6 Use __FBSDID over rcsid[]. Protect copyright[] where needed. 2003-05-03 21:06:42 +00:00
Anton Berezin
0f02c85ed1 The -s option should not assume -U.
MFC After:	2 weeks
2003-03-19 10:56:34 +00:00
Robert Drehmel
0357726594 - Align the function prototype of the external `crc' function with
how `crc' is actually defined.
 - Remove an unnecessary `extern' variable declaration.
Data type corrections:
 - Define a variable which contains a file byte offset value as type
   off_t as required by the `crc' function.
 - Change the type of a variable carrying a CRC checksum from `u_long'
   to `uint32_t'.
 - Substitute the wrong `extern' variable declaration of `crc_total'
   by putting a correct one in the shared header extern.h.
   `crc_total' is defined as an `uint32_t', thus fixing
   incorrect mtree checksums on big-endian LP64 machines.
2003-03-13 23:35:30 +00:00
Anton Berezin
53bd74b7e9 Fix two minor mismatch reporting output errors.
Reviewed by:	phk
MFC After:		3 weeks
2003-03-13 15:14:56 +00:00
Ruslan Ermilov
8d5d039f80 Uniformly refer to a file system as "file system".
Approved by:	re
2002-12-12 17:26:04 +00:00
Ruslan Ermilov
26ffc9613f mtree(8) wasn't a bootstrap tool since 2000/07/23 (Makefile.inc1,v 1.161). 2002-11-13 12:03:27 +00:00
Garrett Wollman
0d3bcc2e80 Make the threatened fts(3) ABI fix. FTSENT now avoids the use of the struct
hack, thereby allowing future extensions to the structure (e.g., for extended
attributes) without rebreaking the ABI.  FTSENT now contains a pointer to the
parent stream, which fts_compar() can then take advantage of, avoiding the
undefined behavior previously warned about.  As a consequence of this change,
the prototype of the comparison function passed to fts_open() has changed
to reflect the required amount of constness for its use.  All callers in the
tree are updated to use the correct prototype.

Comparison functions can now make use of the new parent pointer to access
the new stream-specific private data pointer, which is intended to assist
creation of reentrant library routines which use fts(3) internally.

Not objected to in spirit by: -arch
2002-09-21 01:28:41 +00:00
Dag-Erling Smørgrav
b3f379f65f Get rid of %qd, and unbreak Alpha build. 2002-07-15 12:17:31 +00:00