Subject: bin/25693: mtree does not detect newly non-empty directory
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <seb@ssr.univ-paris7.fr>
List: netbsd-bugs
Date: 05/24/2004 13:47:28
>Number: 25693
>Category: bin
>Synopsis: mtree does not detect newly non-empty directory
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon May 24 11:48:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Stoned Elipot
>Release: NetBSD 2.0E
>Organization:
>Environment:
System: NetBSD runabout 2.0E NetBSD 2.0E (RUNABOUT) #0: Fri May 7 21:02:16 CEST 2004 seb@runabout:/u/seb/src/RUNABOUT/kernel/compile i386
Architecture: i386
Machine: i386
>Description:
Mtree fails to detect no-empty directory when given the spec of an empty
directory. Please note it holds true for both the old history spec
format and the new one (produced with -C).
>How-To-Repeat:
$ ls -a
. ..
$ mtree -c > /tmp/mtree.spec
$ touch bar
$ mtree -f /tmp/mtree.spec
.: modification time (Mon May 24 13:38:40 2004, Mon May 24 13:38:51 2004)
$ mtree -c > /tmp/mtree.spec2
$ touch baz
$ mtree -f /tmp/mtree.spec2
.: modification time (Mon May 24 13:38:51 2004, Mon May 24 13:39:14 2004)
extra: baz
$
Notice that mtree on the first verify run does not report
the extra 'bar' file.
>Fix:
The following diff correct this but notice that it is the exact opposite
of the patch applied in revision 1.11 of verify.c. Unfortunately I was not
able to make a test case to check if the bug this revision is supposed
to fix is still there (see PR 3365).
Index: verify.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/mtree/verify.c,v
retrieving revision 1.36
diff -u -r1.36 verify.c
--- verify.c 27 Oct 2003 00:12:44 -0000 1.36
+++ verify.c 15 May 2004 11:20:47 -0000
@@ -122,13 +122,13 @@
ep->flags |= F_VISIT;
if (compare(ep, p))
rval = MISMATCHEXIT;
- if (!(ep->flags & F_IGN) &&
- ep->child && ep->type == F_DIR &&
+ if (ep->flags & F_IGN)
+ fts_set(t, p, FTS_SKIP);
+ else if (ep->child && ep->type == F_DIR &&
p->fts_info == FTS_D) {
level = ep->child;
++specdepth;
- } else
- fts_set(t, p, FTS_SKIP);
+ }
break;
}
>Release-Note:
>Audit-Trail:
>Unformatted: