Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1062800

Summary: abbreviated current directory in shell prompt fails
Product: [Fedora] Fedora Reporter: Terry Moschou <tmoschou>
Component: bashAssignee: Ondrej Oprala <ooprala>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: admiller, ooprala, ovasik, toon.verstraelen
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-20 10:09:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Terry Moschou 2014-02-08 03:08:31 UTC
Description of problem:
The bash feature to abbreviate the current directory in shell prompt through the use of the PROMPT_DIRTRIM environment variable fails to print (spell) the retained directories correctly and directory separators correctly. 

Version-Release number of selected component (if applicable):
bash-4.2.45-4.fc20.x86_64

Reproduces exact output each time

Steps to reproduce:

My environment:
PS1='\[\e[1;34m\]\u@\h\[\e[0;1m\]:$?:\[\e[1;32m\]\w\$ \[\e[0m\]'
PROMPT_DIRTRIM=5


Example bash output with prompt:

terry@fedora-vaio:0:~$ cd devel/src/git/kde/kdeclarative/
terry@fedora-vaio:0:~/devel/src/git/kde/kdeclarative$ cd src/
terry@fedora-vaio:0:~/.../src/git/kde/edeclarative/src$ cd private/
terry@fedora-vaio:0:~/.../e/kdeclarsrc/prirc/privaterivate$ pwd
/home/terry/devel/src/git/kde/kdeclarative/src/private
terry@fedora-vaio:0:~/.../e/kdeclarsrc/prirc/privaterivate$ unset PROMPT_DIRTRIM 
terry@fedora-vaio:0:~/devel/src/git/kde/kdeclarative/src/private$ PROMPT_DIRTRIM=4
terry@fedora-vaio:0:~/.../kde/kdeclarative/src/private$ PROMPT_DIRTRIM=5
terry@fedora-vaio:0:~/.../e/kdeclarsrc/prirc/privaterivate$ 


Actual results:
abbreviated dir is 
~/.../src/git/kde/edeclarative/src
~/.../e/kdeclarsrc/prirc/privaterivate


Expected results:
~/.../src/git/kde/kdeclarative/src
~/.../git/kde/kdeclarative/src/private

Comment 1 Ondrej Oprala 2014-04-01 10:16:36 UTC
Hmm, I can't reproduce it on my end. Could you please give a full printenv output?
Also, is this still reproducible with bash-4.3 in rawhide?
Thanks

Comment 2 Toon Verstraelen 2014-04-11 03:10:35 UTC
I'm having the same problem.  Bash version 4.2.46(1).

Example:

toon@molmod49 ~> cd /usr/lib/mozilla/extensions/
toon@molmod49 .../lib/moilla/exttensions> printenv

XDG_SESSION_ID=9
HOSTNAME=molmod49.ugent.be
SELINUX_ROLE_REQUESTED=
TERM=xterm-256color
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=157.193.98.20 57302 45971
SELINUX_USE_CURRENT_RANGE=
QTDIR=/usr/lib64/qt-3.3
QTINC=/usr/lib64/qt-3.3/include
PROMPT_DIRTRIM=3
SSH_TTY=/dev/pts/1
QT_GRAPHICSSYSTEM_CHECKED=1
USER=toon
LS_COLORS=rs=0:di=38;5;27:ln=38;5;51:mh=44;38;5;15:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=05;48;5;232;38;5;15:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;34:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.Z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.axv=38;5;13:*.anx=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.axa=38;5;45:*.oga=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:
MAIL=/var/spool/mail/toon
PATH=/home/toon/bin:/home/toon/.local/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
PWD=/usr/lib/mozilla/extensions
XMODIFIERS=@im=ibus
LANG=en_US.utf8
MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles:/home/toon/.local/easybuild/modules/all:/home/toon/modules
LOADEDMODULES=
PS1=\[\033[1;32m\]\u@\h\[\033[00m\] \[\033[1;34m\]\w\[\033[00m\]\[\033[1;33m\]$(__git_ps1 ":%s")\[\033[1;34m\]>\[\033[00m\] 
SELINUX_LEVEL_REQUESTED=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/home/toon
LOGNAME=toon
QTLIB=/usr/lib64/qt-3.3/lib
SSH_CONNECTION=157.193.98.20 57302 157.193.118.150 45971
MODULESHOME=/usr/share/Modules
LESSOPEN=||/usr/bin/lesspipe.sh %s
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=localhost:11.0
module=() {  eval `/usr/bin/modulecmd bash $*`
}
OLDPWD=/home/toon
_=/usr/bin/printenv

Comment 3 Terry Moschou 2014-04-13 01:15:19 UTC
This issue appears to be fixed (somehow) in rawhide
  bash-4.3.8-1.fc21
though the current release 
  bash-4.2.46-4.fc20
still experiences issues.

Can a fix be made for fc20?

Comment 4 Ondrej Oprala 2014-05-19 08:13:57 UTC
This should be fixed by an official patchlevel 47. Are you still experiencing the issue after updating to bash-4.2.47-2?

Comment 5 Toon Verstraelen 2014-05-20 10:01:21 UTC
It works for me. Thank you!

Comment 6 Ondrej Oprala 2014-05-20 10:09:34 UTC
Glad to hear it :)