From patchwork Thu Oct 17 20:50:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 35101 Received: (qmail 35592 invoked by alias); 17 Oct 2019 20:50:11 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 35580 invoked by uid 89); 17 Oct 2019 20:50:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: esa3.mentor.iphmx.com IronPort-SDR: V5gwcmp340ovo2A2KYDRy60iByPvGgcud2r9cXt2X69ZRB9Oio/gt7kaAQO3KH5NvDp+BQL0pG NPqguJ8AvNAIck39+4AO6BQNXgYFb8UGzET7/C3Tel7S+F+4+644nLpin07G8EJClu/5MW1hbF XLJ0yDcW6YdNKxe4u97Ylrld4abLizygqOTCRX/33WphhHGQhoyOeGtThWmCyyU+wK10uAZuMB C64lFFIPNkKyjds/g4qPvbMNc6MocuRgwweBy6OzRx/n85l0ZMqlY7Q1OcKIknlBeQJdaJDZgO zoU= IronPort-SDR: 2ahSM9Eeq7mONKLY3ahhRslkcy0JbyE6GqeKHu13ObYBoCXZJp8oGI1flyEpUqQv3L0RGTZ/Cy srTUUvb6omCwJC1fPr1FZ9BB0PYSRbOVQCDdLbUukUx0jpD0NvqbDUMqFfOBlc3WeukU4/bFRN HT1++ZPxZqHvwPWY+5WyTWVOdD4dk/QBF4nzy7ups4POoocG2zmuHjnWZEExOoEyknrTod5Upe JoAJqpxBgvkzCcyyWxHfb/l/dGEyFFSfXEYyZ92CNSi0+kmXzrLO/f8bNKddBKYA3ERiGh8EsG Gic= Date: Thu, 17 Oct 2019 20:50:01 +0000 From: Joseph Myers To: Andreas Schwab CC: , Subject: Re: Fix testroot.pristine creation copying dynamic linker In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Return-Path: joseph@codesourcery.com On Thu, 17 Oct 2019, Andreas Schwab wrote: > On Okt 16 2019, Joseph Myers 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 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 , with the suggestion from Andreas in 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 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` ;\