NetBSD Problem Report #25693

Received: (qmail 17845 invoked by uid 605); 24 May 2004 11:47:32 -0000
Message-Id: <200405241147.i4OBlS67003241@veracruz.starfleet.univ-paris7.fr>
Date: Mon, 24 May 2004 13:47:28 +0200 (CEST)
From: seb@ssr.univ-paris7.fr
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: seb@starfleet.univ-paris7.fr
To: gnats-bugs@gnats.NetBSD.org
Subject: mtree does not detect newly non-empty directory
X-Send-Pr-Version: 3.95

>Number:         25693
>Category:       bin
>Synopsis:       mtree does not detect newly non-empty directory
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 24 11:48:00 +0000 2004
>Closed-Date:    Sun Mar 18 11:51:35 +0000 2012
>Last-Modified:  Sun Mar 18 11:51:35 +0000 2012
>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:
State-Changed-From-To: open->closed
State-Changed-By: jruoho@NetBSD.org
State-Changed-When: Sun, 18 Mar 2012 11:51:35 +0000
State-Changed-Why:

Should be fixed.



>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.