[PATCH v21 7/9] posix: check for collisions in getopt_long

Vivien Kraus vivien@planete-kraus.eu
Thu Feb 19 20:41:25 GMT 2026


Hello!

Le 18/02/2026 à 21:03, Adhemerval Zanella Netto a écrit :
> The new tst-getopt_long_collision.c test require a LOCALE update:
>
> diff --git a/posix/Makefile b/posix/Makefile
> index 48715cf1c1..869cf0f797 100644
> --- a/posix/Makefile
> +++ b/posix/Makefile
> @@ -534,6 +534,7 @@ LOCALES := \
>     en_US.UTF-8 \
>     es_US.ISO-8859-1 \
>     es_US.UTF-8 \
> +  fr_FR.UTF-8 \
>     ja_JP.EUC-JP \
>     tr_TR.UTF-8 \
>     # LOCALES

Oops, sorry.

> But even with this I am seeing a regression:
>
> $ make test t=posix/tst-getopt_long_collision
> [...]
> tst-getopt_long_collision.c:64: error: string comparison failed
>    left string: 10 bytes
>    right string: 3 bytes
>    left (evaluated from dgettext ("tst-getopt_long_collision", "kind 1\004foo")):
>        "kind 1\004foo"
>        6B 69 6E 64 20 31 04 66 6F 6F
>    right (evaluated from "bar"):
>        "bar"
>        62 61 72
Is posix/domaindir/fr_FR/LC_MESSAGES/tst-getopt_long_collision.mo (from 
the build directory) present?

I tried and failed to reproduce this error.

I can’t run make test t='posix/tst-getopt_long_collision'
right after a make clean, because it fails with:

> make[2]: *** No rule to make target 
> '/home/vivien/Projets/glibc/build/csu/stamp.os', needed by 
> '/home/vivien/Projets/glibc/build/libc_pic.a'.  Stop.
> make[2]: Leaving directory '/home/vivien/Projets/glibc/glibc/posix'
> make[1]: *** [Makefile:774: test] Error 2
> make[1]: Leaving directory '/home/vivien/Projets/glibc/glibc'
> make: *** [Makefile:23: test] Error 2
So I guess I’m expected to run `make` before running the tests. If I do 
make clean, make, and then make test t=…, then it works without an error.

If I checkout master, then run make and make test (e.g. 
posix/tstgetopt), then checkout this commit, and directly run make test 
t='posix/tst-getopt_long_collision', it also works.

So, I am not sure what is causing it.

Best regards,

Vivien



More information about the Libc-alpha mailing list