Subject: admin/16651: fts(3), as used in base system, breaks on directories that do not contain `..' entry
To: None <gnats-bugs@gnats.netbsd.org>
From: None <svs@ropnet.ru>
List: netbsd-bugs
Date: 05/03/2002 18:56:29
>Number:         16651
>Category:       admin
>Synopsis:       fts(3), as used in base system, breaks on directories that do not contain `..' entry
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    netbsd-admin
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 03 18:57:00 PDT 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted: