/bin/ls formatting broken for non-C(?) locales

Baptiste Daroussin bapt at FreeBSD.org
Sat Nov 21 01:57:56 UTC 2015


On Sat, Nov 21, 2015 at 03:45:29AM +0300, Andrey Chernov wrote:
> On 21.11.2015 3:35, Baptiste Daroussin wrote:
> 
> > Here is what I do propose (sorry for the ugly pad_to_col name, if one has better
> > please share :D
> > 
> > https://reviews.freebsd.org/D4239
> 
> The whole function is ugly, not only its name. Please no hardcoded
> constants assuming some internal encoding knowledge, they are wrong for
> non-UTF-8 encodings in any case, use wide chars instead.
> 
> BTW, the same 3 chars restriction is in tar, cpio, pax, lots of ftp
> clients, i.e. where 'ls' emulated.
> 
Updated to use wide char functions. tested with ru_RU.UTF-8 and ru_RU.KOI8-R,
fr_FR.UTF-8, ja_JP.eucJP and some chinese locales.

Concerning tar and cpio, I can probably push the same thing into bsdtar (which
will fix the same issue they also have on linux), ftp is safe, pax is not and
could probably be fixed as well.

FYI on linux only ls has been fixed. gnutar uses a different format for its
output.

Bapt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20151121/b95e80b8/attachment.bin>


More information about the freebsd-current mailing list