Bug 344031
Summary: | readline/bash are confused when $PS1 contains ANSI control characters | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | John Schmitt <marmalodak> |
Component: | readline | Assignee: | Miroslav Lichvar <mlichvar> |
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | low | ||
Version: | 7 | CC: | deknuydt, tim.w.connors |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2007-11-06 12:44:23 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: |
Description
John Schmitt
2007-10-20 19:41:17 UTC
Non-printable characters need to be enclosed in \[ \]. Does it work ok when NORMAL="\[\033[01;0m\]" and SCARY="\[\033[01;31m\]" ? I've had this problem with bash since 3.1. Enclosing in \[ \] indeed solves the problem, as documented in the manual, but _only_ if LANG is not set to something UTF; I guess many people have LANG=en_US.utf8 by default... I didn't see any problems with UTF8 locale, can you please provide steps to reproduce it? Adding the \[ and \] does indeed seem to relieve my symptoms. $ echo $NORMAL \[\033[01;0m\] $ echo $SCARY \[\033[01;31m\] For the record, I'm using the default locale settings: $ locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= Using the \[ and \] sequences fixes things for me so I think we can mark this as 'works for me' at least. Ok, closing as NOTABUG. Bert, please have a look at bug #358231, it's a readline bug related to locale setting. It will be this bug which *still* hasn't been included in deadrat: https://bugzilla.redhat.com/show_bug.cgi?id=463880 It only affects multiline PS1 in UTF-8 environments (the \n in the OP's first line), and is triggered by tab completion prior to using the up arrow. |