[PATCH] elf: Properly remove the initial 'env' command

Florian Weimer fweimer@redhat.com
Fri Feb 9 13:00:40 GMT 2024


* H. J. Lu:

> 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)
> +    parse_diagnostics(options)

I think you can write this as:

    options = opts.command.split()[:]
    options.remove('env')

It only removes the first occurrence, but I think that is more correct
anyway.

Thanks,
Florian



More information about the Libc-alpha mailing list