* [PATCH] dracut: setup English locales for Dracut build script
@ 2010-06-18 11:38 Amadeusz Żołnowski
[not found] ` <20100618133841.61845f0d-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Amadeusz Żołnowski @ 2010-06-18 11:38 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1188 bytes --]
Dracut rely upon programs' output like ldd's "not a dynamic executable".
Assume user sets up Polish locales and then ldd prints
"nie jest dynamicznym programem wykonywalnym". The patch prevents this.
---
dracut | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/dracut b/dracut
index 3be4989..1437625 100755
--- a/dracut
+++ b/dracut
@@ -71,6 +71,17 @@ Creates initial ramdisk images for preloading modules
"
}
+# Change locales and language leaving existing suffix (.utf8 or similar).
+# $1 = language (e.g. en_US)
+change_locales() {
+ local lang=(${LANG/./ })
+ lang[0]=$1
+ lang=${lang[@]}
+ LANG=${lang/ /.}
+ LC_ALL=${LANG}
+ export LANG LC_ALL
+}
+
while (($# > 0)); do
case $1 in
-f|--force) force=yes;;
@@ -107,6 +118,10 @@ done
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
+# We rely upon programs' output like ldd's "not found", so we have to
+# set up English locales.
+change_locales en_US
+
[[ $debug ]] && {
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
--
1.7.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 7+ messages in thread[parent not found: <20100618133841.61845f0d-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>]
* Re: [PATCH] dracut: setup English locales for Dracut build script [not found] ` <20100618133841.61845f0d-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> @ 2010-06-18 12:16 ` Victor Lowther [not found] ` <AANLkTil85GmgtdZieaCwu93axSYZnlpVDpMX2kSRQiUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2010-06-18 13:28 ` Adam Spragg 2010-06-18 16:56 ` Harald Hoyer 2 siblings, 1 reply; 7+ messages in thread From: Victor Lowther @ 2010-06-18 12:16 UTC (permalink / raw) To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA 2010/6/18 Amadeusz Żołnowski <aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>: > Dracut rely upon programs' output like ldd's "not a dynamic executable". > Assume user sets up Polish locales and then ldd prints > "nie jest dynamicznym programem wykonywalnym". The patch prevents this. > --- > dracut | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/dracut b/dracut > index 3be4989..1437625 100755 > --- a/dracut > +++ b/dracut > @@ -71,6 +71,17 @@ Creates initial ramdisk images for preloading modules > " > } Hmmm... The usual way to do this is to run the program in the C locale by setting LC_ALL=C > +# Change locales and language leaving existing suffix (.utf8 or similar). > +# $1 = language (e.g. en_US) > +change_locales() { > + local lang=(${LANG/./ }) > + lang[0]=$1 > + lang=${lang[@]} > + LANG=${lang/ /.} > + LC_ALL=${LANG} > + export LANG LC_ALL > +} > + > while (($# > 0)); do > case $1 in > -f|--force) force=yes;; > @@ -107,6 +118,10 @@ done > > PATH=/sbin:/bin:/usr/sbin:/usr/bin > export PATH > +# We rely upon programs' output like ldd's "not found", so we have to > +# set up English locales. > +change_locales en_US > + > > [[ $debug ]] && { > export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '; > -- > 1.7.1 > ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <AANLkTil85GmgtdZieaCwu93axSYZnlpVDpMX2kSRQiUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] dracut: setup English locales for Dracut build script [not found] ` <AANLkTil85GmgtdZieaCwu93axSYZnlpVDpMX2kSRQiUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2010-06-18 13:30 ` Amadeusz Żołnowski 0 siblings, 0 replies; 7+ messages in thread From: Amadeusz Żołnowski @ 2010-06-18 13:30 UTC (permalink / raw) To: Victor Lowther; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 386 bytes --] Victor Lowther <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > Hmmm... The usual way to do this is to run the program in the C locale > by setting > LC_ALL=C You mean we should prefix every call which output we rely or just setup: export LC_ALL=C in place I pointed? Hm… to think about it the first option would be more elgant. -- PGP key: 1024D/C284750D [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dracut: setup English locales for Dracut build script [not found] ` <20100618133841.61845f0d-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> 2010-06-18 12:16 ` Victor Lowther @ 2010-06-18 13:28 ` Adam Spragg [not found] ` <201006181428.09276.adam-2iSS7ArDF14@public.gmane.org> 2010-06-18 16:56 ` Harald Hoyer 2 siblings, 1 reply; 7+ messages in thread From: Adam Spragg @ 2010-06-18 13:28 UTC (permalink / raw) To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA On Friday 18 Jun 2010 12:38:41 Amadeusz Żołnowski wrote: > Dracut rely upon programs' output like ldd's "not a dynamic executable". > Assume user sets up Polish locales and then ldd prints > "nie jest dynamicznym programem wykonywalnym". The patch prevents this. > --- > dracut | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/dracut b/dracut > index 3be4989..1437625 100755 > --- a/dracut > +++ b/dracut > @@ -107,6 +118,10 @@ done > > PATH=/sbin:/bin:/usr/sbin:/usr/bin > export PATH > +# We rely upon programs' output like ldd's "not found", so we have to > +# set up English locales. > +change_locales en_US > + > > [[ $debug ]] && { > export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '; I don't have any en_US locales installed on my system. Not sure why a Pole would either. You'd probably be better off with the "C" locale, IMHO. Adam ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <201006181428.09276.adam-2iSS7ArDF14@public.gmane.org>]
* Re: [PATCH] dracut: setup English locales for Dracut build script [not found] ` <201006181428.09276.adam-2iSS7ArDF14@public.gmane.org> @ 2010-06-19 11:25 ` Amadeusz Żołnowski 0 siblings, 0 replies; 7+ messages in thread From: Amadeusz Żołnowski @ 2010-06-19 11:25 UTC (permalink / raw) To: initramfs-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 350 bytes --] Thank you all for comments. Right, C is better. :-) I reviewed the code and it looks that only ldd is “affected” by locales, although there some other commands the output is parsed, but it's not localized. Should we prefix them anyway “just for sure” or leave as is? Cheers, Amadeusz Żołnowski -- PGP key: 1024D/C284750D [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dracut: setup English locales for Dracut build script [not found] ` <20100618133841.61845f0d-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> 2010-06-18 12:16 ` Victor Lowther 2010-06-18 13:28 ` Adam Spragg @ 2010-06-18 16:56 ` Harald Hoyer [not found] ` <4C1BA538.7010304-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2 siblings, 1 reply; 7+ messages in thread From: Harald Hoyer @ 2010-06-18 16:56 UTC (permalink / raw) To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA On 06/18/2010 01:38 PM, Amadeusz Żołnowski wrote: > Dracut rely upon programs' output like ldd's "not a dynamic executable". > Assume user sets up Polish locales and then ldd prints > "nie jest dynamicznym programem wykonywalnym". The patch prevents this. > --- > dracut | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/dracut b/dracut > index 3be4989..1437625 100755 > --- a/dracut > +++ b/dracut > @@ -71,6 +71,17 @@ Creates initial ramdisk images for preloading modules > " > } > > +# Change locales and language leaving existing suffix (.utf8 or similar). > +# $1 = language (e.g. en_US) > +change_locales() { > + local lang=(${LANG/./ }) > + lang[0]=$1 > + lang=${lang[@]} > + LANG=${lang/ /.} > + LC_ALL=${LANG} > + export LANG LC_ALL > +} > + > while (($#> 0)); do > case $1 in > -f|--force) force=yes;; > @@ -107,6 +118,10 @@ done > > PATH=/sbin:/bin:/usr/sbin:/usr/bin > export PATH > +# We rely upon programs' output like ldd's "not found", so we have to > +# set up English locales. > +change_locales en_US > + > > [[ $debug ]]&& { > export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '; Hmm, we probably should prefix every call to an app, where we parse the output with LANG=C like this: LANG=C ldd $file | grep -q "not found" ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <4C1BA538.7010304-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] dracut: setup English locales for Dracut build script [not found] ` <4C1BA538.7010304-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2010-06-22 9:23 ` Harald Hoyer 0 siblings, 0 replies; 7+ messages in thread From: Harald Hoyer @ 2010-06-22 9:23 UTC (permalink / raw) To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=commitdiff;h=e4ebd474ec39d28a5e211f47bf77db3939ca2e90 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-06-22 9:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-18 11:38 [PATCH] dracut: setup English locales for Dracut build script Amadeusz Żołnowski
[not found] ` <20100618133841.61845f0d-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>
2010-06-18 12:16 ` Victor Lowther
[not found] ` <AANLkTil85GmgtdZieaCwu93axSYZnlpVDpMX2kSRQiUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-18 13:30 ` Amadeusz Żołnowski
2010-06-18 13:28 ` Adam Spragg
[not found] ` <201006181428.09276.adam-2iSS7ArDF14@public.gmane.org>
2010-06-19 11:25 ` Amadeusz Żołnowski
2010-06-18 16:56 ` Harald Hoyer
[not found] ` <4C1BA538.7010304-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-22 9:23 ` Harald Hoyer
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.