On Sun, Dec 3, 2023 at 4:58 AM Bruno Haible <br...@clisp.org> wrote:
> In a testdir of module 'argp', built with clang 17 and -fsanitize=address,
> I see this test failure:
>
> $ cat test-argp-2.sh.log
> --- expected    2023-12-03 12:52:58.892318895 +0100
> +++ out 2023-12-03 12:52:58.904318928 +0100
> @@ -27,9 +27,9 @@
>    -l, --limerick             create a limerick
>    -p, --poem                 create a poem
>
> -  -?, --help                 give this help list
> -      --usage                give a short usage message
> -  -V, --version              print program version
> +  -?, --help                 Give this help list
> +      --usage                Give a short usage message
> +  -V, --version              Print program version
>
>  Mandatory or optional arguments to long options are also mandatory or 
> optional
>  for any corresponding short options.
> FAIL test-argp-2.sh (exit status: 1)
>
>
> The background is:
> - glibc/argp/argp-parse.c uses the capitalized strings.
> - gnulib/lib/argp-parse.c uses the lowercase strings, since 2006:
>   
> https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=59737d835c4622ee24f2b79b50cd12ed28419386
>
> When compiling test-argp with
>   - gcc
>   - gcc with asan
>   - gcc with ubsan
>   - clang
>   - clang with ubsan
> the program uses gnulib's argp_parse:
> $ nm --dynamic test-argp|grep argp
> 000000000000d7b4 D argp_err_exit_status
> 0000000000007962 T argp_error
> 000000000000640d T argp_failure
> 00000000000078af T argp_help
> 0000000000003b23 T argp_parse
> 000000000000d0f8 D argp_program_bug_address
> 000000000000d100 D argp_program_version
> 000000000000d7f8 B argp_program_version_hook
> 00000000000078cb T argp_state_help
>
> But when compiling it with clang with asan, it uses ASAN-defined symbols
> that apparently redirect to the glibc symbols:
> $ nm --dynamic test-argp|grep argp
> 0000000000045259 W argp_parse
> 000000000014a2c0 D argp_program_bug_address
> 000000000014a2a0 D argp_program_version
> 00000000000a2780 T ___interceptor_argp_parse
> 00000000000a2780 W __interceptor_argp_parse
> 0000000000045259 T __interceptor_trampoline_argp_parse
>
> What should we do?
>   (A) Ensure that glibc and gnulib argp behave the same:
>       - Push Sergey's lowercase commit into glibc?
>       - Revert Sergey's lowercase commit in gnulib?
> or
>   (B) Ensure that gnulib overrides glibc:
>       - Use '#define argp_parse rpl_argp_parse' so that clang doesn't
>         insert its interceptor?

What a surprising (and irritatingly subtle) inconsistency.
I like Jeffrey's suggestion to ignore case, at least temporarily.

Reply via email to