NetBSD Problem Report #53086

From www@NetBSD.org  Sat Mar 10 14:33:54 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A8B6F7A1CC
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 10 Mar 2018 14:33:54 +0000 (UTC)
Message-Id: <20180310143353.6FC887A225@mollari.NetBSD.org>
Date: Sat, 10 Mar 2018 14:33:53 +0000 (UTC)
From: hans@netbsd.org
Reply-To: hans@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: devel/libtool-base configure code to remove spaces between -R/-L/-l and paths is broken
X-Send-Pr-Version: www-1.0

>Number:         53086
>Category:       pkg
>Synopsis:       devel/libtool-base configure code to remove spaces between -R/-L/-l and paths is broken
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    joerg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 10 14:35:00 +0000 2018
>Closed-Date:    Sat Apr 28 09:24:08 +0000 2018
>Last-Modified:  Sat Apr 28 09:24:08 +0000 2018
>Originator:     Hans Rosenfeld
>Release:        2017Q4
>Organization:
>Environment:
SunOS pkgbuild 5.11 illumos-ff1e230c4f i86pc i386 i86pc
>Description:
The gcc on my system produces this output when linking with -v:

 /usr/gcc/6/lib/gcc/i386-pc-solaris2.11/6.4.0/collect2 -V -M /usr/gcc/6/lib/gcc/i386-pc-solaris2.11/6.4.0/../../../libgcc-unwind.map -Y P,/usr/gcc/6/lib:/lib:/usr/lib -R /usr/gcc/6/lib -L /usr/gcc/6/lib -Qy /usr/lib/crt1.o /usr/gcc/6/lib/gcc/i386-pc-solaris2.11/6.4.0/crtp.o /usr/lib/crti.o /usr/lib/values-Xa.o /usr/gcc/6/lib/gcc/i386-pc-solaris2.11/6.4.0/crtbegin.o -L/usr/gcc/6/lib/gcc/i386-pc-solaris2.11/6.4.0 -L/usr/gcc/6/lib/gcc/i386-pc-solaris2.11/6.4.0/../../.. conftest.o -lstdc++ -lm -lrt -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/gcc/6/lib/gcc/i386-pc-solaris2.11/6.4.0/crtend.o /usr/lib/crtn.o

The configure script for libtool wants to remove the spaces between -R/-L and usr/gcc/6/lib and fails miserably. Basically, it loops over all tokens in that string and checks whether they are -R, -L, or -l, but the comparison is wrong.
>How-To-Repeat:
Build devel/libtool-base on current OpenIndiana and search for compiler_lib_search_path in ${PREFIX}/bin/libtool.
>Fix:
patch-configure in devel/libtool needs this:

