summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2019-10-22 20:24:10 +0000
committerJoseph Myers <joseph@codesourcery.com>2019-10-22 20:24:10 +0000
commit7db1fe38de21831d53ceab9ae83493d8d1aec601 (patch)
tree662ab6e5018759d273de43850036a5b3752158de /Makefile
parentd0007dc53cc83f22037bf6c7a297fa2e8066a335 (diff)
downloadglibc-7db1fe38de21831d53ceab9ae83493d8d1aec601.tar.gz
glibc-7db1fe38de21831d53ceab9ae83493d8d1aec601.tar.xz
glibc-7db1fe38de21831d53ceab9ae83493d8d1aec601.zip
Fix testroot.pristine creation copying dynamic linker.
This patch addresses an issue reported in
<https://sourceware.org/ml/libc-alpha/2019-07/msg00661.html> where the
creation of testroot.pristine, on encountering
LD_TRACE_LOADED_OBJECTS=1 of the form

        libc.so.6 => /scratch/jmyers/glibc/mbs/obj/glibc-8-0-mips64-linux-gnu-x86_64-linux-gnu/default/libc.so.6 (0x772dd000)
        /lib32/ld.so.1 => /scratch/jmyers/glibc/mbs/obj/glibc-8-0-mips64-linux-gnu-x86_64-linux-gnu/default/elf/ld.so.1 (0x7747b000)

tries to copy /lib32/ld.so.1 (which does not exist) into the testroot
instead of copying the path on the RHS of "=>", which does exist,
because the Makefile logic assumes that the path on such a line with
'/' should be copied, when if there are such paths on both the LHS and
the RHS of "=>", only the one on the RHS necessarily exists and so
only that should be copied.  The patch follows the approach suggested
by DJ in <https://sourceware.org/ml/libc-alpha/2019-07/msg00662.html>,
with the suggestion from Andreas in
<https://sourceware.org/ml/libc-alpha/2019-10/msg00514.html> of a
single sed command in place of pipeline of grep and three sed
commands.

Tested for x86_64, with and without --enable-hardcoded-path-in-tests;
a previous version with multiple sed commands, implementing the same
logic, also tested for MIPS, with and without
--enable-hardcoded-path-in-tests, to confirm it fixes the original
problem.

Co-authored-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile4
1 files changed, 2 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index d7e4be9e10..0711b9725d 100644
--- a/Makefile
+++ b/Makefile
@@ -564,7 +564,7 @@ ifeq ($(run-built-tests),yes)
 	for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1  \
 		$(rtld-prefix) \
 		$(objpfx)testroot.pristine/bin/sh \
-	        | grep / | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
+	        | sed -n '/\//{s@.*=> /@/@;s/^[^/]*//;s/ .*//p;}'` ;\
 	  do \
 	    test -d `dirname $(objpfx)testroot.pristine$$dso` || \
 	      mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
@@ -573,7 +573,7 @@ ifeq ($(run-built-tests),yes)
 	for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1  \
 		$(rtld-prefix) \
 		$(objpfx)support/$(LINKS_DSO_PROGRAM) \
-	        | grep / | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
+	        | sed -n '/\//{s@.*=> /@/@;s/^[^/]*//;s/ .*//p;}'` ;\
 	  do \
 	    test -d `dirname $(objpfx)testroot.pristine$$dso` || \
 	      mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\