Bug 241647

Summary: Bad position of cursor in bash
Product: [Fedora] Fedora Reporter: Stepan Kasal <kasal>
Component: bashAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7CC: bugzilla, jan.kratochvil, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 3.2-19.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-01-11 22:04:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 242683, 358231    

Description Stepan Kasal 2007-05-29 10:42:40 UTC
[This is a problem with readline compiled into bash; I chose to file it against
readline, hoping that its maintainer might know how to fix it. ;-]

Description of problem:
The cursor position is wrong after serach in commandline history.

Version-Release number of selected component (if applicable):
$ rpm -q bash && bash --version
bash-3.1-16.1
GNU bash, version 3.1.17(1)-release (i686-redhat-linux-gnu)

How reproducible:
always

Steps to Reproduce:
0. bash
1. LC_CTYPE=en_US.UTF-8
2. PS1='\[\e[?17;15;175c\]{some_ps1_text}:'
3. ctrl-R (start incremental search backwards)
4. ctrl-G (cancel it)

Expected results:
The cursor shall be positioned just after the prompt text.

Actual results:
The cursor is positioned on letter `m' in the middle of the prompt text
`{some_ps1_text}:'.

Additional info:
Note that my PS1 contains a non-printing control sequence; it is enclosed in
\[...\] pair, to tell readline about it. With C locale, this mechanism works,
but it seems it does not work with utf-8 locales.

Actually the cursor is positioned 13 characters to the left from the correct
position.  And 13 is the length of the non-printing sequence in the prompt.  I
have tried a shorter non-printing sequence and again, the skew was equal to its
length.

Comment 1 Miroslav Lichvar 2007-05-29 11:42:38 UTC
Upstream has released a patch that fixes this issue.

ftp://ftp.cwru.edu/pub/bash/readline-5.2-patches/readline52-004

Comment 2 Stepan Kasal 2007-06-05 13:19:38 UTC
Thanks a lot!  I hope comment #1 will help the bash maintainer.

Comment 3 Jan Kratochvil 2007-07-04 18:43:25 UTC
Still valid for F7 bash-3.2-9.fc7.


Comment 4 Jan Kratochvil 2007-07-04 18:45:59 UTC
*** Bug 155444 has been marked as a duplicate of this bug. ***

Comment 5 Tim Waugh 2007-07-05 10:06:04 UTC
I've just built bash-3.2-11.fc8 in devel which brings it to patchlevel 17.

Comment 6 Fedora Update System 2007-11-29 01:32:42 UTC
bash-3.2-19.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update bash'

Comment 7 Fedora Update System 2008-01-11 22:04:28 UTC
bash-3.2-19.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.