[PATCH v10 0/8] Support translated names in getopt and argp
Vivien Kraus
vivien@planete-kraus.eu
Fri Aug 8 18:36:29 GMT 2025
Dear glibc developers,
Congratulations for the release of GLibc 2.42! It means that I have
to use the new 2.43 number in the abilists though, which is why you
get a v10.
As for detecting collisions between a newly introduced untranslated
option name and existing translations of other options, I am not fully
sure this getopt_long_collision would be the most useful. It has 2
drawbacks:
1. You need to call it after setting the locale to all possible
values; 2. It’s a run-time thing, so it may not be very helpful to a
developer wishing to introduce a new command-line option.
Maybe a static analyzer would be better, as a script. It would work at
the PO level, checking every PO file one at a time, given a known
msgctxt for command-line options. Would you rather have such a
script? How would I contribute it? Does the glibc have an example of
scripts like that?
Best regards,
Vivien
Vivien Kraus (8):
posix: allow getopt_long to match translated option names
posix: let the getopt caller set the translation context
argp: document translated names in --help and --usage
posix: let the getopt caller choose the textdomain for translation
posix: do not allow option name translations for secure programs
posix, argp: Support deprecation of long option name translations
argp: do not display option name translations if __libc_enable_secure
posix: Add getopt_long_collision
argp/Makefile | 14 ++
argp/argp-help.c | 83 ++++++++-
argp/argp-parse.c | 1 +
argp/tst-argphelp-localized.c | 169 ++++++++++++++++++
argp/tst-argphelp-localized.po | 23 +++
argp/tst-argpusage-localized.c | 82 +++++++++
manual/argp.texi | 25 ++-
manual/getopt.texi | 71 +++++++-
posix/Makefile | 23 +++
posix/Versions | 3 +
posix/bits/getopt_ext.h | 17 ++
posix/getopt.c | 168 +++++++++++++++--
posix/getopt1.c | 102 ++++++++++-
posix/getopt_int.h | 14 +-
posix/tst-getopt_long_collision.c | 66 +++++++
posix/tst-getopt_long_collision.po | 22 +++
posix/tstgetoptl.c | 127 +++++++++++++
posix/tstgetoptl.po | 27 +++
sysdeps/mach/hurd/i386/libc.abilist | 3 +
sysdeps/mach/hurd/x86_64/libc.abilist | 3 +
sysdeps/unix/sysv/linux/aarch64/libc.abilist | 3 +
sysdeps/unix/sysv/linux/alpha/libc.abilist | 3 +
sysdeps/unix/sysv/linux/arc/libc.abilist | 3 +
sysdeps/unix/sysv/linux/arm/be/libc.abilist | 3 +
sysdeps/unix/sysv/linux/arm/le/libc.abilist | 3 +
sysdeps/unix/sysv/linux/csky/libc.abilist | 3 +
sysdeps/unix/sysv/linux/hppa/libc.abilist | 3 +
sysdeps/unix/sysv/linux/i386/libc.abilist | 3 +
.../sysv/linux/loongarch/lp64/libc.abilist | 3 +
.../sysv/linux/m68k/coldfire/libc.abilist | 3 +
.../unix/sysv/linux/m68k/m680x0/libc.abilist | 3 +
.../sysv/linux/microblaze/be/libc.abilist | 3 +
.../sysv/linux/microblaze/le/libc.abilist | 3 +
.../sysv/linux/mips/mips32/fpu/libc.abilist | 3 +
.../sysv/linux/mips/mips32/nofpu/libc.abilist | 3 +
.../sysv/linux/mips/mips64/n32/libc.abilist | 3 +
.../sysv/linux/mips/mips64/n64/libc.abilist | 3 +
sysdeps/unix/sysv/linux/or1k/libc.abilist | 3 +
.../linux/powerpc/powerpc32/fpu/libc.abilist | 3 +
.../powerpc/powerpc32/nofpu/libc.abilist | 3 +
.../linux/powerpc/powerpc64/be/libc.abilist | 3 +
.../linux/powerpc/powerpc64/le/libc.abilist | 3 +
.../unix/sysv/linux/riscv/rv32/libc.abilist | 3 +
.../unix/sysv/linux/riscv/rv64/libc.abilist | 3 +
.../unix/sysv/linux/s390/s390-32/libc.abilist | 3 +
.../unix/sysv/linux/s390/s390-64/libc.abilist | 3 +
sysdeps/unix/sysv/linux/sh/be/libc.abilist | 3 +
sysdeps/unix/sysv/linux/sh/le/libc.abilist | 3 +
.../sysv/linux/sparc/sparc32/libc.abilist | 3 +
.../sysv/linux/sparc/sparc64/libc.abilist | 3 +
.../unix/sysv/linux/x86_64/64/libc.abilist | 3 +
.../unix/sysv/linux/x86_64/x32/libc.abilist | 3 +
52 files changed, 1096 insertions(+), 43 deletions(-)
create mode 100644 argp/tst-argphelp-localized.c
create mode 100644 argp/tst-argphelp-localized.po
create mode 100644 argp/tst-argpusage-localized.c
create mode 100644 posix/tst-getopt_long_collision.c
create mode 100644 posix/tst-getopt_long_collision.po
create mode 100644 posix/tstgetoptl.c
create mode 100644 posix/tstgetoptl.po
base-commit: fd9ffafc0eaad3b4ff576f4d291d2e9336e6019b
--
2.34.1
More information about the Libc-alpha
mailing list