GNU bug report logs -
#50336
Width format specifier is calculated wrong for nb_NO locale
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50336 in the body.
You can then email your comments to 50336 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#50336
; Package
coreutils
.
(Thu, 02 Sep 2021 14:59:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Carl-Erik Kopseng <carlerik <at> diffia.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Thu, 02 Sep 2021 14:59:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I just noticed that the width specifier for numeric parameters does some
weird calculations when the specified locale is `nb_NO.utf8`. For instance,
the number formatting rules for US and NO both result in the same number of
characters (with ' ' instead of ','), but the Norwegian version lacks two
spaces in the padded output. This must be a bug, no?
```
$ LC_NUMERIC=en_US.utf8 printf "%'7d%s\n" 1234 XXX
1,234XXX
$ LC_NUMERIC=nb_NO.utf8 printf "%'7d%s\n" 1234 XXX
1 234XXX
```
Package: coreutils
Essential: yes
Priority: required
Section: utils
Installed-Size: 8248
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss <at> lists.ubuntu.com>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Architecture: amd64
Multi-Arch: foreign
Version: 8.32-4ubuntu2
Pre-Depends: libacl1 (>= 2.2.23), libattr1 (>= 1:2.4.44), libc6 (>= 2.32),
libgmp10, libselinux1 (>= 3.1~)
Filename: pool/main/c/coreutils/coreutils_8.32-4ubuntu2_amd64.deb
Size: 1353100
MD5sum: 1818b348429f95bffb99fe80bf965b5c
Description: GNU core utilities
Original-Maintainer: Michael Stone <mstone <at> debian.org>
SHA1: d56d97d420f317d7988e77e957bce95c630bc20a
SHA256: 1c04fd5a7d4f343beed3b56e37c105f5dffbc58728ab3a6d6bd05bfab8ab289c
SHA512:
b2ef6a601307cadfcd6bf072e59a306d54267294bdd635fab44f70b0cdccb871b64c15644fac0fdd342e4a1eb19145f155588ba97ede04ba683d5bf72c9995c4
Homepage: http://gnu.org/software/coreutils
Task: minimal
Description-md5: d0d975dec3625409d24be1238cede238
--
Carl-Erik Kopseng
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#50336
; Package
coreutils
.
(Thu, 02 Sep 2021 15:16:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 50336 <at> debbugs.gnu.org (full text, mbox):
tag 50336 notabug
close 50336
stop
On 02/09/2021 13:49, Carl-Erik Kopseng wrote:
> I just noticed that the width specifier for numeric parameters does some
> weird calculations when the specified locale is `nb_NO.utf8`. For instance,
> the number formatting rules for US and NO both result in the same number of
> characters (with ' ' instead of ','), but the Norwegian version lacks two
> spaces in the padded output. This must be a bug, no?
>
> ```
> $ LC_NUMERIC=en_US.utf8 printf "%'7d%s\n" 1234 XXX
> 1,234XXX
>
> $ LC_NUMERIC=nb_NO.utf8 printf "%'7d%s\n" 1234 XXX
> 1 234XXX
> ```
Note one must be careful with printf as there is a
shell builtin often in consideration here.
That's not at issue here tough as both the shell
and coreutils call down to libc printf implementation.
The particular issue is the grouping char used
in the nb_NO.utf8 locale is multi-byte.
Specifically: e2 80 af
So that character counts as 3 bytes,
and the printf implementation is counting bytes,
not characters, or display cells.
Given the usual consideration is display width,
it probably should be considering display cells,
but that's an issue for libc, not coreutils.
Note coreutils does need to handle alignment in various places,
and for that it uses the following module to more
generally handle this:
https://github.com/coreutils/coreutils/blob/master/gl/lib/mbsalign.c
closing this as not a coreutils specific bug.
cheers,
Pádraig
Added tag(s) notabug.
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Thu, 02 Sep 2021 15:16:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
50336 <at> debbugs.gnu.org and Carl-Erik Kopseng <carlerik <at> diffia.com>
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Thu, 02 Sep 2021 15:16:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 01 Oct 2021 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 319 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.