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). 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 ? I.E. revert part of 6837183d as follows: 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) break; case long_iso_time_style: - case_long_iso_time_style: long_time_format[0] = long_time_format[1] = "%Y-%m-%d %H:%M"; break; @@ -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. */