public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3] elf: Don't remove the initial 'env' command
@ 2024-02-09 13:58 H.J. Lu
  2024-02-09 14:45 ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2024-02-09 13:58 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer

tst-rtld-list-diagnostics.py is called by

"$(test-wrapper-env) $(objpfx)$(rtld-installed-name) --list-diagnostics"

and $(test-wrapper-env) is set to "$(test-wrapper) env".  When there is
a test wrapper, it is incorrect to use:

    # Remove the initial 'env' command.
    parse_diagnostics(opts.command.split()[1:])

to remove 'env' and there is no need to remove 'env'.  Don't remove 'env'
and pass shell=True to run.  This fixes [BZ #31357].
---
 elf/tst-rtld-list-diagnostics.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/elf/tst-rtld-list-diagnostics.py b/elf/tst-rtld-list-diagnostics.py
index 9e70e74bf8..5e05ebc05c 100644
--- a/elf/tst-rtld-list-diagnostics.py
+++ b/elf/tst-rtld-list-diagnostics.py
@@ -33,7 +33,8 @@ except:
             self.stdout = stdout
             self.stderr = stderr
 
-    def _run(*popenargs, input=None, timeout=None, check=False, **kwargs):
+    def _run(*popenargs, input=None, timeout=None, check=False, shell=True,
+             **kwargs):
         assert(timeout is None)
         with subprocess.Popen(*popenargs, **kwargs) as process:
             try:
@@ -293,8 +294,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.split()[:])
 
     if errors:
         sys.exit(1)
-- 
2.43.0


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

* Re: [PATCH v3] elf: Don't remove the initial 'env' command
  2024-02-09 13:58 [PATCH v3] elf: Don't remove the initial 'env' command H.J. Lu
@ 2024-02-09 14:45 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2024-02-09 14:45 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-alpha

* H. J. Lu:

> tst-rtld-list-diagnostics.py is called by
>
> "$(test-wrapper-env) $(objpfx)$(rtld-installed-name) --list-diagnostics"
>
> and $(test-wrapper-env) is set to "$(test-wrapper) env".  When there is
> a test wrapper, it is incorrect to use:
>
>     # Remove the initial 'env' command.
>     parse_diagnostics(opts.command.split()[1:])
>
> to remove 'env' and there is no need to remove 'env'.  Don't remove 'env'
> and pass shell=True to run.  This fixes [BZ #31357].
> ---
>  elf/tst-rtld-list-diagnostics.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/elf/tst-rtld-list-diagnostics.py b/elf/tst-rtld-list-diagnostics.py
> index 9e70e74bf8..5e05ebc05c 100644
> --- a/elf/tst-rtld-list-diagnostics.py
> +++ b/elf/tst-rtld-list-diagnostics.py
> @@ -33,7 +33,8 @@ except:
>              self.stdout = stdout
>              self.stderr = stderr
>  
> -    def _run(*popenargs, input=None, timeout=None, check=False, **kwargs):
> +    def _run(*popenargs, input=None, timeout=None, check=False, shell=True,
> +             **kwargs):
>          assert(timeout is None)
>          with subprocess.Popen(*popenargs, **kwargs) as process:
>              try:

I think you need to change the subprocess.run call further down below.

> @@ -293,8 +294,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.split()[:])

I would expect

  +    parse_diagnostics(opts.command)

here because we pass the whole thing to the shell as a string.

Thanks,
Florian


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

end of thread, other threads:[~2024-02-09 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-09 13:58 [PATCH v3] elf: Don't remove the initial 'env' command H.J. Lu
2024-02-09 14:45 ` Florian Weimer

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