[Openswan dev] handling of internationalization of bash
Michael Richardson
mcr at sandelman.ottawa.on.ca
Fri Dec 17 08:36:51 CET 2004
-----BEGIN PGP SIGNED MESSAGE-----
When integrating openswan into Fedora Core, RH patches the scripts as
followed:
- -*) echo "unknown uniqueids value (not yes/no) \`$IPSECuniqueids'" ;;
+*) echo $"unknown"' uniqueids '$"value"' ('$"not"' yes/no) `'$IPSECuniqueid
s"'" ;;
bash has a bash-ism where $"string" turns into "string" if $"string"
isn't set. An internationalized version would have translations, and
would have set $"string" to something else. (via gettext, I assume).
The problem with this is that we have been trying to avoid being
bash-dependant for some time. My questions are:
a) is it worth continuing to be sh-independant?
(busybox sh is "ash")
b) my inclination was to solve this by changing this line to:
*) echo @STR"unknown"STR@' uniqueids '@STR"value"STR@' ('@STR"not"STR@' yes/no) `'$IPSECuniqueids"'" ;;
and, add in Makefile.programs:
ifeq ($(strip $(USE_BASH)),true)
| sed -e 's:@STR":$":g' -e 's:"STR@:":g' >$@
else
| sed -e 's:@STR":":g' -e 's:"STR@:":g' >$@
endif
(since most of the scripts are in .in files, and get processed anyway)
As I did this, I wondered about just processing the bash-ism's out.
The advantage of the @STR and STR@ stuff, is that they don't care about
being quoted, etc. Whereas, the closing might be a problem to match if
it has to match an opening $"
(as I think about it today, maybe we don't need to process the closing
" at all. Maybe it suffices to translate $" -> ")
- --
] ON HUMILITY: to err is human. To moo, bovine. | firewalls [
] Michael Richardson, Xelerance Corporation, Ottawa, ON |net architect[
] mcr at xelerance.com http://www.sandelman.ottawa.on.ca/mcr/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Finger me for keys
iQCVAwUBQcLg8YqHRg3pndX9AQGYcgQAmeaBSK60BSjAO7NXntNqdR7/yAQYoBSD
QSxpA/y9fOXcplvpeYwL8/zEEm+OP5QbyyH8Y6FY9KZPJKqWEQih6anxtJ7Z/Se4
RD7z2PpvTI55c6+4jpTWmr3hZqqny6vF5JoVppzeomR8rkq71nn6XtmRR0iQrDsY
Y0+hoL2bjNs=
=vlwZ
-----END PGP SIGNATURE-----
More information about the Dev
mailing list