Bug 14476 - test-installation.pl fails on x86_64
Summary: test-installation.pl fails on x86_64
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: build (show other bugs)
Version: 2.16
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-16 05:02 UTC by Bruce Dubbs
Modified: 2014-06-17 18:37 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
A patch (504 bytes, patch)
2012-08-28 17:58 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bruce Dubbs 2012-08-16 05:02:49 UTC
When building glibc-2.16, 'make install' runs test-installation.pl.  This fails.

I traced it down to an error in soversions.mk.  A literal extract:

...
ld.so-version=$(if $(abi-64-ld-soname),$(abi-64-ld-soname),ld.so.1)
all-sonames+=ld=$(ld.so-version)
...

The value for ld.so-version crashes test-installation.pl.  It should be ld-linux-x86-64.so.2.  abi-64-ld-soname is defined correctly in sysdeps/unix/sysv/linux/x86/Makefile, but it is not getting into soversions.mk.

This problem seems to have been introduced into Makeconfig on 26 May 2012 in commit 0ab0291b84b45f2389a019af2c88bf5169d14f64

@@ -816,24 +834,17 @@ $(common-objpfx)soversions.i: $(..)scripts/soversions.awk \
               -f $^ > $@T
        mv -f $@T $@
 $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig
-       (seen_DEFAULT=0; seen_WORDSIZE32=0; seen_WORDSIZE64=0; \
-        while read which lib number setname; do \
+       (while read which lib number setname; do \
           eval seen_$$which=1; \
           test x"$$which" != xABI || echo abi-name = "$$lib"; \
           test x"$$which" = xDEFAULT || continue; \
           case $$number in \
             [0-9]*) echo "$$lib.so-version=.$$number"; \
                     echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\
-            *)      echo "$$lib.so-version=$$number"; \
+            *)      echo "$$lib.so-version=\$$(if \$$(abi-$(default-abi)-$$lib-soname),\$$(abi-$(default-abi)-$$lib-soname),$$number)"; \
                     echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\
           esac; \
         done; \

We can work around this by simply deleting the test-installation.pl line from the Makefile, but that doesn't seem to be a real fix.

  -- Bruce Dubbs
     linuxfromscratch.org
Comment 1 Andreas Jaeger 2012-08-28 12:52:53 UTC
HJ, this seems to have introduced by one of your commits. Could you have a look at it, please?
Comment 2 H.J. Lu 2012-08-28 16:22:51 UTC
scripts/test-installation.pl reads soversions.mk.  But it
doesn't understand

ld.so-version=$(if $(abi-64-ld-soname),$(abi-64-ld-soname),ld.so.1)

We do

diff --git a/Makefile b/Makefile
index b0d3edb..8eccec7 100644
--- a/Makefile
+++ b/Makefile
@@ -111,7 +111,7 @@ install:
 ifneq (no,$(PERL))
 ifeq (/usr,$(prefix))
 ifeq (,$(install_root))
-	CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
+	LD_SO_VERSION=$(ld.so-version) CC="$(CC)" $(PERL) scripts/test-installat
ion.pl $(common-objpfx)
 endif
 endif
 endif

and update scripts/test-installation.pl to use it.  Is there a way to test
scripts/test-installation.pl with install_root set?
Comment 3 Bruce Dubbs 2012-08-28 17:05:03 UTC
That doesn't affect the perl script.  Starting at line 97:

while (<SOVERSIONS>) {
  next if (/^all-sonames/);
  chop;
  if (/^lib/) {
    ($name, $version)= /^lib(.*)\.so-version=\.(.*)$/;
    # Filter out some libraries we don't want to link:
    # - nss_ldap since it's not yet available
    # - libdb1 since it conflicts with libdb
    # - libnss1_* from glibc-compat add-on
    # - libthread_db since it contains unresolved references
    # - it's just a test NSS module
    # - We don't provide the libgcc so we don't test it
    if ($name ne "nss_ldap" && $name ne "db1"
        && !($name =~/^nss1_/) && $name ne "thread_db"
        && $name ne "nss_test1" && $name ne "libgcc_s") {
      $link_libs .= " -l$name";
      $versions{$name} = $version;
    }
  } else {
    if (/^ld\.so/) {
      ($ld_so_name, $ld_so_version)= /=(.*)\.so\.(.*)$/;
    }
  }
}

The problem is in the else clause.  It does not evaluate the expression to the right of the = sign.  Also, the value in the expression extracted from soversions.mk, $(abi-64-ld-soname), is not defined in the script.

LD_SO_VERSION is never used in the script.

A hack would be:

if ( /ld\.so-version/ ) {
  ld.so-version = $LD_SO_VERSION;
}
Comment 4 H.J. Lu 2012-08-28 17:58:50 UTC
Created attachment 6616 [details]
A patch

This patch passes $(ld.so-version) to scripts/test-installation.pl.
Comment 5 Bruce Dubbs 2012-08-28 19:25:21 UTC
That patch works fine.  I now get (slightly formatted):

LD_SO=ld-linux-x86-64.so.2 CC="gcc" /usr/bin/perl scripts/test-installation.pl \
/sources/glibc-build/
Your new glibc installation seems to be ok.
make[1]: Leaving directory `/sources/glibc-2.16.0'
Comment 6 H.J. Lu 2012-08-30 13:47:56 UTC
Fixed on master and 2.16 branch.