[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coreutils 'ls' fix for multibyte user and group names
From: |
Jim Meyering |
Subject: |
Re: coreutils 'ls' fix for multibyte user and group names |
Date: |
Tue, 22 Jun 2004 14:50:42 +0200 |
Paul Eggert <address@hidden> wrote:
> coreutils 'ls' mishandles user or group names that contain multibyte
> characters where the number of columns is not equal to the number of
> bytes. For example, if a user name is "castaneda" (except that the
> "n" has a tilde over it), and if the current locale is en_US.utf8,
> then the n-with-a-tilde consumes two bytes but only one print column.
> Current GNU "ls -l" outputs something like this:
>
> -rw-r--r-- 1 eggert eggert 4127 2004-06-12 23:18 file1
> -rw-r--r-- 1 castaneda eggert 753 2004-06-20 23:58 file2
>
> (again, where the "n" in "castaneda" has a tilde over it), so the
> columns don't line up. With the patch proposed below, the output
> looks like this instead:
>
> -rw-r--r-- 1 eggert eggert 4127 2004-06-12 23:18 file1
> -rw-r--r-- 1 castaneda eggert 753 2004-06-20 23:58 file2
>
> 2004-06-21 Paul Eggert <address@hidden>
>
> Fix bug: GNU 'ls' didn't count columns correctly if user or group
> names contained multibyte characters where the column count
> differed from the byte count. This patch also corrects
> some comments.
>
> * src/ls.c (format_user_or_group): New function, which counts
> columns correctly.
> (format_user, format_group): Use it.
> (format_user_or_group_width): New function, which counts columns
> correctly.
> (format_user_width, format_group_width): Use it.
Nice one. Thanks!
I've applied that.