|
PR/307: depcomp/libtool race: msg#00033sysutils.automake.patches
Here is a (somewhat extreme) suggestion for PR/307. This get rid of all the backgroud processes in depcomp: they are hard to debug and can cause races with the other tools involved (e.g. libtool). 2002-04-19 Alexandre Duret-Lutz <duret_g@xxxxxxxx> For PR automake/307: * lib/depcomp: Never compute dependencies in the background, this can cause races with libtool. Compute the dependencies after the actual compilation. Don't make libtool silent now that it's run in the foreground. * tests/pr307.test: New file. * tests/Makefile.am (TESTS): Add pr307.test. Reported by Laurent Morichetti. Index: THANKS =================================================================== RCS file: /cvs/automake/automake/THANKS,v retrieving revision 1.166 diff -u -r1.166 THANKS --- THANKS 26 Mar 2002 06:04:18 -0000 1.166 +++ THANKS 19 Apr 2002 13:43:47 -0000 @@ -94,6 +94,7 @@ Larry Jones larry.jones@xxxxxxxx Lars Hecking lhecking@xxxxxxxxxxx Lars J. Aas larsa@xxxxxx +Laurent Morichetti laurentm@xxxxxxxxxx Maciej Stachowiak mstachow@xxxxxxx Maciej W. Rozycki macro@xxxxxxxxxxxxx Manu Rouat emmanuel.rouat@xxxxxxxxxx Index: lib/depcomp =================================================================== RCS file: /cvs/automake/automake/lib/depcomp,v retrieving revision 1.32 diff -u -r1.32 depcomp --- lib/depcomp 26 Mar 2002 06:04:19 -0000 1.32 +++ lib/depcomp 19 Apr 2002 13:43:47 -0000 @@ -209,7 +209,7 @@ tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. @@ -252,32 +252,9 @@ # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. + "$@" || exit $? test -z "$dashmflag" && dashmflag=-M - ( IFS=" " - case " $* " in - *" --mode=compile "*) # this is libtool, let us make it quiet - for arg - do # cycle over the arguments - case "$arg" in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi + "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' @@ -295,33 +272,28 @@ ;; makedepend) + "$@" || exit $? # X makedepend - ( - shift - cleared=no - for arg in "$@"; do - case $cleared in no) - set ""; shift - cleared=yes - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift;; - -*) - ;; - *) - set fnord "$@" "$arg"; shift;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' @@ -336,33 +308,10 @@ # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" -E | + "$@" || exit $? + "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" @@ -374,47 +323,25 @@ # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; - *) + *) set fnord "$@" "$arg" shift shift ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" Index: tests/Makefile.am =================================================================== RCS file: /cvs/automake/automake/tests/Makefile.am,v retrieving revision 1.385.2.3 diff -u -r1.385.2.3 Makefile.am --- tests/Makefile.am 19 Apr 2002 10:23:08 -0000 1.385.2.3 +++ tests/Makefile.am 19 Apr 2002 13:43:47 -0000 @@ -271,6 +271,7 @@ pr300-lib.test \ pr300-ltlib.test \ pr300-prog.test \ +pr307.test \ prefix.test \ primary.test \ primary2.test \ Index: tests/Makefile.in =================================================================== RCS file: /cvs/automake/automake/tests/Makefile.in,v retrieving revision 1.499.2.6 diff -u -r1.499.2.6 Makefile.in --- tests/Makefile.in 19 Apr 2002 10:23:08 -0000 1.499.2.6 +++ tests/Makefile.in 19 Apr 2002 13:43:47 -0000 @@ -347,6 +347,7 @@ pr300-lib.test \ pr300-ltlib.test \ pr300-prog.test \ +pr307.test \ prefix.test \ primary.test \ primary2.test \ Index: tests/pr307.test =================================================================== RCS file: tests/pr307.test diff -N tests/pr307.test --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/pr307.test 19 Apr 2002 13:43:47 -0000 @@ -0,0 +1,49 @@ +#! /bin/sh + +# Test for PR 307: depcomp with depmode=dashmstdout libtool race condition +# Report from Laurent Morichetti. +# (Also exercises check_LTLIBRARIES.) + +required='libtoolize gcc' +. $srcdir/defs || exit 1 + +cat >> configure.in << 'END' +AC_PROG_CC +AC_PROG_LIBTOOL +AC_OUTPUT +END + +cat > Makefile.am << 'END' +check_LTLIBRARIES = librace.la +librace_la_SOURCES = a.c b.c c.c d.c e.c f.c g.c h.c +END + +for i in a b c d e f g h; do + echo "int $i() { return 0; }" > $i.c +done + +set -e + +libtoolize --force +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +# Sanity check: make sure the variable we are attempting to force +# is used by configure +grep am_cv_CC_dependencies_compiler_type configure + +./configure am_cv_CC_dependencies_compiler_type=dashmstdout +$MAKE +test -f librace.la && exit 1 +$MAKE check + +# The failure we check usually occurs during the above build, +# with an output such as +# +# mv -f .libs/f.lo f.lo +# mv: cannot stat `.libs/f.lo': No such file or directory +# +# (This may happen on `f' or on some other files.) + +test -f librace.la -- Alexandre Duret-Lutz |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Required files are only added once, even if two are needed.: 00033, Alexandre Duret-Lutz |
|---|---|
| Next by Date: | Automake patch to work around Zsh bug: 00033, Paul Eggert |
| Previous by Thread: | Re: Required files are only added once, even if two are needed.i: 00033, Alexandre Duret-Lutz |
| Next by Thread: | Re: PR/307: depcomp/libtool race: 00033, Tom Tromey |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |