From 8a76b0b1c925d8b490d7c77a1c840de9437bf2ca Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 4 Jul 2025 10:26:09 +0200 Subject: [PATCH] doc: More precisions about POSIX printf portability. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * gettext-tools/doc/lang-sh.texi (The printf approach): Add more details. Based on info given by Jörg Schilling in 2020. --- gettext-tools/doc/lang-sh.texi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gettext-tools/doc/lang-sh.texi b/gettext-tools/doc/lang-sh.texi index 6db228b5b..776f542e2 100644 --- a/gettext-tools/doc/lang-sh.texi +++ b/gettext-tools/doc/lang-sh.texi @@ -175,9 +175,15 @@ Portability: A POSIX compliant @url{https://pubs.opengroup.org/onlinepubs/9799919799/utilities/printf.html, @code{printf}} -command, such as the one from GNU coreutils 9.6 or newer, is required. +command is required, such as the one +@c Test case: $ env printf 'abc %2$5.3g %1$s\n' foo 3.1415926 +from GNU coreutils 9.6 or newer, +from FreeBSD 11 or newer, +or from Solaris 11 OpenIndiana or Solaris 11 OmniOS. @c since 2014. At the time of this writing (2025), -no shell is known whose @code{printf} built-in is POSIX compliant. +the only known shells whose @code{printf} built-in is POSIX compliant +are @code{ksh93} and @code{zsh}; +@code{bash} and @code{dash} are not. For this reason, the code needs to use @code{env printf}, not @code{printf}, so as to avoid invoking the shell's @code{printf} built-in. @item -- 2.47.3