bug-findutils
[Top][All Lists]
Advanced

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

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


From: James Youngman
Subject: Re: Changes to the filesystem while find is running - comments?
Date: Tue, 23 Nov 2004 22:17:51 +0000
User-agent: Mutt/1.3.28i

On Tue, Nov 23, 2004 at 01:58:00PM -0800, Troy wrote:
> James,
> 
> Would it be possible to replace the sanity check for inode number with a
> sanity check for cwd and directory name? After all, if the directory is 
> moved (renamed or given another parent directory) while find is running, 
> then the CWD will have changed. On the other hand, if stat'ing or chdir'ing 
> the directory has caused automount to mount a new filesystem on it, the 
> CWD will not have changed. This would seem to be a fix.
> 
> What do you think?

Checking the result of getcwd() would have substantially the right
effect.  It encapsulates the "did we end up where we expected?"
condition, too.

Unfortunately on most systems it's pretty expensive (it stats "." and
then does opendir(".."), calling stat() on each entry to find the
basename of the current directory, and then repeats this process with
the parent directory).  That is problematic from our point of view,
firstly because of the impact on performance but also because it does
filesystem traversal without checking things.  Protecting ourselves
while we are moving up the directory hierarchy also becomes a lot more
complicated if our method of protecting ourselves does in fact move up
the directory hierarchy itself.

There are systems on which getcwd() is actually a system call but not
all systems are like that.

Thanks.
James.




reply via email to

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