[Bug 1710981] Re: printf count utf-8 chars like arrow wrong
H.-Dirk Schmitt
dirk at computer42.org
Tue Aug 15 21:29:09 UTC 2017
The bug leads to ugly output on the console if the data contains such characters.
See the 3rd song in the following play queue listing:
--------------------------------------------------------------------
Pos. Artist Title Dur.
--------------------------------------------------------------------
1. Bryan Adams I'm Ready 4:26
2. Toto Mrs. Johnson 3:48
3. The Doobie Brothers Long Train Runnin’ 3:39
4. Three Dog Night One 3:02
5. Norman Greenbaum Spirit in the Sky 3:51
--------------------------------------------------------------------
** Bug watch added: Debian Bug tracker #872295
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=872295
** Also affects: bash (Debian) via
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=872295
Importance: Unknown
Status: Unknown
** Also affects: coreutils (Debian) via
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=872295
Importance: Unknown
Status: Unknown
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/1710981
Title:
printf count utf-8 chars like arrow wrong
Status in bash package in Ubuntu:
New
Status in coreutils package in Ubuntu:
New
Status in bash package in Debian:
Unknown
Status in coreutils package in Debian:
Unknown
Bug description:
The printf command in bash (builtin) and corutils /usb/bin/printf have an error in counting the length of a string, if a non-ascii character is involved.
Example is the arrow - type Alt+I.
Try the following commands:
printf -v r "%-2s X\n" '→' ; echo ${#r} # prints 4
printf -v r "%-2s X\n" ' ' ; echo ${#r} # prints 5
The coreutils version of printf has the same misbehaviour.
ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: coreutils 8.25-2ubuntu3~16.04
ProcVersionSignature: Ubuntu 4.10.0-32.36~16.04.1-generic 4.10.17
Uname: Linux 4.10.0-32-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.10
Architecture: amd64
CurrentDesktop: GNOME
Date: Tue Aug 15 23:05:40 2017
SourcePackage: coreutils
UpgradeStatus: No upgrade log present (probably fresh install)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1710981/+subscriptions
More information about the foundations-bugs
mailing list