[Top][All Lists]

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

Re: [PATCH]: ls: do not show long iso time format for en_* locales

From: Pádraig Brady
Subject: Re: [PATCH]: ls: do not show long iso time format for en_* locales
Date: Mon, 28 Sep 2009 21:37:11 +0100
User-agent: Thunderbird (X11/20071008)

Pádraig Brady wrote:
> Pádraig Brady wrote:
>> Jim Meyering wrote:
>>> The only advantage is that my patch uses the existing framework,
>>> rather than adding special case code in ls.c proper.
>>> Whether that is worth the apparent complexity...
>>> If you prefer his patch and want to adjust it and
>>> handle the rest, I have no objection.
>> Yes it's debatable.
>> I'll take a closer look at both
>> and send an updated one if I think
>> the special case in ls.c more appropriate.
> Thinking more about this I'm wondering about special casing en_* at all.
> The result of this patch is that for most people the usual timestamp
> format changes from 1 (ISO) to 3 fields (POSIX).

ISO is 2 fields actually :P

> So the first minor issue I have is that ISO has been the usual
> format for 4 years at least, so I suspect that this might trigger
> bugs in scripts parsing ls output. I do prefer the traditional
> POSIX specified format myself and I'm surprised that no one
> reported this until now. In summary I'm about 60:40 for making
> the change, and if we do I'll add appropriate text to NEWS.
> The other question I have is why do we assume ISO anyway when a
> format translation it not available? For example we've no translations
> for en_PH or tl_PH and so at the moment they'll get ISO format
> even though Tagalog month abbreviations are available:
> $ LANG=tl_PH locale abmon
> Ene;Peb;Mar;Abr;May;Hun;Hul;Ago;Sep;Okt;Nob;Dis
> Now if we do apply the special casing for en_* then you'll have
> different date formats for en_PH and tl_PH. Really the date
> format is associated with the country rather than the language.
> (Note I don't think we can determine whether abmon is specific
> to the locale or whether it's just the "C" default).
> So I think if we accept the first point above that we would change the
> default format to POSIX for most people I think we should just remove the
> code defaulting to ISO if a translation is not available ?

The full patch is attached.

>From 2829fa07edc1ef3f550521b53999dc53c89ff215 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden>
Date: Mon, 28 Sep 2009 17:32:15 +0100
Subject: [PATCH] ls: use the POSIX date style when the locale does not specify 

Previously we defaulted to "long-iso" format in locales without
specific format translations, like the en_* locales for example.
This reverts part of commit 6837183d, 08-11-2005, "ls ... acts like
--time-style='posix-long-iso' if the locale settings are messed up"
* src/ls.c (decode_switches): Only use the ISO format when specified.
* NEWS: Mention the change in behavior.
Reported at http://bugzilla.redhat.com/525134
 NEWS     |    5 +++++
 src/ls.c |   10 ++--------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 1571c9c..0380975 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,11 @@ GNU coreutils NEWS                                    -*- 
outline -*-
   last component (possibly via a dangling symlink) can be created,
   since mkdir will succeed in that case.
+  ls -l now uses the traditional three field time style rather than
+  the two field numeric ISO style, in locales where a specific style
+  has not been specified. This currently affects all English language
+  locales for example. [old behavior was introduced in coreutils-6.0]
 ** Improvements
   rm: rewrite to use gnulib's fts
diff --git a/src/ls.c b/src/ls.c
index 1bb6873..4531b94 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2014,7 +2014,6 @@ decode_switches (int argc, char **argv)
           case long_iso_time_style:
-          case_long_iso_time_style:
             long_time_format[0] = long_time_format[1] = "%Y-%m-%d %H:%M";
@@ -2030,13 +2029,8 @@ decode_switches (int argc, char **argv)
                    formats.  If not, fall back on long-iso format.  */
                 int i;
                 for (i = 0; i < 2; i++)
-                  {
-                    char const *locale_format =
-                      dcgettext (NULL, long_time_format[i], LC_TIME);
-                    if (locale_format == long_time_format[i])
-                      goto case_long_iso_time_style;
-                    long_time_format[i] = locale_format;
-                  }
+                  long_time_format[i] =
+                    dcgettext (NULL, long_time_format[i], LC_TIME);
       /* Note we leave %5b etc. alone so user widths/flags are honored.  */

reply via email to

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