[Toybox] Bug in toybox ls

Rob Landley rob at landley.net
Mon Mar 7 07:47:03 PST 2016


On 03/07/2016 12:58 AM, Tristan Van Berkom wrote:
> Hi,
> 
> I ran into a problem building flex today, where the automake provided
> mdate-sh script produced garbage output in doc/version.texi causing
> make install to break.

I've got flex in my LFS 7.8 package list, I'll give it a go later today.

> I will not contend that it makes any sense at all for the automake
> mdate-sh script to try to make a pretty date out of ls's output,
> however it seems that it relies on the output of 'ls -L -l -d -n' to
> produce day names and month names and the like.

In what language?

-L is dereference symlinks, -l is long, -d is show directories, -n is
numeric user IDs.

So basically it's complaining about the default date format. Sigh. And
yes, posix says:

  The <date and time> field shall contain the appropriate date and
  timestamp of when the file was last modified. In the POSIX locale,
  the field shall be the equivalent of the output of the following date
  command:

  date "+%b %e %H:%M"

  if the file has been modified in the last six months, or:

  date "+%b %e %Y"

Which is ANNOYING but... I guess it's libc's problem to translate it. Ok...

> The offending script can be found in upstream automake here:
> 
>   http://git.savannah.gnu.org/cgit/automake.git/tree/lib/mdate-sh
> 
> An excerpt from the script:
> 
> # Because of the dummy argument above, month is in $2.
> #
> # On a POSIX system, we should have
> #
> # $# = 5
> # $1 = file size
> # $2 = month
> # $3 = day
> # $4 = year or time
> # $5 = filename
> #
> # On Darwin 7.7.0 and 7.6.0, we have
> #
> # $# = 4
> # $1 = day
> # $2 = month
> # $3 = year or time
> # $4 = filename
> 
> Toybox ls however produces an output without any day or month names,
> containing dates only in 'YYYY-MM-DD' form.

Because I don't have to translate them into Japanese, or worry about how
they're grouped (with what, if any punctuation) in other locales.

Grrr. (Is this script _setting_ the locale, or does it just randomly
fail to build for developers in other countries?)

> Cheers,
>     -Tristan

Thanks for the heads up,

Rob

 1457365623.0


More information about the Toybox mailing list