This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Fri, Nov 23, 2012 at 01:23:14PM -0500, P. J. McDermott wrote: [...] > Well here's a patch that makes ldd use gettext.sh if found and otherwise > define simple gettext and eval_gettext functions. Though these > functions should probably be defined more globally for use in other > scripts in glibc. > > Comments/improvements? [...] > -TEXTDOMAIN=libc > -TEXTDOMAINDIR=@TEXTDOMAINDIR@ > +export TEXTDOMAIN=libc > +export TEXTDOMAINDIR=@TEXTDOMAINDIR@ One may note that this syntax is not quite portable. Another issue with exported variables is that they leak to processes being traced. > +if (. 2>/dev/null gettext.sh); then > + . gettext.sh > +else > + # No internationalization available; just print the original strings. > + gettext () > + { > + printf '%s' "$1" > + } I suggest making this more robust by defining our default gettext() unconditionally and letting gettext.sh override it. > + eval_gettext () > + { Are you sure we really have to use that ugly eval_gettext? Wouldn't it be better to change the code to use simpler forms? The only affected piece in ldd is this one: > - echo >&2 $"ldd: option \`$1' is ambiguous" > + echo >&2 "$(eval_gettext "ldd: option \`\$1' is ambiguous")" Let's transform original echo >&2 $"ldd: option \`$1' is ambiguous" to printf >&2 $"ldd: option \`%s' is ambiguous\n" "$1" so that it could be later changed e.g. to printf >&2 "$(gettext "ldd: option \`%s' is ambiguous\n")" "$1" -- ldv
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |