Opened 19 years ago

Closed 19 years ago

#1621 closed defect (fixed)

gcc fixincludes error stops it working

Reported by: b3nt@… Owned by: lfs-book@…
Priority: lowest Milestone:
Component: Book Version: Branch_GCC4
Severity: normal Keywords:
Cc:

Description

In the gcc-4 book the gcc fixincludes command gives an error after the second line

lfs:/mnt/lfs/sources$ GCC_INCLUDEDIR=`dirname $(gcc -print-libgcc-file-name)`/include &&

find ${GCC_INCLUDEDIR}/* -xtype d -exec rm -rf \{} \; && rm -f grep -l "DO NOT EDIT THIS FILE" ${GCC_INCLUDEDIR}/* && unset GCC_INCLUDEDIR

find: /mnt/lfs/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.0.1/include/X11: No such file or directory find: /mnt/lfs/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.0.1/include/linux: No such file or directory find: /mnt/lfs/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.0.1/include/openssl: No such file or directory find: /mnt/lfs/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.0.1/include/ps: No such file or directory lfs:/mnt/lfs/sources$

Because the command find ${GCC_INCLUDEDIR}/* -xtype d -exec rm -rf \{} \; deletes the folders X11,linux,openssl and ps it then gives an error because find is still trying to search the folders that have just been deleted. This prevents the next lines from being run. Removing the `&&' from after the line find ${GCC_INCLUDEDIR}/* -xtype d -exec rm -rf \{} \; allows the lines

rm -f grep -l "DO NOT EDIT THIS FILE" ${GCC_INCLUDEDIR}/* && unset GCC_INCLUDEDIR

to run as they don't then depend on the previous command

Change History (2)

comment:1 by Matthew Burgess, 19 years ago

Thanks Andrew. I've not actually seen this problem on my box, but it looks like a classic race condition. There is a '-delete' action in findutils >= 4.2.3 which minimises this problem, but as we're in chapter 5 here and 4.2.3 only dates back to 2004-10-31 I don't think it's feasible to use that.

So, it looks like removing the '&&' is the only way around this! Trying to think back as to why I put the '&&' in there, I think it was in a vain attempt to catch typos in either the setting of GCC_INCLUDEDIR or the `find' command line itself. As we're the 'lfs' user at this stage, any damage done by such typos will be limited anyway.

comment:2 by Matthew Burgess, 19 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.