[5729] in bugtraq

home help back first fref pref prev next nref lref last post

Re: longpath.sh

daemon@ATHENA.MIT.EDU (Zack Weinberg)
Wed Dec 3 02:43:10 1997

Date: 	Tue, 2 Dec 1997 10:49:17 -0500
Reply-To: Zack Weinberg <zack@RABI.PHYS.COLUMBIA.EDU>
From: Zack Weinberg <zack@RABI.PHYS.COLUMBIA.EDU>
X-To:         Szekely-Benczedi Endre <eszekely@uttgm.ro>
To: BUGTRAQ@NETSPACE.ORG
In-Reply-To:  Your message of "Mon, 01 Jan 1996 16:37:01 +0200." 
              <Pine.LNX.3.95.960101162554.10101A-100000@felix.uttgm.ro>

On Mon, 1 Jan 1996 16:37:01 +0200, Szekely-Benczedi Endre wrote:
>        There is a nice small shell script at www.rootshell.com,
>longpath.sh, wich exploits some bug in Linux about long pathnames...
>
>Here's the program:
[snip]

>I tried the script on a RedHat Linux, and... well... I can't erase the
>directory now ;-)
>        I wonder if anyone of you knows the problem, and can help me with
>that..

It's a widespread problem, Solaris tools get just as confused (although
nothing coredumped on me).  The script, btw, can be expressed as a perl
one-liner:

perl -e '$a = shift; while(mkdir($a, 0755)) { chdir $a; }' <dir>

which will go as deep as your OS allows.  To get rid of it, try

perl -e '$a = shift; 1 while(chdir($a));
         do { chdir("..") } while(rmdir($a));' <dir>

where <dir> is the name of the directory tree you want to create/delete.

zw

home help back first fref pref prev next nref lref last post