Bug 175293 - [patch] mtree(1): mtree "-u" option doesn't return error for extra directories
Summary: [patch] mtree(1): mtree "-u" option doesn't return error for extra directories
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.1-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
Depends on:
Reported: 2013-01-14 16:40 UTC by Lowell Gilbert
Modified: 2017-12-31 22:29 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Lowell Gilbert 2013-01-14 16:40:00 UTC
The "-u" option for mtree doesn't kick out an error if the extra contents are a directory rather than a regular file.

The same problem appears to still be present in the NetBSD version being imported.


--- verify.c	(revision 245177)
+++ verify.c	(working copy)
@@ -134,36 +134,37 @@
 		if (ep)
 		if (!eflag) {
 			(void)printf("%s extra", RP(p));
 			if (rflag) {
 				if ((S_ISDIR(p->fts_statp->st_mode)
 				    ? rmdir : unlink)(p->fts_accpath)) {
 					(void)printf(", not removed: %s",
 				} else
 					(void)printf(", removed");
 		(void)fts_set(t, p, FTS_SKIP);
 	if (sflag)
 		warnx("%s checksum: %lu", fullpath, (unsigned long)crc_total);
 	return (rval);
How-To-Repeat: rm -rf *
mkdir etc home
mtree -c -d > ../out
mtree -d < ../out
echo $?
echo "That was the first: should be 0."
mkdir etc/temp
mtree -u -d < ../out
echo $?
echo "That was the second: should be 2."

sed -i ""  's/^\(home[ ]*\)\(.*\)$/\1ignore/' ../out
mtree -d < ../out
echo $?
echo "That was the third: should be 0."
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:14 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped