2007-05-08 06:32:44

by Florian Fainelli

[permalink] [raw]
Subject: [PATCH] time locale in gen_initramfs_list.sh

I noticed that some zsh users who forced their ls formatting to something non
standard could not generate the initramfs file list. Forcing the locale to C
while generating seems not to be enough. Adding --time-style=locale will use
C locale ls output and will let them generate the initramfs list. It has no
side effects for other users.

Signed-off-by: Florian Fainelli <[email protected]>
--


Attachments:
(No filename) (0.00 B)
(No filename) (189.00 B)
Download all attachments

2007-05-08 11:06:53

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] time locale in gen_initramfs_list.sh

Florian Fainelli wrote:
> I noticed that some zsh users who forced their ls formatting to something non
> standard could not generate the initramfs file list. Forcing the locale to C
> while generating seems not to be enough. Adding --time-style=locale will use
> C locale ls output and will let them generate the initramfs list. It has no
> side effects for other users.

... except for those whose "ls" doesn't have "--time-style=locale"; how
long has that been implemented?

-hpa

2007-05-08 14:56:11

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH] time locale in gen_initramfs_list.sh

Hello Peter,

This is true. According to GNU fileutils changelog, the nearest Changelog
message regarding this option is :

2004-11-19 Alfred M. Szmidt <[email protected]>

* src/ls.c (usage): Clarified description of --no-group (-G),
--human-readable (-h), --inode (-i), --size (-s), --time,
and --time-style.

Le mardi 8 mai 2007, H. Peter Anvin a ?crit?:
> Florian Fainelli wrote:
> > I noticed that some zsh users who forced their ls formatting to something
> > non standard could not generate the initramfs file list. Forcing the
> > locale to C while generating seems not to be enough. Adding
> > --time-style=locale will use C locale ls output and will let them
> > generate the initramfs list. It has no side effects for other users.
>
> ... except for those whose "ls" doesn't have "--time-style=locale"; how
> long has that been implemented?
>
> -hpa



--
Cordialement, Florian Fainelli
---------------------------------------------


Attachments:
(No filename) (967.00 B)
(No filename) (189.00 B)
Download all attachments

2007-05-08 22:35:47

by Michael Mauch

[permalink] [raw]
Subject: Re: [PATCH] time locale in gen_initramfs_list.sh

Florian Fainelli wrote:

> This is true. According to GNU fileutils changelog, the nearest Changelog
> message regarding this option is :
>
> 2004-11-19 Alfred M. Szmidt <[email protected]>
>
> * src/ls.c (usage): Clarified description of --no-group (-G),
> --human-readable (-h), --inode (-i), --size (-s), --time,
> and --time-style.

It's also possible to overwrite that TIME_STYLE variable (which is
responsible for the format change), like so

LC_ALL=C TIME_STYLE=locale ls -l ...

Regards...
Michael

2007-05-10 00:10:23

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] time locale in gen_initramfs_list.sh

On Tue, 8 May 2007 07:55:26 +0200
Florian Fainelli <[email protected]> wrote:

> I noticed that some zsh users who forced their ls formatting to something non
> standard could not generate the initramfs file list. Forcing the locale to C
> while generating seems not to be enough. Adding --time-style=locale will use
> C locale ls output and will let them generate the initramfs list. It has no
> side effects for other users.
>
> Signed-off-by: Florian Fainelli <[email protected]>
> --
>
>
> [time_locale.patch text/plain (761B)]
> diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
> index 683eb12..1f96b9b 100644
> --- a/scripts/gen_initramfs_list.sh
> +++ b/scripts/gen_initramfs_list.sh
> @@ -125,7 +125,7 @@ parse() {
> str="${ftype} ${name} ${location} ${str}"
> ;;
> "nod")
> - local dev=`LC_ALL=C ls -l "${location}"`
> + local dev=`LC_ALL=C ls --time-style=locale -l "${location}"`
> local maj=`field 5 ${dev}`
> local min=`field 6 ${dev}`
> maj=${maj%,}
> @@ -135,7 +135,7 @@ parse() {
> str="${ftype} ${name} ${str} ${dev} ${maj} ${min}"
> ;;
> "slink")
> - local target=`field 11 $(LC_ALL=C ls -l "${location}")`
> + local target=`field 11 $(LC_ALL=C ls --time-style=locale -l "${location}")`
> str="${ftype} ${name} ${target} ${str}"
> ;;

hm, --time-style sounds rather gnu-specific and perhaps we'd rather not
add that requirement. Or perhaps we already require gnu ls, dunno.

I'll dump the problem in Sam's lap ;)

2007-05-10 02:08:44

by Rob Landley

[permalink] [raw]
Subject: Re: [PATCH] time locale in gen_initramfs_list.sh

On Wednesday 09 May 2007 8:09 pm, Andrew Morton wrote:
> hm, --time-style sounds rather gnu-specific and perhaps we'd rather not
> add that requirement. Or perhaps we already require gnu ls, dunno.

Running this sort of thing with busybox instead of the gnu tools is why I sent
the gawk/awk patches earlier. If a requirement for gnu ls has snuck in, it's
been within the last few months.

Rob