GNU bug report logs - #16972
Incorrect check for library target directory when relinking

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: libtool; Reported by: Thilo Schulz <thilo@HIDDEN>; dated Sat, 8 Mar 2014 22:41:01 UTC; Maintainer for libtool is bug-libtool@HIDDEN.

Message received at 16972 <at> debbugs.gnu.org:


Received: (at 16972) by debbugs.gnu.org; 11 Mar 2014 14:41:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 11 10:41:46 2014
Received: from localhost ([127.0.0.1]:33456 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WNNsI-00029l-3T
	for submit <at> debbugs.gnu.org; Tue, 11 Mar 2014 10:41:46 -0400
Received: from tjps.eu ([176.9.53.212]:56935)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <thilo@HIDDEN>) id 1WNNsE-00029b-Hk
 for 16972 <at> debbugs.gnu.org; Tue, 11 Mar 2014 10:41:43 -0400
Received: from helmuth.localnet (p4FF15F90.dip0.t-ipconnect.de [79.241.95.144])
 by tjps.eu (Postfix) with ESMTPSA id 326CA5701247;
 Tue, 11 Mar 2014 14:41:41 +0000 (UTC)
From: Thilo Schulz <thilo@HIDDEN>
To: Peter Rosin <peda@HIDDEN>
Subject: [PATCH] Relink check in --install mode broken
Date: Tue, 11 Mar 2014 15:41:40 +0100
User-Agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; )
References: <201403082321.12793.thilo@HIDDEN>
 <201403110203.21766.thilo@HIDDEN> <531EBD4B.1000303@HIDDEN>
In-Reply-To: <531EBD4B.1000303@HIDDEN>
MIME-Version: 1.0
Message-Id: <201403111541.40577.thilo@HIDDEN>
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 16972
Cc: 16972 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hi,

> Hi Thilo,
>=20
> I seriously doubt that this change is correct. The code has been the way
> it is since it was added 10+ years ago (commit d2c4f8f8fc). Well, the test
> was written as
>=20
> 	if test "$inst_prefix_dir" =3D "$destdir"; then
> 	  $echo ...
> 	  exit
> 	fi
>=20
> way back when, but that's equivalent to the current code.

You're right. I had a more thorough look at the script as opposed to the=20
cursory glance before, and I now understand what's actually happening.

With the sed command:

          inst_prefix_dir=3D`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`

it searches for the trailing path, and replaces it with nothing. If that=20
trailing path is identical, inst_prefix_dir will be unequal to the original=
=20
destdir, so equality actually _is_ the error condition.

It didn't work in my case though, because in --link mode, the -rpath argume=
nt=20
had a trailing / and libtool removes the trailing slash from the installati=
on=20
directory argument in --install mode.

So here is a second patch that only fixes this failure of the check. Maybe =
you=20
want to strip libdir of trailing slashes in --link mode already, but that's=
=20
the libtool maintainer's choice.

=2D-- libtool.orig        2014-03-11 15:27:51.541596775 +0100
+++ libtool     2014-03-11 15:27:30.417597689 +0100
@@ -3393,8 +3393,11 @@
        dir+=3D"$objdir"
=20
        if test -n "$relink_command"; then
+         # $destdir has trailing slashes stripped, so must strip slashes f=
rom=20
$libdir as well
+         func_stripname '' '/' "$libdir"
+
          # Determine the prefix the user has applied to our future dir.
