[PATCH 2/2] ldd: Don't use Bash-only $"msgid" quoting

Carlos O'Donell carlos@systemhalted.org
Fri Nov 23 16:03:00 GMT 2012


On Fri, Nov 23, 2012 at 5:46 AM, Dmitry V. Levin <ldv@altlinux.org> wrote:
> On Thu, Nov 22, 2012 at 10:42:12PM -0500, P. J. McDermott wrote:
>> On non-Bash shells, ldd prints translatable strings in English
>> (regardless of the environment's locale) and prefixed with dollar signs,
>> e.g.:
>>
>>     $ export LC_ALL=es_ES.UTF-8
>>     $ /bin/dash /usr/bin/ldd --invalid
>>     ldd: $unrecognized option `--invalid'
>>     $Try `ldd --help' for more information.
>>
>> This patch makes ldd use the more portable (and secure) gettext utility
>> and eval_gettext function.
>>
>> 2012-11-22  P. J. McDermott  <pjm@nac.net>
>>
>>       * elf/ldd.bash.in: Use gettext utility and eval_gettext function instead
>>       of insecure and unportable Bash $"msgid" quoting.
>
> Note that bash $"msgid" syntax works without gettext being installed,
> so bash-based ldd, unlike your edition, can work without gettext.
> That is, your patch achieves portability by penalizing some installs with
> artificial requirements.  Also, there are no runtime checks for gettext
> availability, so there is a chance to lose messages.

Paul,

Thank you very much for your patch! :-)

Unfortunately the script must function correctly without the presence
of gettext.sh.

Requiring gettext.sh is a non-starter. It would mean glibc (as a
package with it's associated tools) would have a runtime dependency on
the gettext runtimes (to install gettext.sh), and I am strongly
against that. Dependencies are hard things to get right and we must
not add them without very good reasons.

I would consider a patch that checked for gettext.sh and used it if
possible to avoid bash-isms, but not outright require it.

Hopefully that gives you some guidance and a way forward.

Cheers,
Carlos.



More information about the Libc-alpha mailing list