r6748 - in branches/gcc4/BOOK: chapter01 chapter05

Matthew Burgess matthew at linuxfromscratch.org
Wed Aug 31 11:11:48 PDT 2005

Matthew Burgess wrote:
> I believe
> that '-maxdepth' would cure all these problems though? i.e.:
> find ${GCC_INCLUDEDIR}/* -maxdepth 1 -xtype d -exec rm -rf {} \; &&
> That way, `find' only ever points to (and scans as far as) the top-level 
> directories that need deleting, therefore can't race with `rm' which 
> recursively deletes below those directories.

Can anyone comment on my above suggestion?  Will it avoid the race 
condition?  Looking at find(1L) hints that '-maxdepth 0' is actually 
what we want, and that it will avoid the race condition, but I'd like 
confirmation from someone else if at all possible.



More information about the lfs-book mailing list