bin/104458: fts(3) can't handle very deep trees
Yar Tikhiy
yar at comp.chem.msu.su
Mon Oct 16 03:40:18 PDT 2006
>Number: 104458
>Category: bin
>Synopsis: fts(3) can't handle very deep trees
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Oct 16 10:40:15 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Yar Tikhiy
>Release: FreeBSD 7.0-CURRENT i386
>Organization:
None
>Environment:
FreeBSD 7.0-CURRENT i386
>Description:
Utilities using fts(3), find(1) and rm(1) being among them,
fail to handle a directory tree so deep that a path in it is
longer than ~49-50K.
>How-To-Repeat:
1. Create a long chain of subdirectories using the script
attached. Each subdir name will be "000...". The overall
structure will be 000*/000*/000*/000*/...
This is better done on a scratch mfs because the
resulting chain will be hard to delete using stock tools.
2. Invoke rm or "find -delete" on it.
E.g.:
%csh xdir.csh 100 500
%rm -rf 0*
rm: fts_read: File name too long
%find 0* -delete
find: fts_read: File name too long
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#!/bin/csh
#
# Yeah, I know that csh programming is harmful,
# but /bin/sh cannot handle trees so deep.
# See PR bin/104456.
#
set len=$1 # lenght of each name
set dep=$2 # depth
set name=`printf %0${len}d 0`
while ($dep)
mkdir $name && cd $name
@ dep--
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list