Package: bash
Version: 3.1dfsg-8
Severity: normal

The bash builtin command "printf" is not UTF-8 aware (i.e. does not
handle UTF-8 multibyte characters). Example:

  $ /bin/bash -c 'type printf'
  printf is a shell builtin
  
  $ /bin/bash -c 'printf "!%5s!\n" a ä'
  !    a!
  !   ä!

"a" is "U+0061 LATIN SMALL LETTER A" (UTF-8: 0x61)
"ä" is "U+00E4 LATIN SMALL LETTER A WITH DIAERESIS" (UTF-8: 0xc3a4)

The problem is that the field width "%5s" is calculated wrong because
the letter "ä" takes two bytes in UTF-8 but is only one character. It
displays correctly because the terminal is UTF-8 aware.

(By the way, /usr/bin/printf [in coreutils] has the same bug.)


-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (900, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.18-5-k7
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8)

Versions of packages bash depends on:
ii  base-files             4                 Debian base system miscellaneous f
ii  debianutils            2.17              Miscellaneous utilities specific t
ii  libc6                  2.3.6.ds1-13etch4 GNU C Library: Shared libraries
ii  libncurses5            5.5-5             Shared libraries for terminal hand

bash recommends no packages.

-- no debconf information


Reply via email to