public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,  libc-alpha@sourceware.org
Subject: Re: [PATCH] elf: Properly remove the initial 'env' command
Date: Fri, 09 Feb 2024 15:53:38 +0100	[thread overview]
Message-ID: <87o7cp664t.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAMe9rOojM=-GWT7QuesCMA=_PxZdJvd=g2T1Qf7kinOi6Emt8g@mail.gmail.com> (H. J. Lu's message of "Fri, 9 Feb 2024 05:52:59 -0800")

* H. J. Lu:

> On Fri, Feb 9, 2024 at 5:30 AM Florian Weimer <fweimer@redhat.com> 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-diagnostics.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 = []
>> >> +    for o in opts.command.split()[0:]:
>> >> +        if o != '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-linux-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-diagnostics.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 = subprocess.run(cmd, stdout=subprocess.PIPE, check=True,
-                              universal_newlines=True).stdout
+                              universal_newlines=True, shell=True).stdout
     if diag_out[-1] != '\n':
         print('error: ld.so output does not end in newline')
         errors += 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


  reply	other threads:[~2024-02-09 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09 12:54 H.J. Lu
2024-02-09 13:00 ` Florian Weimer
2024-02-09 13:19   ` H.J. Lu
2024-02-09 13:16 ` Andreas Schwab
2024-02-09 13:30   ` Florian Weimer
2024-02-09 13:52     ` H.J. Lu
2024-02-09 14:53       ` Florian Weimer [this message]
2024-02-09 15:00         ` H.J. Lu
2024-02-09 15:17           ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7cp664t.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).