Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 188269 - Problem with bash readline and rxvt-unicode
Summary: Problem with bash readline and rxvt-unicode
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-09 21:10 UTC by Martin von Gagern
Modified: 2010-01-04 19:18 UTC (History)
6 users (show)

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


Attachments
Animation demonstrating the issue (anim2.gif,80.39 KB, image/gif)
2007-08-17 19:12 UTC, Martin von Gagern
Details
Log of pty traffic for demo session (log2.txt,3.10 KB, text/plain)
2007-08-17 19:20 UTC, Martin von Gagern
Details
Patch that allows logging of pty reads (tt_read.patch,1.73 KB, patch)
2007-08-17 19:24 UTC, Martin von Gagern
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2007-08-09 21:10:02 UTC
When I have some output without linebreak at the end in front of my bash prompt and enter a long command that wraps to the next line, I can get back into the first line but I can't return to the second line, and trying to do so completely confuses cursor positioning; from then on the cursor will be displayed in a different position than bash thinks it is. Occurs only in UTF-8 locale.

Reproducible: Always

Steps to Reproduce:
1. LC_CTYPE="en_US.utf8" urxvt
2. echo -n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3. enter some random words
4. press Home or Ctrl+A
5. press End or Ctrl+E or hold down the right cursor key
6. hold down the left arrow key
7. enter some more words
8. press Ctrl+L
9. press Home or Ctrl+A

Actual Results:  
5. the cursor will not move past the line wrap
6. the cursor will move into the prompt and maybe even into the text from 1.
7. the text will be displayed where the cursor is, but buffered somewhere else
8. the redrawn screen will show the buffered text
9. the cursor position is still wrong, this time too far to the right

Expected Results:  
5. cursor position crossing the line wrap in both directions
6. cursor should always be displayed where bash thinks it is
7. text should always be displayed where bash inserts it
9. redrawing the screen should correct cursor position as well if possible

I'm not sure whose bug this is. bash? readline? rxvt-unicode? ncurses?
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-08-10 09:46:22 UTC
Cannot reproduce this at all; which versions you have installed?

app-shells/bash-3.2_p17-r1
sys-libs/readline-5.2_p4
x11-terms/rxvt-unicode-8.2

Comment 2 Martin von Gagern 2007-08-10 14:53:55 UTC
(In reply to comment #1)
> Cannot reproduce this at all;

Try this instead of step 1 above:

env -i DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY LC_CTYPE="en_US.utf8" \
       PS1='\[\033[34m\]\u@\h:\w \$\[\033[00m\] ' urxvt -name urxvt-debug

It seems that the use of escape sequences in PS1 has some influence.
Also make sure that "locale -a | grep en_US.utf8" lists that locale.

> which versions you have installed?

I had app-shells/bash-3.2_p17 but updating to -r1 didn't help. readline and rxvt-unicode I've got the same, although I even tried rxvt-unicode-8.3 (bump requested in bug 188268) but that didn't make a difference either.
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2007-08-10 15:47:11 UTC
(In reply to comment #2)
> Try this instead of step 1 above:

No, no luck at all, behaves perfectly fine.
Comment 4 Martin von Gagern 2007-08-10 16:15:09 UTC
(In reply to comment #3)
> No, no luck at all, behaves perfectly fine.

That is really strange!

I just added "-e bash --norc --noprofile" to the command line, but no luck there either. Now I really begin to believe it might be due to some compiler switches or some such. Question is again, which of these packages? Recompiling them all with probably lots of different settings feels like a lot of work. Will have to wait till next week at least.
Comment 5 Martin von Gagern 2007-08-17 19:12:35 UTC
Created attachment 128427 [details]
Animation demonstrating the issue
Comment 6 Martin von Gagern 2007-08-17 19:20:00 UTC
Created attachment 128429 [details]
Log of pty traffic for demo session

This log displays all the traffic between the terminal and bash.
Lines starting with > are output from bash, whereas lines starting with < (and indented) are input typed into the terminal window.
This conversation was recorded in the same session as the attached GIF animation.
Comment 7 Martin von Gagern 2007-08-17 19:24:17 UTC
Created attachment 128430 [details, diff]
Patch that allows logging of pty reads

This patch was used to create the attached conversation log.
It introduces a perl hook on_tt_read analogous to on_tt_write that receives the raw octets read from the child process. The included script can be run by passing the command line arguments "--perl-lib ${WORKDIR}/src/perl -pe mvgdbg". It will write a conversation log like the one attached to /tmp/mvgdbg.txt
Comment 8 SpanKY gentoo-dev 2008-01-02 15:09:33 UTC
you can retry with 3.2_p33 as it has some invisible byte fixes
Comment 9 Martin von Gagern 2008-02-18 22:44:19 UTC
(In reply to comment #8)
> you can retry with 3.2_p33 as it has some invisible byte fixes

Ctrl+L seems to work better now, so steps 8 and 9 are fixed now. The others remain.
Comment 10 Rafał Mużyło 2008-11-24 17:41:39 UTC
Recently a bug was fixed in readline, that seems to be the cause of
this problem (5.2_p13).

See, if it's fixed.
Comment 11 Alex Alexander (RETIRED) gentoo-dev 2009-11-11 20:16:58 UTC
Can anyone check if this bug still exists?

I can't reproduce it.

Thanks
Comment 12 Alex Alexander (RETIRED) gentoo-dev 2009-12-31 01:15:01 UTC
its been a while since this bug got any significant updates and I can't reproduce it, so I'm closing it.
Comment 13 Martin von Gagern 2010-01-04 19:18:05 UTC
Sorry I haven't replied before. Still can reproduce this.