[PATCH v21 0/9] Support translated long option names in getopt and argp

Vivien Kraus vivien@planete-kraus.eu
Sat Mar 21 10:24:14 GMT 2026


Hello,

Setting aside the NEWS and abilists for hurd, the patch series still
applies and the tests still pass.

Best regards,

Vivien

Le mardi 03 février 2026 à 18:51 +0100, Vivien Kraus a écrit :
> Dear glibc developers,
> 
> Sorry, I forgot that I had to wait for you in addition to the
> release.
> 
> I reworked the series a bit.  I put the multiple translations support
> last, so that you can skip it if you don’t think it is relevant.  I
> changed it a bit: it is not about deprecation anymore, only
> supporting
> multiple translations for the same option.
> 
> As for collisions, there is no new API.  It is unfortunate that
> getopt_long does not have an initialization function, where the
> checks
> for collisions could happen.  Instead, we check the first time
> getopt_long is called, only if translations are enabled, and only
> once.  This ensures translators know of any collisions as soon as
> they
> run the program.
> 
> Finally, I made each relevant patch update the NEWS file instead of
> doing a separate commit.
> 
> Best regards,
> 
> Vivien
> 
> Vivien Kraus (9):
>   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
>   argp: do not display option name translations if
> __libc_enable_secure
>   posix: check for collisions in getopt_long
>   posix: Add a script for static validation of getopt_long PO files
>   posix, argp: Support multiple long option name translations
> 
>  NEWS                                          |  10 +-
>  argp/Makefile                                 |  19 ++
>  argp/argp-help.c                              | 142 +++++++-
>  argp/argp-parse.c                             |   1 +
>  argp/tst-argphelp-localized.c                 | 141 ++++++++
>  argp/tst-argphelp-localized.po                |  26 ++
>  argp/tst-argpusage-localized.c                |  82 +++++
>  manual/argp.texi                              |  25 +-
>  manual/getopt.texi                            |  80 ++++-
>  manual/install.texi                           |   7 +-
>  posix/Makefile                                |  51 ++-
>  posix/Versions                                |   4 +
>  posix/bits/getopt_ext.h                       |   4 +
>  posix/check-getopt-translations.pl            | 199 +++++++++++
>  posix/getopt.c                                | 323
> +++++++++++++++++-
>  posix/getopt1.c                               | 114 ++++++-
>  posix/getopt_int.h                            |  22 +-
>  .../standalone-multiple-getopt-collisions.po  |  45 +++
>  posix/tst-check-getopt-translations.sh        |  61 ++++
>  posix/tst-getopt_long_collision.c             | 130 +++++++
>  posix/tst-getopt_long_collision.po            |  32 ++
>  posix/tstgetoptl.c                            | 183 ++++++++++
>  posix/tstgetoptl.po                           |  26 ++
>  sysdeps/mach/hurd/i386/libc.abilist           |   2 +
>  sysdeps/mach/hurd/x86_64/libc.abilist         |   2 +
>  sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   2 +
>  sysdeps/unix/sysv/linux/alpha/libc.abilist    |   2 +
>  sysdeps/unix/sysv/linux/arc/libc.abilist      |   2 +
>  sysdeps/unix/sysv/linux/arm/be/libc.abilist   |   2 +
>  sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   2 +
>  sysdeps/unix/sysv/linux/csky/libc.abilist     |   2 +
>  sysdeps/unix/sysv/linux/hppa/libc.abilist     |   2 +
>  sysdeps/unix/sysv/linux/i386/libc.abilist     |   2 +
>  .../sysv/linux/loongarch/lp64/libc.abilist    |   2 +
>  .../sysv/linux/m68k/coldfire/libc.abilist     |   2 +
>  .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   2 +
>  .../sysv/linux/microblaze/be/libc.abilist     |   2 +
>  .../sysv/linux/microblaze/le/libc.abilist     |   2 +
>  .../sysv/linux/mips/mips32/fpu/libc.abilist   |   2 +
>  .../sysv/linux/mips/mips32/nofpu/libc.abilist |   2 +
>  .../sysv/linux/mips/mips64/n32/libc.abilist   |   2 +
>  .../sysv/linux/mips/mips64/n64/libc.abilist   |   2 +
>  sysdeps/unix/sysv/linux/or1k/libc.abilist     |   2 +
>  .../linux/powerpc/powerpc32/fpu/libc.abilist  |   2 +
>  .../powerpc/powerpc32/nofpu/libc.abilist      |   2 +
>  .../linux/powerpc/powerpc64/be/libc.abilist   |   2 +
>  .../linux/powerpc/powerpc64/le/libc.abilist   |   2 +
>  .../unix/sysv/linux/riscv/rv32/libc.abilist   |   2 +
>  .../unix/sysv/linux/riscv/rv64/libc.abilist   |   2 +
>  .../unix/sysv/linux/s390/s390-32/libc.abilist |   2 +
>  .../unix/sysv/linux/s390/s390-64/libc.abilist |   2 +
>  sysdeps/unix/sysv/linux/sh/be/libc.abilist    |   2 +
>  sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   2 +
>  .../sysv/linux/sparc/sparc32/libc.abilist     |   2 +
>  .../sysv/linux/sparc/sparc64/libc.abilist     |   2 +
>  .../unix/sysv/linux/x86_64/64/libc.abilist    |   2 +
>  .../unix/sysv/linux/x86_64/x32/libc.abilist   |   2 +
>  57 files changed, 1742 insertions(+), 53 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/check-getopt-translations.pl
>  create mode 100644 posix/standalone-multiple-getopt-collisions.po
>  create mode 100644 posix/tst-check-getopt-translations.sh
>  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: 1dd9951d85bc84ec104dda97fd1d3c5e8166f49e


More information about the Libc-alpha mailing list