[PATCH v5] ld.so: add an --argv0 option

Florian Weimer fweimer@redhat.com
Thu Sep 24 09:53:13 GMT 2020


* vincent via Libc-alpha:

> is there any problem with this patch?

I think adding a NEWS entry would make sense.

> +ARGV0 = test-argv0
> +$(objpfx)argv0test.out: tst-rtld-argv0.sh $(objpfx)ld.so \
> +			$(objpfx)argv0test
> +	$(SHELL) $< $(objpfx)ld.so $(objpfx)argv0test \
> +            '$(test-wrapper-env)' '$(run_program_env)' \
> +            '$(rpath-link)' '$(ARGV0)' > $@; \
> +    $(evaluate-test)

Here I do not think the ARGV0 variable adds much clarity.

> +#include <string.h>
> +#include <support/check.h>
> +
> +static int
> +do_test (int argc, char **argv)
> +{
> +  TEST_COMPARE_BLOB (argv[0], strlen (argv[0]),
> +                     "test-argv0", strlen ("test-argv0"));
> +  return 0;
> +}

You can use TEST_COMPARE_STRING, which will do the strlen for you.

The patch itself looks okay to me.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill



More information about the Libc-alpha mailing list