Bug 358231 - PS1='\[\017\]xyz' breaks the prompt
PS1='\[\017\]xyz' breaks the prompt
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: bash (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tomas Janousek
Fedora Extras Quality Assurance
:
Depends On: 241647
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-30 10:29 EDT by Jan Kratochvil
Modified: 2008-01-11 17:04 EST (History)
3 users (show)

See Also:
Fixed In Version: 3.2-19.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-01-11 17:04:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jan Kratochvil 2007-10-30 10:29:11 EDT
Description of problem:
My standard PS1 positions cursor incorrectly in the prompt.
It may be a readline specific bug.

Version-Release number of selected component (if applicable):
bash-3.2-18.fc8.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. PS1='\[\017\]xyz'
2. LC_CTYPE=en_US.UTF-8
  
Actual results:
Prompt cursor position is at the character 'z'.

Expected results:
Prompt cursor position is right behind the character 'z'.

Additional info:
\017 should set the standard character map to fixup terminal after a possible:
$ cat GARBAGE
Comment 1 Miroslav Lichvar 2007-11-02 09:10:58 EDT
This occurs only when the prompt has one invisible character and it's the first
character in the prompt. The following patch fixes the problem.

--- readline-5.2/display.c.inv
+++ readline-5.2/display.c
@@ -943,7 +943,7 @@ rl_redisplay ()
                  cpos_adjusted == 0 &&
                  _rl_last_c_pos != o_cpos &&
                  _rl_last_c_pos > wrap_offset &&
-                 o_cpos < prompt_last_invisible)
+                 o_cpos <= prompt_last_invisible)
                _rl_last_c_pos -= wrap_offset;

              /* If this is the line with the prompt, we might need to
Comment 2 Fedora Update System 2007-11-28 20:32:44 EST
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 3 Fedora Update System 2007-11-28 20:37:06 EST
bash-3.2-19.fc8 has been pushed to the Fedora 8 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 4 Fedora Update System 2008-01-11 17:04:30 EST
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.
Comment 5 Fedora Update System 2008-01-11 17:04:55 EST
bash-3.2-19.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.