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

Full log


View this message in rfc822 format

From: Thilo Schulz <thilo <at> tjps.eu>
To: Peter Rosin <peda <at> lysator.liu.se>
Cc: 16972 <at> debbugs.gnu.org
Subject: bug#16972: [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.