[5731] in bugtraq

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

Re: your mail

daemon@ATHENA.MIT.EDU (Mordechai T. Abzug)
Wed Dec 3 02:43:23 1997

Date: 	Tue, 2 Dec 1997 07:38:29 -0500
Reply-To: "Mordechai T. Abzug" <morty@MAIL.SANCTUARY.ARBUTUS.MD.US>
From: "Mordechai T. Abzug" <morty@MAIL.SANCTUARY.ARBUTUS.MD.US>
X-To:         eszekely@UTTGM.RO
To: BUGTRAQ@NETSPACE.ORG
In-Reply-To:  <Pine.LNX.3.95.960101162554.10101A-100000@felix.uttgm.ro> from
              "Szekely-Benczedi Endre" at Jan 1, 96 04:37:01 pm

Szekely-Benczedi Endre spake thusly:

>         There is a nice small shell script at www.rootshell.com,
> longpath.sh, wich exploits some bug in Linux about long pathnames...
[snip]
> I heard that it is possible to erase it with mc (Midnight Commander).
> Well, I can tell you' this ISN'T true ;-)
> 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..

#!/usr/local/bin/perl5

# this basically does an rm -r, only on directories.  Be careful.  :)

$junk="junk.$$";

mkdir $junk, 0700 || die "$0: $!";

$seq=0;
sub newseq { return ($seq++);}

foreach (@ARGV) {
        rename $_, $junk."/".&newseq || die "$0: $!";
}
chdir $junk || die "$0: $!";

$current=0;

while ($current<$seq) {
        foreach (glob "$current/*") {
                rename $_, "./".&newseq || die "$0: $!";
        }
        $current ++;
}

foreach (glob "*") {
        rmdir ($_) || die "$0: $!";
}
chdir ".." || die "$0: $!";
rmdir $junk || die "$0: $!";




Just give it the name of the top-level evil directory (making sure to run
it in the same filesystem), and it'll clean things up.  Next time, be more
careful.  :)

--
                        Mordechai T. Abzug
"Grad school is the snooze button on the clock-radio of life."
 - comedian John Rogers (who holds a graduate degree in physics)

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