[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Prompt overwrites output when UTF-8 is enabled
From: |
Benjamin A. Okopnik |
Subject: |
Prompt overwrites output when UTF-8 is enabled |
Date: |
Sat, 26 Apr 2003 20:50:25 -0400 |
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu'
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H -I.
-I/build/packages/bash/bash-2.05b -I/build/packages/bash/bash-2.05b/include
-I/build/packages/bash/bash-2.05b/lib -g -O2
uname output: Linux Fenrir.Thor 2.4.18 #2 Wed Mar 19 17:57:50 EST 2003 i686
unknown unknown GNU/Linux
Machine Type: i386-pc-linux-gnu
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
When LANG is set to a UTF-8 locale (tested with en_US.UTF-8, tested by
another correspondent with en_GB.UTF-8), "bash" overwrites the output with
its prompt string, even if the string is longer than the prompt. (This can
be, umm, interesting when you're troubleshooting a program...)
Repeat-By:
(The output below is all from the console; thus the 80-character wrap.)
ben@Fenrir:~$ locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
ben@Fenrir:~$ echo -n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ben@Fenrir:~$
### Watch *this* carefully - the special effects are really expensive:
ben@Fenrir:~$ perl -we'print "a" x 80'
ben@Fenrir:~$ perl -we'print "a" x 81'
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ben@Fenrir:~$
Fix:
"strace"ing bash when in UTF-8 vs. non-UTF-8 mode shows the following:
----------------------------------------------------------------------
# UTF8 case; much redundancy in what bash writes to the terminal
# (the prompt is written twice over itself on the same line).
write(2, "\rfakir@wallace:~$ echo -n hello\r"..., 62) = 62
read(0, "\r", 1) = 1 # <ENTER> hit
write(2, "\n", 1) = 1
write(1, "hello", 5) = 5
write(2, "\r\rfakir@wallace:~$ \rfakir@wallac"..., 37) = 37
^^^^ ^^
----------------------------------------------------------------------
# Non-UTF8 case; bash writes the command line one character at a time
# (not shown here), except the prompt itself.
read(0, "\r", 1) = 1 # <ENTER> hit
write(2, "\n", 1) = 1
write(1, "hello", 5) = 5
write(2, "fakir@wallace:~$ ", 17) = 17
----------------------------------------------------------------------
Please note the "^^^" marks showing the problem. I'm too rusty at C to go
hunt through the code and write the patch... sorry, guys.
Regards,
Ben Okopnik
-=-=-=-=-=-
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Prompt overwrites output when UTF-8 is enabled,
Benjamin A. Okopnik <=