Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jan 2013 11:34:18 -0500 (EST)
From:      Lowell Gilbert <freebsd-bugs-local@be-well.ilk.org>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        brooks@freebsd.org
Subject:   bin/175293: mtree "-u" option doesn't return error for extra directories
Message-ID:  <20130114163418.A140639855@lowell-desk.lan>
Resent-Message-ID: <201301141640.r0EGe0MS049979@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         175293
>Category:       bin
>Synopsis:       mtree "-u" option doesn't return error for extra directories
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 14 16:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Lowell Gilbert
>Release:        FreeBSD 9.1-STABLE amd64
>Organization:
The Ilk
>Environment:
System: FreeBSD lowell-desk.lan 9.1-STABLE FreeBSD 9.1-STABLE #9 r245177M: Wed Jan 9 06:47:54 EST 2013 root@lowell-desk.lan:/usr/obj/usr/src/sys/LOWELL64 amd64


	
>Description:

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.

>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."

	
>Fix:

	


===================================================================
--- verify.c	(revision 245177)
+++ verify.c	(working copy)
@@ -134,36 +134,37 @@
 
 		if (ep)
 			continue;
 extra:
 		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",
 					    strerror(errno));
 				} else
 					(void)printf(", removed");
 			}
 			(void)putchar('\n');
 		}
 		(void)fts_set(t, p, FTS_SKIP);
 	}
+	rval = MISMATCHEXIT;
 	(void)fts_close(t);
 	if (sflag)
 		warnx("%s checksum: %lu", fullpath, (unsigned long)crc_total);
 	return (rval);
 }
 
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130114163418.A140639855>