bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: ls default time style


From: Paul Eggert
Subject: Re: ls default time style
Date: Tue, 11 Dec 2001 18:06:21 -0800 (PST)

> From: Bruno Haible <address@hidden>
> Date: Tue, 11 Dec 2001 21:42:51 +0100 (CET)
> 
> Paul Eggert writes:
> > So, if POSIXLY_CORRECT is set, perhaps TIME_STYLE etc. should be
> > ignored.
> 
> I agree. That would solve the problems for programs or users that want
> easy to parse "ls" output.

OK, I'll add that to my list of things to do.


> and using their locale conventions, the only variables they need to
> set is LANG (and possibly LANGUAGE, for people who speak multiple
> languages).

I wish things were that simple!  With GNU gettext 0.10.40, the
following environment variables can affect the localized behavior of
'ls', one way or another:

  LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_TIME NLSPATH
  OUTPUT_CHARSET

Sure, in an ideal environment people need to set only LANG.  But in
practice LANG often is not enough.

Come to think of it, LANGUAGE and OUTPUT_CHARSET are not standardized
by POSIX.  So, shouldn't these two variables be ignored if
POSIXLY_CORRECT is set, using the same argument as for TIME_STYLE
etc.?


> We are telling people that to get decent output in their language,

I'm not sure I agree that the current output is not "decent".  The
--time-style=iso output is serviceable.  It looked a bit odd to me at
first (I'm a native English speaker), but it's not hard to pick up.
Nobody expects the output of `ls' to be as nice looking as the
beautiful calendars you get as a Christmas presents.  All it has to do
is work.

Let me try to describe in some detail the history of this problem, so
that you can see where I'm coming from.  Before 1996 GNU 'ls' always
printed American English style dates.  From 1996 to last year, GNU
'ls' always printed dates using strftime with one of two formats: "%b
%e  %Y" and "%b %e %H:%M".  This happened to work in American English
and a few other locales, but in many others (including German, from
what you say) those date formats are nonstandard.

Last year, --time-style=locale dates finally were introduced to a GNU
fileutils test version 4.0.28 (due to a suggestion by Christian Rose),
but the method used did not conform to POSIX.  I contributed a fix to
the POSIX incompatibility in test version 4.0.32, but I was still
unhappy with the results, as the translated strings were often too
wide in many locales, and the translations gave Emacs fits.  Also, the
formats were not translated (or were translated incorrectly) in
several locales.  I also help maintain GNU Emacs's
dired-move-to-filename-regexp, so the corresponding Emacs bug reports
were giving me a feel for the kinds of practical problems were being
caused by the --time-style=locale approach.

Furthermore, since 1996 the translations often were not constant-width
(due to real linguistic problems, I understand -- not just sloppy
translations), so the resulting 'ls' columns did not line up.

Now, all these problems could be overcome eventually.  But I thought
it simpler to let ISO style be the default outside the POSIX locale.
Users who prefer a national style can easily get one by setting an
environment variable (and then _they_ can go off and debug why Emacs
stops working, or why their columns don't line up :-).

Perhaps if things settle down with time, and if most users really
prefer --time-style=locale dates, we can then change the default style
to be --time-style=locale.  I'm not religiously opposed to
--time-style=locale.  It's the practical constraints that led me to
think that an ISO-like style was the best default one, at least for
now.



reply via email to

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