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

Previous Next

Package: libtool;

Reported by: Thilo Schulz <thilo <at> tjps.eu>

Date: Sat, 8 Mar 2014 22:41:01 UTC

Severity: normal

To reply to this bug, email your comments to 16972 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-libtool <at> gnu.org:
bug#16972; Package libtool. (Sat, 08 Mar 2014 22:41:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thilo Schulz <thilo <at> tjps.eu>:
New bug report received and forwarded. Copy sent to bug-libtool <at> gnu.org. (Sat, 08 Mar 2014 22:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thilo Schulz <thilo <at> tjps.eu>
To: bug-libtool <at> gnu.org
Subject: Incorrect check for library target directory when relinking
Date: Sat, 8 Mar 2014 23:21:12 +0100
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




Information forwarded to bug-libtool <at> gnu.org:
bug#16972; Package libtool. (Tue, 11 Mar 2014 01:04:01 GMT) Full text and rfc822 format available.

Message #8 received at 16972 <at> debbugs.gnu.org (full text, mbox):

From: Thilo Schulz <thilo <at> tjps.eu>
To: 16972 <at> debbugs.gnu.org
Subject: [PATCH] Fix for this bug
Date: Tue, 11 Mar 2014 02:03:21 +0100
--- 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 <at> gnu.org:
bug#16972; Package libtool. (Tue, 11 Mar 2014 07:38:02 GMT) Full text and rfc822 format available.

Message #11 received at 16972 <at> debbugs.gnu.org (full text, mbox):

From: Peter Rosin <peda <at> lysator.liu.se>
To: Thilo Schulz <thilo <at> tjps.eu>, 16972 <at> debbugs.gnu.org
Subject: Re: bug#16972: [PATCH] Fix for this bug
Date: Tue, 11 Mar 2014 08:37:47 +0100
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 <at> gnu.org:
bug#16972; Package libtool. (Tue, 11 Mar 2014 14:42:03 GMT) Full text and rfc822 format available.

Message #14 received at 16972 <at> debbugs.gnu.org (full text, mbox):

From: Thilo Schulz <thilo <at> tjps.eu>
To: Peter Rosin <peda <at> lysator.liu.se>
Cc: 16972 <at> debbugs.gnu.org
Subject: [PATCH] Relink check in --install mode broken
Date: Tue, 11 Mar 2014 15:41:40 +0100
Hi,

> 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.

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

With the sed command:

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

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

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

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

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


-- 
Beste Grüße,
Thilo Schulz




This bug report was last modified 11 years and 100 days ago.

Previous Next


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