bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tweaking default `ls -l` output to use locale before posix


From: Paul Eggert
Subject: Re: tweaking default `ls -l` output to use locale before posix
Date: Sun, 25 Sep 2005 18:23:55 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Mike Frysinger <address@hidden> writes:

> i was going through some patches Gentoo has for coreutils to figure out which 
> are outdated/pointless/etc... with 5.3.0 when i came across this patch from 
> Mandrake:
> --- src/ls.c
> +++ src/ls.c
> @@ -1612,5 +1612,7 @@
>  
>        if (! style)
>     if (! (style = getenv ("TIME_STYLE")))
> +   if (getenv ("POSIXLY_CORRECT"))
>       style = "posix-long-iso";
> +     else style = "locale";
>  
>
> ignoring the broken formatting, i wonder if this change has been sent to the 
> list before for consideration (and i just couldnt find it in the archives) ? 

I don't recall seeing it, no.

> the idea seems OK to me; the `ls -l` default format follows the
> user's locale settings unless the env var POSIXLY_CORRET is set in
> which case we go with the standard 'posix-long-iso' format

I don't see why POSIXLY_CORRECT should affect the behavior here.
POSIXLY_CORRECT is intended for places where the GNU default is a
behavior that does not conform to POSIX, but the GNU default
(--time-style='posix-long-iso') does conform.

I suspect that Mandrake patch was put in by someone who wanted
--time-style='locale' to be the default, and thought that the only
reason --time-style='posix-long-iso' is the default is because POSIX
requires this.  But that's not the case: POSIX would allow either
time-style to be the default.

When I wrote that code back in 2002, I wanted posix-long-iso to be the
default for the benefit of Emacs.  Emacs's dired module parses dates,
but it misparses random dates generated in random locales (e.g., dates
based on the Japanese emperor's date of accession).  Having the
default be posix-long-iso avoided most of this problem.  I figured
other programs would have problems similar to Emacs.

If I recall correctly CVS Emacs now does this a different way and may
no longer need posix-long-iso to be the default, but the latest stable
Emacs still has the problem.  (My memory could be wrong, but someone
should check this before making changes.)  At any rate if other
programs rely on the current behavior I'd be a bit leery about
changing the default to --time-style=locale -- though if it works well
for Mandrake that's an argument that it wouldn't hurt much to change
it.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]