Bug 358231

Summary: PS1='\[\017\]xyz' breaks the prompt
Product: [Fedora] Fedora Reporter: Jan Kratochvil <jan.kratochvil>
Component: bashAssignee: Tomas Janousek <tjanouse>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: mlichvar, tmraz, twaugh
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:38 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    
Bug Blocks:    

Description Jan Kratochvil 2007-10-30 14:29:11 UTC
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 13:10:58 UTC
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-29 01:32:44 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 3 Fedora Update System 2007-11-29 01:37:06 UTC
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 22:04:30 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.

Comment 5 Fedora Update System 2008-01-11 22:04:55 UTC
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.