Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 131106 - readline doesnt reset prompt properly when using unicode locales and invisible chars in prompt
Summary: readline doesnt reset prompt properly when using unicode locales and invisibl...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-24 08:22 UTC by Evgeniy Dushistov
Modified: 2006-10-13 03:20 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeniy Dushistov 2006-04-24 08:22:01 UTC
How reproduce:
I have PS1 from /etc/bash/bashrc:
\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\]
and
bash-3.1_p17
with such PS1
I have such picture:
PS1 printf "a" > /tmp/1.txt
PS1 cat /tmp/1.txt
PS1

so I don't see "a",
if set ${use_color} to no
all works fine.
Comment 1 Evgeniy Dushistov 2006-04-24 08:22:50 UTC
Portage 2.0.54 (default-linux/x86/2005.0, gcc-4.1.0, glibc-2.4-r1, 2.6.15-gentoo-r1 i686)
=================================================================
System uname: 2.6.15-gentoo-r1 i686 AMD Athlon(tm) XP 2600+
Gentoo Base System version 1.6.14
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer -mfpmath=sse -msse -mmmx -m3dnow -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer -mfpmath=sse -msse -mmmx -m3dnow -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://ftp.du.se/pub/os/gentoo"
LANG="ru_RU.UTF-8"
LC_ALL=""
LINGUAS="en ru"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/home/evgeniy/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow X acl alsa apache2 apm arts audiofile avi bash-completion berkdb bitmap-fonts bzip2 cdr cjk cli crypt cups curl dlloader doc dri eds emacs emboss encode esd exif expat fam fbcon firefox flac font-server foomaticdb fortran gd gdbm gif gimpprint glut gmp gpm gstreamer gtk gtk2 gtkhtml idn imagemagick imlib ipv6 isdnlog java jpeg junit kde kdeenablefinal kdexdeltas lcms libcaca libg++ libwww logrotate lua mad maildir mhash mikmod ming mmx mng motif mp3 mpeg mysql ncurses nls nptl nptlonly ogg oggvorbis opengl oss pam pcre pdflib perl png ppds pppd python qt quicktime readline recode reflection ruby scanner sdl session slang speex spel spell spl sqlite sse ssl tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts udev unicode usb vorbis wmf xml xml2 xv xvid zlib linguas_en linguas_ru userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, INSTALL_MASK, LDFLAGS
Comment 2 SpanKY gentoo-dev 2006-04-24 15:10:31 UTC
works for me:

root@vapier 0 ~ # export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\]'
root@vapier ~ #printf "a" > foo.txt
root@vapier ~ #cat foo.txt 
aroot@vapier ~ #
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2006-04-25 02:00:35 UTC
Broken in a slightly different way for me (bash-3.1_p17)

jakub@testbox ~ $ export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\]'
jakub@testbox  ~ $printf "a" > /tmp/foo.txt
jakub@testbox  ~ $cat /tmp/foo.txt
jakub@testbox  ~ $$


su -
testbox ~ # export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\]'
root@testbox  ~ #printf "a" > /tmp/foo.txt
root@testbox  ~ #cat /tmp/foo.txt
root@testbox  ~ ##
Comment 4 Evgeniy Dushistov 2006-04-25 05:50:05 UTC
>works for me:
may be this helps:
evgeniy@rain ~ $ printf "a" > /tmp/1.txt
evgeniy@rain ~ $ cat /tmp/1.txt
evgeniy@rain ~ $ locale
LANG=ru_RU.UTF-8
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=
evgeniy@rain ~ $ export LC_ALL="C"
evgeniy@rain ~ $ cat /tmp/1.txt
aevgeniy@rain ~ $

so problem in how bash works with locale
Comment 5 SpanKY gentoo-dev 2006-05-03 19:19:24 UTC
looks like a bug in readline to me:

printf a > foo.txt
PS1='\[\e[0;33m\]\u\[\e[0m\] '

export LC_ALL=en_US
cat foo.txt    <- works

export LC_ALL=en_US.UTF8
cat foo.txt    <- fails

PS1='\u '
export LC_ALL=en_US
cat foo.txt    <- works

export LC_ALL=en_US.UTF8
cat foo.txt    <- works
Comment 6 SpanKY gentoo-dev 2006-10-12 16:29:59 UTC
you could try readline-5.2
Comment 7 Jakub Moc (RETIRED) gentoo-dev 2006-10-13 02:32:31 UTC
(In reply to comment #6)
> you could try readline-5.2

No luck here...
Comment 8 Evgeniy Dushistov 2006-10-13 03:18:12 UTC
(In reply to comment #6)
> you could try readline-5.2
> 

It works for me, but I only update to readline-5.2 is not help,
I also update bash to 3.2 and in this combination all works.
Comment 9 Evgeniy Dushistov 2006-10-13 03:20:33 UTC
(In reply to comment #8)
> (In reply to comment #6)
> > you could try readline-5.2
> > 
> 
> It works for me, but I only update to readline-5.2 is not help,
s/It works for me, but I only update to readline-5.2 is not help,/
It works for me, but update only readline to 5.2 is not help,
> I also update bash to 3.2 and in this combination all works.
> 

Thanks.