=2D         inst_prefix_dir=3D`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+         inst_prefix_dir=3D`$ECHO "$destdir" | $SED -e=20
"s%$func_stripname_result\$%%"`
=20
          # Don't allow the user to place us outside of our expected
          # location b/c this prevents finding dependent libraries that


=2D-=20
Beste Gr=FC=DFe,
Thilo Schulz




Information forwarded to bug-libtool@HIDDEN:
bug#16972; Package libtool. Full text available.

Message received at 16972 <at> debbugs.gnu.org:


Received: (at 16972) by debbugs.gnu.org; 11 Mar 2014 07:37:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 11 03:37:55 2014
Received: from localhost ([127.0.0.1]:60822 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WNHG6-0005Hy-CO
	for submit <at> debbugs.gnu.org; Tue, 11 Mar 2014 03:37:54 -0400
Received: from mail.lysator.liu.se ([130.236.254.3]:56873)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <peda@HIDDEN>) id 1WNHG2-0005Hf-Es
 for 16972 <at> debbugs.gnu.org; Tue, 11 Mar 2014 03:37:51 -0400
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
 by mail.lysator.liu.se (Postfix) with ESMTP id D15DC40023;
 Tue, 11 Mar 2014 08:37:48 +0100 (CET)
Received: from [192.168.0.68] (90-227-119-221-no95.business.telia.com
 [90.227.119.221])
 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
 (No client certificate requested)
 by mail.lysator.liu.se (Postfix) with ESMTPSA id 93FD24000A;
 Tue, 11 Mar 2014 08:37:48 +0100 (CET)
Message-ID: <531EBD4B.1000303@HIDDEN>
Date: Tue, 11 Mar 2014 08:37:47 +0100
From: Peter Rosin <peda@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
 rv:24.0) Gecko/20100101 Thunderbird/24.3.0
MIME-Version: 1.0
To: Thilo Schulz <thilo@HIDDEN>, 16972 <at> debbugs.gnu.org
Subject: Re: bug#16972: [PATCH] Fix for this bug
References: <201403082321.12793.thilo@HIDDEN>
 <201403110203.21766.thilo@HIDDEN>
In-Reply-To: <201403110203.21766.thilo@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 16972
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

On 2014-03-11 02:03, Thilo Schulz wrote:
> --- libtool.orig        2014-03-11 00:59:52.821999549 +0000
> +++ libtool     2014-03-11 01:00:21.197220463 +0000
> @@ -3402,7 +3402,7 @@
>           # At present, this check doesn't affect windows .dll's that
>           # are installed into $libdir/../bin (currently, that works fine)
>           # but it's something to keep an eye on.
> -         test "$inst_prefix_dir" = "$destdir" && \
> +         test "$inst_prefix_dir" = "$destdir" || \
>             func_fatal_error "error: cannot install \`$file' to a directory not 
> ending in $libdir"
>  
>           if test -n "$inst_prefix_dir"; then
> 

Hi Thilo,

I seriously doubt that this change is correct. The code has been the way
it is since it was added 10+ years ago (commit d2c4f8f8fc). Well, the test
was written as

	if test "$inst_prefix_dir" = "$destdir"; then
	  $echo ...
	  exit
	fi

way back when, but that's equivalent to the current code.

Cheers,
Peter





Information forwarded to bug-libtool@HIDDEN:
bug#16972; Package libtool. Full text available.

Message received at 16972 <at> debbugs.gnu.org:


Received: (at 16972) by debbugs.gnu.org; 11 Mar 2014 01:03:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 10 21:03:28 2014
Received: from localhost ([127.0.0.1]:60696 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WNB6N-00028i-RR
	for submit <at> debbugs.gnu.org; Mon, 10 Mar 2014 21:03:28 -0400
Received: from tjps.eu ([176.9.53.212]:49614)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <thilo@HIDDEN>) id 1WNB6K-00028U-Kf
 for 16972 <at> debbugs.gnu.org; Mon, 10 Mar 2014 21:03:25 -0400
Received: from helmuth.localnet (stgt-5f738bf1.pool.mediaWays.net
 [95.115.139.241]) by tjps.eu (Postfix) with ESMTPSA id 7C3D15707746
 for <16972 <at> debbugs.gnu.org>; Tue, 11 Mar 2014 01:03:22 +0000 (UTC)
From: Thilo Schulz <thilo@HIDDEN>
To: 16972 <at> debbugs.gnu.org
Subject: [PATCH] Fix for this bug
Date: Tue, 11 Mar 2014 02:03:21 +0100
User-Agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; )
MIME-Version: 1.0
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-Id: <201403110203.21766.thilo@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 16972
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--- libtool.orig        2014-03-11 00:59:52.821999549 +0000
+++ libtool     2014-03-11 01:00:21.197220463 +0000
@@ -3402,7 +3402,7 @@
          # At present, this check doesn't affect windows .dll's that
          # are installed into $libdir/../bin (currently, that works fine)
          # but it's something to keep an eye on.
-         test "$inst_prefix_dir" = "$destdir" && \
+         test "$inst_prefix_dir" = "$destdir" || \
            func_fatal_error "error: cannot install \`$file' to a directory not 
ending in $libdir"
 
          if test -n "$inst_prefix_dir"; then

-- 
Best regards,
Thilo Schulz




Information forwarded to bug-libtool@HIDDEN:
bug#16972; Package libtool. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 8 Mar 2014 22:40:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 08 17:40:32 2014
Received: from localhost ([127.0.0.1]:57076 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WMPuw-0004mu-U4
	for submit <at> debbugs.gnu.org; Sat, 08 Mar 2014 17:40:32 -0500
Received: from eggs.gnu.org ([208.118.235.92]:59019)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <thilo@HIDDEN>) id 1WMPck-0004Dr-VE
 for submit <at> debbugs.gnu.org; Sat, 08 Mar 2014 17:21:43 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <thilo@HIDDEN>) id 1WMPcd-0008HD-PE
 for submit <at> debbugs.gnu.org; Sat, 08 Mar 2014 17:21:42 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:50635)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <thilo@HIDDEN>) id 1WMPcd-0008GI-55
 for submit <at> debbugs.gnu.org; Sat, 08 Mar 2014 17:21:35 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60724)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <thilo@HIDDEN>) id 1WMPcW-0004BT-Vb
 for bug-libtool@HIDDEN; Sat, 08 Mar 2014 17:21:35 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <thilo@HIDDEN>) id 1WMPcQ-0008Ed-RC
 for bug-libtool@HIDDEN; Sat, 08 Mar 2014 17:21:28 -0500
Received: from tjps.eu ([176.9.53.212]:34112)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <thilo@HIDDEN>) id 1WMPcQ-0008EN-Km
 for bug-libtool@HIDDEN; Sat, 08 Mar 2014 17:21:22 -0500
Received: from helmuth.localnet (p54829C38.dip0.t-ipconnect.de [84.130.156.56])
 by tjps.eu (Postfix) with ESMTPSA id 4AA9F57078D7
 for <bug-libtool@HIDDEN>; Sat,  8 Mar 2014 22:21:18 +0000 (UTC)
From: Thilo Schulz <thilo@HIDDEN>
To: bug-libtool@HIDDEN
Subject: Incorrect check for library target directory when relinking
Date: Sat, 8 Mar 2014 23:21:12 +0100
User-Agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; )
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-Id: <201403082321.12793.thilo@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sat, 08 Mar 2014 17:40:26 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Hi,

I'm really baffled by this message:

> /home/thilo/code/libtool-2.4.2/libtool --mode=install install net.la 
/home/thilo/code/usr/lib/sercom/sercomctl/
> libtool: install: error: cannot install `net.la' to a directory not ending 
in /home/thilo/code/usr/lib/sercom/sercomctl/

I'm installing to exactly that directory and it's complaining! Looks like this 
check is wrong, starting from line 3399 in libtool:

# Don't allow the user to place us outside of our expected
# location b/c this prevents finding dependent libraries that
# are installed to the same prefix.
# At present, this check doesn't affect windows .dll's that
# are installed into $libdir/../bin (currently, that works fine)
# but it's something to keep an eye on.
test "$inst_prefix_dir" = "$destdir" && \
func_fatal_error "error: cannot install \`$file' to a directory not ending in 
$libdir"

so basically, if $inst_prefix_dir and $destdir are equal, it throws an error? 
Are you sure it shouldn't be || instead of &&?

-- 
Beste regards,
Thilo Schulz




Acknowledgement sent to Thilo Schulz <thilo@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-libtool@HIDDEN. Full text available.
Report forwarded to bug-libtool@HIDDEN:
bug#16972; Package libtool. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.