[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Segfault in "rm -rf" with really deep dir-tree

From: Sten Eriksson
Subject: Re: Segfault in "rm -rf" with really deep dir-tree
Date: Tue, 29 Jan 2002 09:39:22 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7) Gecko/20011226

Bob Proulx wrote:

The version of rm you are using is 4.0.36 from the GNU fileutils
package.  And that happens to be later than 4.0s (equivalent to 4.0.19
in the new numbering) that the fix was reported fixed in.  It is
possible that a glibc problem is occurring on your system.

I dont think it's a glibc or kernel problem, I have managed do both create and delete directory-trees deeper with other tools (perl one-liners and smallish c-hacks, see further down).

I believe I am running into the filesystem max path length in both
cases.  It just can't make a path any deeper at that point.

Really?! I think its more of a shell-limit when creating the directories (se further down). I have not actually tested how deep I can make the tree, since the point was just to proove that 'rm' dies rather than informing the user of its problems.

But using rm version 4.1 I cannot create any failures removing that
deep path on either system.

I don't think a tree with a depth of 4202 is any problem, I actually don't know how large it has to be to break rm, it may vary from system to system.

 - - - -

I fetched the 4.1 tarball and made another test:

 [1st we make a tree 19999 dirs deep]
# perl -e 'for($i=0;$i<20000;$i++){mkdir "z";system("/bin/sync");chdir z";print "$i ";}'

 [As usual the 4.0.36 version segfaults]
# rm -rf z
Segmentation fault (core dumped)

 [And so does the 4.1 version]
# ./fileutils-4.1/src/rm --version
rm (fileutils) 4.1
Written by Paul Rubin, David MacKenzie, Richard Stallman, and Jim Meyering.

Copyright (C) 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
# ./fileutils-4.1/src/rm -rf z
Segmentation fault (core dumped)

 [Other tool, pike, happily deletes what perl created]
# pike -e 'int zc=0;while(file_stat("z",0)){cd("z");zc++;write("%d.",zc);};write("\n");for(;zc>0;zc--){cd("..");write("%d-",Stdio.recursive_rm("z"));write("%d.",zc);}'

 / Sten Eriksson                | Mail: address@hidden
/  Uppsala Universitet, IT-Stöd | Tel. work:  +46 18 471 79 26  /
   Nätgruppen                   | Tel. mob:   +46 70 425 06 76 /

reply via email to

[Prev in Thread] Current Thread [Next in Thread]