From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by sourceware.org (Postfix) with ESMTPS id 39AF83858432 for ; Fri, 9 Feb 2024 15:00:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 39AF83858432 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 39AF83858432 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b2f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707490854; cv=none; b=VnsYcmxKFRhzntJ7ibwbYX7/nQ3XVwj8ozofJNyOR1aH1llMYNJ7EB2fYRWDPdAwfKTYHLiCiOGJUwpvdzvCjJxYJvS5kzXm12vSIrjdLNrrg+cUKtfjNOeD1318z4isLzoevuy+0q2McJtsix7/fOIVsN1oP9t3iShdX7lcV/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707490854; c=relaxed/simple; bh=gH8jlKO7oLcDn5+1ht48eikSzBFlryoUrNixMI08pUY=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=tY6XCbj7+qRsQb7LSN2r78z5O4I8MhfJRJ+9Qioyh/g5i6VXJ/T5YqW4BuauQyerOWbDpAcTsblYUsOTOHBXyCoXRgmZza6xef5Zrybm8IXIC6L3B7JBVc9FTeBRnybGBhbMNRsxagT9U2GslwFkbqcruy2a5XthyG3MwyMxrZA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-d9b9adaf291so868363276.1 for ; Fri, 09 Feb 2024 07:00:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707490852; x=1708095652; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DX3ssuVXJl3+ksLxZIsRB1uXSORqnMNx/NgeFtXYxAs=; b=TmLe1o+pxFeJkxFG48IR3pVd3mnybOxR+K0B6gyRhLo6Re8frFVU6lV5VJTVRAS+q+ uk/FnuS9XDLBNa1GKf1x166izxk0L43GITKpLGUodE2pDs3F2vDf113xJO/3i00c9LMa k8Fm2EbQFCLjBpCgdx3yUp32uNAJeTlkFECKPySpfln38r4DV0mvShkuaATHpnkkHbFj Qveo5Zu7FQr5e/dOkZw6/W9nuVqNbiG/QH/FamRhwR3Z63I8VnnJgfy9ngQMQcldt4RC H8pQOQ6IrflB7QhQeZj0M8scWiYtf7oD4qxuilpX8P4Dvo+Khxw1FP0oyKBq6L9cc63L hBvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707490852; x=1708095652; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DX3ssuVXJl3+ksLxZIsRB1uXSORqnMNx/NgeFtXYxAs=; b=wQMG8i7oBXE/hv7GQpayMXU10Xo110wY+CYz5i3SDI22s4+IIFEP6YEXcuN2iwwv01 D8JwjPbdUk8j6kz38CIs8/A6Su4jNu+otBqLS1PLPAjsa0rpn/YKDQ3bxsF0YGjpesdB n/UirsmHZn2enbzfqzcHnk+ijXAGNqQ6o1TLM/jq3SFOwi1GIuZJQHZHe87yrJbGRQOz pUGrwk7LC+pV54Is8aZ1Hh5J0oM0szs6R1Vbh0ClGZYaa58tx9FzqIrRTI/NUvFE8e4z tkEaJ7HrdtB4nJ4s/PfnSIhO8dce+DpWItmUbXAOpBXZ6FHCVpHpojCqVN6lGwU0Hik1 WVDA== X-Forwarded-Encrypted: i=1; AJvYcCWcBR1+ev/j1WE0rYO8VCyP9ePIg6w0+0MV+kVA5PlGepnadi+mtJC+u2I39QrYjKASS/Ab95kMim6+nyu5cK8dltc/KapMAOwB X-Gm-Message-State: AOJu0YzBomvsaF5ddRr94uz+CSNX5db6C1u8ut5PHbwLvsEbw//UPUR9 jxBfr4X8txY16Z76BcTN7LCFjoM90gp/t1i34qmG9je49oai3F4tnRJjiCxul06pqTNZexQutRa ZDfvKkZFfgbiYYn+t4XTNTGnQiZI= X-Google-Smtp-Source: AGHT+IFYvDa5wSG4HKYoSnvgXNIeABu8pvk9fNxiO0jtd/CCbAFY6j6zaN7bxdKPJFTpedGx8wh5/KKE76XjpP3vfJo= X-Received: by 2002:a25:ad57:0:b0:dc6:ba5e:66d0 with SMTP id l23-20020a25ad57000000b00dc6ba5e66d0mr1608748ybe.65.1707490850838; Fri, 09 Feb 2024 07:00:50 -0800 (PST) MIME-Version: 1.0 References: <20240209125449.2352780-1-hjl.tools@gmail.com> <87mss9aicg.fsf@igel.home> <87bk8p7oki.fsf@oldenburg.str.redhat.com> <87o7cp664t.fsf@oldenburg.str.redhat.com> In-Reply-To: <87o7cp664t.fsf@oldenburg.str.redhat.com> From: "H.J. Lu" Date: Fri, 9 Feb 2024 07:00:14 -0800 Message-ID: Subject: Re: [PATCH] elf: Properly remove the initial 'env' command To: Florian Weimer Cc: Andreas Schwab , libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3020.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Feb 9, 2024 at 6:53=E2=80=AFAM Florian Weimer = wrote: > > * H. J. Lu: > > > On Fri, Feb 9, 2024 at 5:30=E2=80=AFAM Florian Weimer wrote: > >> > >> * Andreas Schwab: > >> > >> > On Feb 09 2024, H.J. Lu wrote: > >> > > >> >> diff --git a/elf/tst-rtld-list-diagnostics.py b/elf/tst-rtld-list-d= iagnostics.py > >> >> index 9e70e74bf8..dfba94de64 100644 > >> >> --- a/elf/tst-rtld-list-diagnostics.py > >> >> +++ b/elf/tst-rtld-list-diagnostics.py > >> >> @@ -294,7 +294,11 @@ def main(argv): > >> >> check_consistency_with_manual(opts.manual) > >> >> > >> >> # Remove the initial 'env' command. > >> >> - parse_diagnostics(opts.command.split()[1:]) > >> >> + options =3D [] > >> >> + for o in opts.command.split()[0:]: > >> >> + if o !=3D 'env': > >> >> + options.append(o) > >> > > >> > Why does it need to do that in the first place? > >> > >> Good question. I must have copied it from scripts/tst-ld-trace.py. I > >> think we can remove the .split() and run the command string with > > > > How does removing .split() work? The argument is > > > > "/export/build/gnu/tools-build/glibc-apx-sde/test-sde.sh env > > /export/build/gnu/tools-build/glibc-apx-sde/build-x86_64-linux/elf/ld-l= inux-x86-64.so.2 > > --list-diagnostics" > > > > We need .split() to change it to proper arguments. > > Can you test this? > > diff --git a/elf/tst-rtld-list-diagnostics.py b/elf/tst-rtld-list-diagnos= tics.py > index 9e70e74bf8..024bd8c320 100644 > --- a/elf/tst-rtld-list-diagnostics.py > +++ b/elf/tst-rtld-list-diagnostics.py > @@ -222,7 +222,7 @@ else: > def parse_diagnostics(cmd): > global errors > diag_out =3D subprocess.run(cmd, stdout=3Dsubprocess.PIPE, check=3DT= rue, > - universal_newlines=3DTrue).stdout > + universal_newlines=3DTrue, shell=3DTrue).s= tdout > if diag_out[-1] !=3D '\n': > print('error: ld.so output does not end in newline') > errors +=3D 1 > @@ -293,8 +293,7 @@ def main(argv): > if opts.manual: > check_consistency_with_manual(opts.manual) > > - # Remove the initial 'env' command. > - parse_diagnostics(opts.command.split()[1:]) > + parse_diagnostics(opts.command) > > if errors: > sys.exit(1) > > Thanks, > Florian > It works. Can you check it in? Thanks. --=20 H.J.