>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 [email protected]:/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:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to