[Top][All Lists]

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

Re: Changes to the filesystem while find is running - comments?

From: Tim Nelson
Subject: Re: Changes to the filesystem while find is running - comments?
Date: Mon, 29 Nov 2004 15:52:39 +1100 (EST)

On Fri, 26 Nov 2004, Martin Buchholz wrote:

James Youngman wrote:
On Fri, Nov 26, 2004 at 03:23:48PM +1100, Tim Nelson wrote:

What we need to do - and what we do do - is this -

$tmp = <base name of subdirectory>;

        According to the description by Steve Revilak which was sent
through, if you at this point do:

$tmp = $tmp + '.';

        ...then that will fix the problem.  So instead of statting eg.
"/usr/local/bin", you'll be statting "/usr/local/bin/." (note the dot in
the second one).

It's an interesting idea.  However, the code we have now in
findutils-4.2.8 works, and I'm reluctant to change this again unless
we find there's a problem.

It doesn't bother me either way; I don't use Sun. I was just trying to come up with a solution to the problem; I was under the impression that the problem existed on Solaris machines. :)

Also, I see some problems with the proposed solution.
We need to lstat the name without "/." to find out if
it's a symlink in any case, and stat-ing "foo/." is likely
to be a little slower than stat-ing "foo", for no good
reason.  Only users of automounters should pay an automounter tax.

        Ok, so try this sequence:

[Right at the start of the program]------------
if($os = 'Solaris') { $badautomount = 'true'; }

[In the bit around the sanity check]-----------

$tmp = <base name of subdirectory>;
$old = lstat $tmp;   /* line A */
# Softlink checking here
if($badautomount) {
        $tmp = $tmp + '.';
        $old = lstat $tmp;
chdir $dir;          /* line B */
$new = lstat ".";    /* line C */
wd_sanity_check($old, $new);

        Sure, even non-automounters "pay a tax" now, but it's only:
1.      A once-off OS check
2.      A true/false integer comparison, which should have minimal impact

Incidentally, I took Bugtraq off the CC list, since they don't seem to be posting these anyway.


Tim Nelson
Server Administrator
WebAlive Technologies Global
Level 1 Innovation Building, Digital Harbour
1010 LaTrobe Street
Docklands, Melbourne, Vic, 3008
Phone: +61 3 9934 0812
Fax: +61 3 9934 0899
E-mail: address@hidden

reply via email to

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