From: Ralf Wildenhues Date: Mon, 29 Nov 2004 21:18:26 +0000 (+0000) Subject: * config/ltmain.m4sh (func_lalib_p): Update function X-Git-Tag: release-2-1b~831 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81b4ad79e314e28ccacdbaf414334fc33ed7d5f9;p=thirdparty%2Flibtool.git * config/ltmain.m4sh (func_lalib_p): Update function description. (func_lalib_unsafe_p): New function with same functionality but written without forks; this function is safe to use for cases where the argument either does not exist or is required to be a lalib for correct operation. * NEWS: Mention the fact that stdin is not to be used. * (func_mode_execute, func_mode_install, func_mode_link): Use func_lalib_unsafe_p where appropriate. * (func_mode_execute): For the program wrapper, use func_ltwrapper_p instead of func_lalib_p. --- diff --git a/ChangeLog b/ChangeLog index 86ef4d6f3..fe34e3b4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2004-11-29 Ralf Wildenhues + * config/ltmain.m4sh (func_lalib_p): Update function + description. (func_lalib_unsafe_p): New function with same + functionality but written without forks; this function is safe + to use for cases where the argument either does not exist or + is required to be a lalib for correct operation. + * NEWS: Mention the fact that stdin is not to be used. + * (func_mode_execute, func_mode_install, func_mode_link): + Use func_lalib_unsafe_p where appropriate. + * (func_mode_execute): For the program wrapper, use + func_ltwrapper_p instead of func_lalib_p. + * m4/libtool.m4 (_LT_LINKER_SHLIBS): Treat linux-dietlibc with the `diet' compiler wrapper (as opposed to the `diet-dyn' wrapper) as a static-only platform. diff --git a/NEWS b/NEWS index 74eae87b8..07fb236bc 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ New in 2.1b: 2005-??-??; CVS version 2.1a, Libtool team: * Support for Portland Group compiler on Linux. * Fix libltdl on static platforms. * Support for linux-dietlibc (`diet' as well as `diet-dyn', separately). +* Shell optimizations which break use of the stdin file descriptor in libtool. New in 1.9h: 2004-??-??; CVS version 1.9g, Libtool team: * Libtool versions can now be parallel installed, except that only one diff --git a/config/ltmain.m4sh b/config/ltmain.m4sh index 396024081..b71e6c62e 100644 --- a/config/ltmain.m4sh +++ b/config/ltmain.m4sh @@ -574,7 +574,7 @@ _LT_EOF # func_lalib_p file -# True iff FILE is a libtool `.la' library. +# True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () @@ -583,6 +583,28 @@ func_lalib_p () | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -r "$1" && exec <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec <&- + fi + test "$lalib_p" = yes +} # func_ltwrapper_p file # True iff FILE is a libtool wrapper script. @@ -1431,15 +1453,15 @@ func_mode_execute () # Handle -dlopen flags immediately. for file in $execute_dlfiles; do - test -f "$file" || \ - func_fatal_help "\`$file' is not a file" + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) # Check to see that this really is a libtool archive. - func_lalib_p "$file" \ || - func_fatal_help "\`$lib' is not a valid libtool archive" + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= @@ -1505,7 +1527,7 @@ func_mode_execute () -*) ;; *) # Do a test to see if this is really a libtool program. - if func_lalib_p "$file"; then + if func_ltwrapper_p "$file"; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -1765,8 +1787,8 @@ func_mode_install () *.la) # Check to see that this really is a libtool archive. - func_lalib_p "$file" || \ - func_fatal_help "\`$file' is not a valid libtool archive" + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= @@ -2260,8 +2282,8 @@ func_mode_link () ;; expsyms) export_symbols="$arg" - test -f "$arg" || \ - func_fatal_error "symbol file \`$arg' does not exist" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; @@ -2299,7 +2321,7 @@ func_mode_link () # A libtool-controlled object. # Check to see that this really is a libtool object. - if func_lalib_p "$arg"; then + if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= @@ -2792,7 +2814,7 @@ func_mode_link () # A libtool-controlled object. # Check to see that this really is a libtool object. - if func_lalib_p "$arg"; then + if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= @@ -3305,8 +3327,8 @@ func_mode_link () fi # Check to see that this really is a libtool archive. - func_lalib_p "$lib" || \ - func_fatal_error "\`$lib' is not a valid libtool archive" + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" ladir=`$ECHO "X$lib" | $Xsed -e 's%/[[^/]]*$%%'` test "X$ladir" = "X$lib" && ladir="."