bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

inconsistency characters/bytes in read and ${#foo}


From: Stanislav Brabec
Subject: inconsistency characters/bytes in read and ${#foo}
Date: Tue, 15 May 2007 17:23:46 +0200

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc -I/usr/src/packages/BUILD/bash-3.1 
-L/usr/src/packages/BUILD/bash-3.1/../readline-5.1
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-suse-linux-gnu' 
-DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -O2 -fmessage-length=0 -Wall 
-D_FORTIFY_SOURCE=2 -g -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -pipe -g -fPIE 
-fbranch-probabilities
uname output: Linux hammer 2.6.18.8-0.3-xen #1 SMP Tue Apr 17 08:42:35 UTC 2007 
x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-suse-linux-gnu

Bash Version: 3.1
Patch Level: 17
Release Status: release

Description:
        There is an inconsistence between read -n and ${#var} in string
        length computing - read -n uses bytes, but ${#var} uses
        characters.

Repeat-By:
        set UTF-8 locale
        while : ; do read -n 2 ; echo ${#REPLY} ; done
        [Now type two ASCII characters.]
        2
        [Now type any character outside ASCII.]
        1

Fix:
        Use characters in read command or at least provide option to
        support it.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]