Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 242683

Summary: Bad position of cursor in bash
Product: Red Hat Enterprise Linux 5 Reporter: Stepan Kasal <kasal>
Component: bashAssignee: Tomas Janousek <tjanouse>
Status: CLOSED ERRATA QA Contact: Chris Ward <cward>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.0CC: tmraz
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0380 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-21 15:36:00 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: 241647, 380421    
Bug Blocks:    

Description Stepan Kasal 2007-06-05 13:25:03 UTC
+++ This bug was initially created as a clone of Bug #241647 +++

[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.

-- Additional comment from mlichvar on 2007-05-29 07:42 EST --
Upstream has released a patch that fixes this issue.

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

-- Additional comment from skasal on 2007-06-05 09:19 EST --
Thanks a lot!  I hope comment #1 will help the bash maintainer.

Comment 1 RHEL Program Management 2007-06-05 20:25:25 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Since this
bugzilla is in a component that is not approved for the current
release, it has been closed with resolution deferred.  You may
reopen this bugzilla for consideration in the next release.

Comment 3 Tim Waugh 2007-07-05 09:06:37 UTC
This is upstream's bash32-016 patch.


Comment 5 RHEL Program Management 2007-10-16 03:58:35 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 10 errata-xmlrpc 2008-05-21 15:36:00 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0380.html