Date: Mon, 16 Oct 2006 14:31:42 +0400 (MSD) From: Yar Tikhiy <yar@comp.chem.msu.su> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/104458: fts(3) can't handle very deep trees Message-ID: <200610161031.k9GAVgNs009795@bsd.chem.msu.ru> Resent-Message-ID: <200610161040.k9GAeGof025511@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610161031.k9GAVgNs009795>
