public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Fix testroot.pristine creation copying dynamic linker
@ 2019-10-16 21:51 Joseph Myers
  2019-10-17  8:48 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph Myers @ 2019-10-16 21:51 UTC (permalink / raw)
  To: libc-alpha; +Cc: dj

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

Tested for x86_64, with and without --enable-hardcoded-path-in-tests;
also previously 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>

diff --git a/Makefile b/Makefile
index a736c3afcc..b16b82d3e1 100644
--- a/Makefile
+++ b/Makefile
@@ -555,7 +555,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/ .*//'` ;\
+	        | grep / | sed 's@.*=> /@/@' | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
 	  do \
 	    test -d `dirname $(objpfx)testroot.pristine$$dso` || \
 	      mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
@@ -564,7 +564,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/ .*//'` ;\
+	        | grep / | sed 's@.*=> /@/@' | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
 	  do \
 	    test -d `dirname $(objpfx)testroot.pristine$$dso` || \
 	      mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix testroot.pristine creation copying dynamic linker
  2019-10-16 21:51 Fix testroot.pristine creation copying dynamic linker Joseph Myers
@ 2019-10-17  8:48 ` Andreas Schwab
  2019-10-17 20:50   ` Joseph Myers
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2019-10-17  8:48 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha, dj

On Okt 16 2019, Joseph Myers <joseph@codesourcery.com> wrote:

> diff --git a/Makefile b/Makefile
> index a736c3afcc..b16b82d3e1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -555,7 +555,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/ .*//'` ;\
> +	        | grep / | sed 's@.*=> /@/@' | sed 's/^[^/]*//' | sed 's/ .*//'` ;\

You can combine those four pipelines into a single sed call.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix testroot.pristine creation copying dynamic linker
  2019-10-17  8:48 ` Andreas Schwab
@ 2019-10-17 20:50   ` Joseph Myers
  2019-10-22 12:25     ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph Myers @ 2019-10-17 20:50 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha, dj

On Thu, 17 Oct 2019, Andreas Schwab wrote:

> On Okt 16 2019, Joseph Myers <joseph@codesourcery.com> wrote:
> 
> > diff --git a/Makefile b/Makefile
> > index a736c3afcc..b16b82d3e1 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -555,7 +555,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/ .*//'` ;\
> > +	        | grep / | sed 's@.*=> /@/@' | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
> 
> You can combine those four pipelines into a single sed call.

Here is a version that does that.


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>

diff --git a/Makefile b/Makefile
index a736c3afcc..ca52f790bb 100644
--- a/Makefile
+++ b/Makefile
@@ -555,7 +555,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` ;\
@@ -564,7 +564,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` ;\

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix testroot.pristine creation copying dynamic linker
  2019-10-17 20:50   ` Joseph Myers
@ 2019-10-22 12:25     ` Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2019-10-22 12:25 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha, dj

On Okt 17 2019, Joseph Myers wrote:

> diff --git a/Makefile b/Makefile
> index a736c3afcc..ca52f790bb 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -555,7 +555,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}'` ;\

There should be a semicolon before the close brace.

Ok with that change.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-22 12:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 21:51 Fix testroot.pristine creation copying dynamic linker Joseph Myers
2019-10-17  8:48 ` Andreas Schwab
2019-10-17 20:50   ` Joseph Myers
2019-10-22 12:25     ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).