r6748 - in branches/gcc4/BOOK: chapter01 chapter05

Matthew Burgess matthew at linuxfromscratch.org
Wed Aug 24 12:46:53 PDT 2005

Archaic wrote:
> On Tue, Aug 23, 2005 at 02:18:18PM -0600, matthew at linuxfromscratch.org wrote:
>>Remove '&&' from the `find' command that removes fixed headers as this may fail due to a race condition between `find' and `rm' (fixes bug 1621)
> Sorry I didn't catch this when reported as a bug, but I think a better
> solution would be:
> find ${GCC_INCLUDEDIR}/* -xtype d |xargs rm -rf &&

Confessions of a Linux-user wannabe :)  I haven't used xargs...ever, but 
it seems as if it's still affected by the race condition.  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.



More information about the lfs-book mailing list