NetBSD Problem Report #16651

Received: (qmail 18715 invoked from network); 4 May 2002 01:56:28 -0000
Message-Id: <20020504015629.3443811130@www.netbsd.org>
Date: Fri,  3 May 2002 18:56:29 -0700 (PDT)
From: svs@ropnet.ru
Sender: nobody@netbsd.org
Reply-To: svs@ropnet.ru
To: gnats-bugs@gnats.netbsd.org
Subject: fts(3), as used in base system, breaks on directories that do not contain `..' entry
X-Send-Pr-Version: www-1.0

>Number:         16651
>Category:       bin
>Synopsis:       fts(3), as used in base system, breaks on directories that do not contain `..' entry
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 04 01:57:00 +0000 2002
>Closed-Date:    
>Last-Modified:  Sat Jan 19 20:57:47 +0000 2008
>Originator:     Sergey Svishchev
>Release:        1.5ZC
>Organization:
>Environment:
>Description:
A FAT32 or CD9660 filesystem can have directories that do not contain `..' entry (exactly why that happened, I'm not sure).  du(1) and find(1), which use fts(3), will exit with error message "fts_read: No such file or directory", once they 
encounter such directories.

>How-To-Repeat:

>Fix:
Not a fix, but a workaround:

Index: usr.bin/du/du.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/du/du.c,v
retrieving revision 1.17
diff -u -r1.17 du.c
--- du.c	2001/01/04 23:05:54	1.17
+++ du.c	2002/04/29 22:22:09
@@ -81,7 +81,7 @@
 	save = argv;
 	Hflag = Lflag = Pflag = aflag = cflag = kmflag = sflag = 0;
 	totalblocks = 0;
-	ftsoptions = FTS_PHYSICAL;
+	ftsoptions = FTS_PHYSICAL | FTS_NOCHDIR;
 	while ((ch = getopt(argc, argv, "HLPackmrsx")) != -1)
 		switch (ch) {
 		case 'H':
Index: usr.bin/find/main.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/find/main.c,v
retrieving revision 1.17
diff -u -r1.17 main.c
--- main.c	2000/08/04 09:01:05	1.17
+++ main.c	2002/04/29 22:22:11
@@ -88,7 +88,7 @@
 	/* array to hold dir list.  at most (argc - 1) elements. */
 	p = start = alloca(argc * sizeof (char *));

-	ftsoptions = FTS_NOSTAT | FTS_PHYSICAL;
+	ftsoptions = FTS_NOSTAT | FTS_PHYSICAL | FTS_NOCHDIR;
 	while ((ch = getopt(argc, argv, "HLPXdf:hsx")) != -1)
 		switch (ch) {
 		case 'H':

>Release-Note:
>Audit-Trail:

From: Jaromir Dolecek <jdolecek@NetBSD.org>
To: svs@ropnet.ru
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: admin/16651: fts(3), as used in base system, breaks on directories
 that do not contain `..' entry
Date: Sat, 4 May 2002 09:44:40 +0200 (CEST)

 Well, NetBSD msdosfs & cd9600 should fake '..' entry always.
 If not, it's a (different) bug. I.e. actual bug to be fixed
 is the kernel code faking the '..' entry, not dealing with it
 in userland.

 Can you describe in which case you get directory without '..'
 entry on NetBSD?

 Jaromir
 -- 
 Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/Ports/i386/ps2.html
 -=- We should be mindful of the potential goal, but as the tantric    -=-
 -=- Buddhist masters say, ``You may notice during meditation that you -=-
 -=- sometimes levitate or glow.   Do not let this distract you.''     -=-

From: Sergey Svishchev <svs@ropnet.ru>
To: Jaromir Dolecek <jdolecek@NetBSD.org>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: admin/16651: fts(3), as used in base system, breaks on directories that do not contain `..' entry
Date: Sun, 5 May 2002 20:49:05 +0400

 On Sat, May 04, 2002 at 09:44:40AM +0200, Jaromir Dolecek wrote:
 > Can you describe in which case you get directory without '..'
 > entry on NetBSD?

 In cd9660 case, I don't have a test case handy (the disc is gone);  
 I'll try to recreate (i.e. damage :-) msdosfs in a day or two.

 Basically, this involves writing to the fs from NetBSD, then Win*, then
 again NetBSD...  add some scandisk runs to the mix... and you have it :)

 -- 
 Sergey Svishchev


Responsible-Changed-From-To: netbsd-admin->kern-bug-people 
Responsible-Changed-By: soren 
Responsible-Changed-When: Sat Aug 3 12:54:01 PDT 2002 
Responsible-Changed-Why:  
This is (at least) a kernel bug. 
>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.