@@ -16130,8 +16238,9 @@ if { { eval echo "\"\$as_me\":${as_linen
     -L* | -R* | -l*)
        # Some compilers place space between "-{L,R}" and the path.
        # Remove the space.
-       if test x-L = "$p" ||
-          test x-R = "$p"; then
+       if test x-L = x"$p" ||
+          test x-l = x"$p" ||
+          test x-R = x"$p"; then
         prev=$p
         continue
        fi

>Release-Note:

>Audit-Trail:
From: Hans Rosenfeld <hans@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53086: devel/libtool-base configure code to remove spaces
 between -R/-L/-l and paths is broken
Date: Mon, 12 Mar 2018 11:41:02 +0100

 I think this is the proper fix for this issue:

 http://netbsd.org/~hans/libtool.diff

 Index: distinfo
 ===================================================================
 RCS file: /cvsroot/pkgsrc/devel/libtool/distinfo,v
 retrieving revision 1.103
 diff -u -u -p -r1.103 distinfo
 --- distinfo	6 Mar 2017 16:14:07 -0000	1.103
 +++ distinfo	12 Mar 2018 10:37:29 -0000
 @@ -7,5 +7,5 @@ Size (libtool-2.4.6.tar.gz) = 1806697 by
  SHA1 (patch-Makefile.in) = 0adb634335acd5fb280c99b5d43ae568018ca0af
  SHA1 (patch-build-aux_depcomp) = ae6f93ad4fac1df648cfcb62601c72f9ebb30233
  SHA1 (patch-build-aux_ltmain.sh) = eebdc102cacb1970240abeb4a7310d09d505be02
 -SHA1 (patch-configure) = 818157dd9bf985657a0089a7d887304b71559837
 +SHA1 (patch-configure) = 2cbf275a4de712bc151c5065b62b2bdb37c83188
  SHA1 (patch-libltdl_configure) = 87535836200547ceb8463a98e86561c2adf1f0ed
 Index: patches/manual-libtool.m4
 ===================================================================
 RCS file: /cvsroot/pkgsrc/devel/libtool/patches/manual-libtool.m4,v
 retrieving revision 1.46
 diff -u -u -p -r1.46 manual-libtool.m4
 --- patches/manual-libtool.m4	6 Mar 2017 16:14:07 -0000	1.46
 +++ patches/manual-libtool.m4	12 Mar 2018 10:37:29 -0000
 @@ -98,7 +98,7 @@ Fixup output on various OS.
     esac
     need_lib_prefix=no
     need_version=no
 -@@ -2887,19 +2899,36 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu 
 +@@ -2887,19 +2899,36 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu
     dynamic_linker='GNU/Linux ld.so'
     ;;

 @@ -163,7 +163,7 @@ Fixup output on various OS.
     finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     shlibpath_var=LD_LIBRARY_PATH
     shlibpath_overrides_runpath=yes
 -@@ -3546,12 +3575,19 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu 
 +@@ -3546,12 +3575,19 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu
     lt_cv_deplibs_check_method=pass_all
     ;;

 @@ -384,7 +384,7 @@ Fixup output on various OS.
     AC_PROG_CXXCPP
   else
     _lt_caught_CXX_error=yes
 -@@ -7079,6 +7179,22 @@ if test yes != "$_lt_caught_CXX_error"; 
 +@@ -7079,6 +7179,22 @@ if test yes != "$_lt_caught_CXX_error";
           _LT_TAGVAR(ld_shlibs, $1)=no
   	;;

 @@ -407,7 +407,7 @@ Fixup output on various OS.
         mvs*)
           case $cc_basename in
             cxx*)
 -@@ -7093,15 +7209,13 @@ if test yes != "$_lt_caught_CXX_error"; 
 +@@ -7093,15 +7209,13 @@ if test yes != "$_lt_caught_CXX_error";
   	;;

         netbsd*)
 @@ -430,7 +430,7 @@ Fixup output on various OS.
   	;;

         *nto* | *qnx*)
 -@@ -7275,7 +7389,7 @@ if test yes != "$_lt_caught_CXX_error"; 
 +@@ -7275,7 +7389,7 @@ if test yes != "$_lt_caught_CXX_error";
   	    # GNU C++ compiler with Solaris linker
   	    if test yes,no = "$GXX,$with_gnu_ld"; then
   	      _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs'
 @@ -439,11 +439,15 @@ Fixup output on various OS.
   	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
   	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
                     $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 -@@ -7535,6 +7649,7 @@ if AC_TRY_EVAL(ac_compile); then
 +@@ -7534,8 +7648,9 @@ if AC_TRY_EVAL(ac_compile); then
 +     -L* | -R* | -l*)
          # Some compilers place space between "-{L,R}" and the path.
          # Remove the space.
 -        if test x-L = "$p" ||
 -+          test x-l = "$p" ||
 -           test x-R = "$p"; then
 +-       if test x-L = "$p" ||
 +-          test x-R = "$p"; then
 ++       if test x-L = x"$p" ||
 ++          test x-l = x"$p" ||
 ++          test x-R = x"$p"; then
   	 prev=$p
   	 continue
 +        fi
 Index: patches/patch-configure
 ===================================================================
 RCS file: /cvsroot/pkgsrc/devel/libtool/patches/patch-configure,v
 retrieving revision 1.1
 diff -u -u -p -r1.1 patch-configure
 --- patches/patch-configure	6 Mar 2017 16:14:07 -0000	1.1
 +++ patches/patch-configure	12 Mar 2018 10:37:29 -0000
 @@ -3,7 +3,7 @@ $NetBSD: patch-configure,v 1.1 2017/03/0
  Automatically generated using manual-* patches and bootstrap.
  DO NOT MODIFY THIS PATCH MANUALLY!  YOUR CHANGES WILL BE LOST!

 ---- configure.orig	2017-02-02 10:07:28.000000000 +0000
 +--- configure.orig	2018-03-12 10:30:57.156767466 +0000
  +++ configure
  @@ -5903,7 +5903,7 @@ else
       lt_cv_sys_max_cmd_len=8192;
 @@ -24,7 +24,7 @@ DO NOT MODIFY THIS PATCH MANUALLY!  YOUR
   : ${CP="cp -f"}
   : ${MV="mv -f"}
   : ${RM="rm -f"}
 -@@ -6369,12 +6372,19 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu 
 +@@ -6369,12 +6372,19 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu
     lt_cv_deplibs_check_method=pass_all
     ;;

 @@ -428,14 +428,18 @@ DO NOT MODIFY THIS PATCH MANUALLY!  YOUR
   	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
   	        archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
                     $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 -@@ -16131,6 +16239,7 @@ if { { eval echo "\"\$as_me\":${as_linen
 +@@ -16130,8 +16238,9 @@ if { { eval echo "\"\$as_me\":${as_linen
 +     -L* | -R* | -l*)
          # Some compilers place space between "-{L,R}" and the path.
          # Remove the space.
 -        if test x-L = "$p" ||
 -+          test x-l = "$p" ||
 -           test x-R = "$p"; then
 +-       if test x-L = "$p" ||
 +-          test x-R = "$p"; then
 ++       if test x-L = x"$p" ||
 ++          test x-l = x"$p" ||
 ++          test x-R = x"$p"; then
   	 prev=$p
   	 continue
 +        fi
  @@ -16311,9 +16420,15 @@ lt_prog_compiler_static_CXX=
         esac
         ;;
 @@ -834,14 +838,18 @@ DO NOT MODIFY THIS PATCH MANUALLY!  YOUR
     finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     shlibpath_var=LD_LIBRARY_PATH
     shlibpath_overrides_runpath=yes
 -@@ -21450,6 +21674,7 @@ if { { eval echo "\"\$as_me\":${as_linen
 +@@ -21449,8 +21673,9 @@ if { { eval echo "\"\$as_me\":${as_linen
 +     -L* | -R* | -l*)
          # Some compilers place space between "-{L,R}" and the path.
          # Remove the space.
 -        if test x-L = "$p" ||
 -+          test x-l = "$p" ||
 -           test x-R = "$p"; then
 +-       if test x-L = "$p" ||
 +-          test x-R = "$p"; then
 ++       if test x-L = x"$p" ||
 ++          test x-l = x"$p" ||
 ++          test x-R = x"$p"; then
   	 prev=$p
   	 continue
 +        fi
  @@ -21604,9 +21829,16 @@ lt_prog_compiler_static_FC=
         ;;


Responsible-Changed-From-To: pkg-manager->solaris-pkg-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Mon, 12 Mar 2018 10:46:52 +0000
Responsible-Changed-Why:
Solaris pkgsrc issue


Responsible-Changed-From-To: solaris-pkg-people->joerg
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Mon, 12 Mar 2018 10:53:31 +0000
Responsible-Changed-Why:
Not solaris specific, says Hans.


From: "Hans Rosenfeld" <hans@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53086 CVS commit: pkgsrc/devel
Date: Mon, 12 Mar 2018 16:36:44 +0000

 Module Name:	pkgsrc
 Committed By:	hans
 Date:		Mon Mar 12 16:36:44 UTC 2018

 Modified Files:
 	pkgsrc/devel/libtool: distinfo
 	pkgsrc/devel/libtool-base: Makefile
 	pkgsrc/devel/libtool-fortran: Makefile
 	pkgsrc/devel/libtool/patches: manual-libtool.m4 patch-configure

 Log Message:
 PR pkg/53086

 Fix the configure code that removes spaces in "-L /some/path" etc.


 To generate a diff of this commit:
 cvs rdiff -u -r1.103 -r1.104 pkgsrc/devel/libtool/distinfo
 cvs rdiff -u -r1.118 -r1.119 pkgsrc/devel/libtool-base/Makefile
 cvs rdiff -u -r1.15 -r1.16 pkgsrc/devel/libtool-fortran/Makefile
 cvs rdiff -u -r1.46 -r1.47 pkgsrc/devel/libtool/patches/manual-libtool.m4
 cvs rdiff -u -r1.1 -r1.2 pkgsrc/devel/libtool/patches/patch-configure

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 28 Apr 2018 09:24:08 +0000
State-Changed-Why:
committed by submitter


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.