bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: ltmain.sh bug with use of save_arg


From: Ralf Wildenhues
Subject: FYI: ltmain.sh bug with use of save_arg
Date: Wed, 10 Nov 2004 11:13:29 +0100
User-agent: Mutt/1.4.1i

* James E Wilson wrote on Wed, Nov 10, 2004 at 04:14:23AM CET:
> This problem was reported to the gcc mailing list.
>     http://gcc.gnu.org/ml/gcc/2004-11/msg00179.html
> 
> The ltmain.sh script, under objectlist), does
>           if test -f "$arg"; then
>             save_arg=$arg
>           ...
>           else
>             func_fatal_error "link input file \`$save_arg' does not
> exist"
> which means the error message fails to print properly, because save_arg
> was never set on the path that leads to the error message.  It should
> use $arg instead of $save_arg.
> 
> I confirmed that this is still broken in libtool-1.9f.  I haven't tried
> looking at the libtool-2.x series.

Confirmed bug and proposed fix.

This problem is easliy reproduced by executing
$ ./libtool --mode=link gcc -objectlist nonexistant

> The ltmain.sh script in the 1.9f release says it was generated from the
> ltmain.in file, but I see no ltmain.in file, though there is a
> ltmain.m4sh file.

Thanks, changing Makefile.am as well.

Checked in the fixes together with a testcase on branch-2-0 and HEAD.

Regards,
Ralf


2004-11-10  James E Wilson <address@hidden>,
            Ralf Wildenhues <address@hidden>

        * config/ltmain.m4sh (func_mode_link), tests/Makefile.am,
        Fix error message with `-objectlist' file that does not exist.
        tests/objectlist.test:  New test for this.

        * Makefile.am: config/ltmain.sh is generated by config/ltmain.m4sh.

Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.130.2.2
diff -u -r1.130.2.2 Makefile.am
--- Makefile.am 29 Oct 2004 08:28:59 -0000      1.130.2.2
+++ Makefile.am 10 Nov 2004 10:02:15 -0000
@@ -121,7 +121,7 @@
        cd $(top_srcdir); \
        rm -f config/ltmain.in config/ltmain.tmp config/ltmain.sh; \
        $(M4SH) -B ./config config/ltmain.m4sh > config/ltmain.in; \
-       input="ltmain.in"; \
+       input="ltmain.m4sh"; \
        $(edit) -e "s,@TIMESTAMP\@,$$TIMESTAMP,g" \
                -e "s,@package_revision\@,$$1,g" \
                config/ltmain.in > config/ltmain.tmp; \
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.1.2.18
diff -u -r1.1.2.18 ltmain.m4sh
--- config/ltmain.m4sh  5 Nov 2004 17:57:14 -0000       1.1.2.18
+++ config/ltmain.m4sh  10 Nov 2004 09:48:37 -0000
@@ -2391,7 +2391,7 @@
              fi
            done
          else
-           func_fatal_error "link input file \`$save_arg' does not exist"
+           func_fatal_error "link input file \`$arg' does not exist"
          fi
          arg=$save_arg
          prev=
Index: tests/Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/Makefile.am,v
retrieving revision 1.41.2.4
diff -u -r1.41.2.4 Makefile.am
--- tests/Makefile.am   29 Oct 2004 08:28:59 -0000      1.41.2.4
+++ tests/Makefile.am   10 Nov 2004 09:48:37 -0000
@@ -31,7 +31,7 @@
        f77demo-shared.test f77demo-make.test f77demo-exec.test
 
 COMMON_TESTS = \
-       link.test link-2.test nomode.test \
+       link.test link-2.test nomode.test objectlist.test \
        quote.test sh.test suffix.test tagtrace.test \
        cdemo-static.test cdemo-make.test cdemo-exec.test \
        demo-static.test demo-make.test demo-exec.test \
--- /dev/null   2004-11-05 16:48:27.310584576 +0100
+++ tests/objectlist.test       2004-11-10 10:40:54.322584151 +0100
@@ -0,0 +1,37 @@
+#! /bin/sh
+# objectlist.test - make sure that a nonexisting objectlist file is
+# properly mentioned
+
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
+. ./defs || exit 1
+
+# Try a sample link command.
+linkresult=`$LIBTOOL -n --mode=link $CC -objectlist nonexistant 2>&1`
+test $? -eq 0 && exit $EXIT_FAILURE
+
+echo ".$linkresult."
+echo "$linkresult" | ${EGREP} "nonexistant" >/dev/null 2>&1 && {
+  func_msg "$progname: error message contains -objectlist argument as expected"
+  exit $EXIT_SUCCESS
+}
+
+exit $EXIT_FAILURE




reply via email to

[Prev in Thread] Current Thread [Next in Thread]