Bug 1252138 - space in directory name breaks tab completion
space in directory name breaks tab completion
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: bash-completion (Show other bugs)
22
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ville Skyttä
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-10 15:33 EDT by Erik M Jacobs
Modified: 2015-08-14 15:56 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-14 15:56:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Erik M Jacobs 2015-08-10 15:33:22 EDT
Description of problem:
If a directory has a space in its name, subdirectories cannot be tab completed.

Version-Release number of selected component (if applicable):
bash 4.3.33-2.fc22
bash-completion 2.1-6.20141110git52d8316.fc22

How reproducible:
100%

Steps to Reproduce:
1. mkdir -p ~/Red\ Hat/foo/bar
2. type "~/Red" and try to tab complete

Actual results:
Shell dings/bell but no completion occurs

Expected results:
Tab completion should work.

Additional info:
Comment 1 Ville Skyttä 2015-08-11 11:05:19 EDT
Works fine for me in F-22.

If there are issues with the completion in your step 2, it's unlikely that bash-completion would be involved as there's no command to complete yet, hence it's all bash at that point --> reassigning to bash.
Comment 2 Ondrej Oprala 2015-08-13 09:59:36 EDT
No issue whatsoever on my side, if this is reliably reproducible to you, you'll have to provide more details.
Comment 3 Erik M Jacobs 2015-08-13 10:19:11 EDT
I'm happy to provide more details. What details would you like?

Doesn't work:
[thoraxe@t440 ~]$ mkdir -p ~/Space\ Directory/foo/bar
[thoraxe@t440 ~]$ cd ~/Space

When I hit "tab" I get:

[thoraxe@t440 ~]$ cd ~/Space\ Directory/

Then if I type "f" and hit tab:

[thoraxe@t440 ~]$ cd ~/Space\ Directory/f

I just get bells/dings. It doesn't complete to "foo"

Works:
[thoraxe@t440 ~]$ mkdir -p ~/nospace/foo/bar
[thoraxe@t440 ~]$ cd ~/no

tab

[thoraxe@t440 ~]$ cd ~/nospace/
[thoraxe@t440 ~]$ cd ~/nospace/f

tab

[thoraxe@t440 ~]$ cd ~/nospace/foo/

Other info:
[thoraxe@t440 ~]$ cat ~/.bashrc ~/.bash_profile 
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
alias lqp='source ~/liquidprompt/liquidprompt'
alias vim='vimx'
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

[thoraxe@t440 ~]$ env
XDG_VTNR=2
XDG_SESSION_ID=1
HOSTNAME=t440
GPG_AGENT_INFO=/run/user/1000/keyring/gpg:0:1
TERM=xterm-256color
SHELL=/bin/bash
VTE_VERSION=4002
XDG_MENU_PREFIX=gnome-
HISTSIZE=1000
GJS_DEBUG_OUTPUT=stderr
WINDOWID=31458300
QTDIR=/usr/lib64/qt-3.3
QTINC=/usr/lib64/qt-3.3/include
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
QT_GRAPHICSSYSTEM_CHECKED=1
USER=thoraxe
LS_COLORS=rs=0:di=38;5;33:ln=38;5;51:mh=00: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=01;05;37;41: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;40:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=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:*.webm=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:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.m4a=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:*.oga=38;5;45:*.opus=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/2098,unix/unix:/tmp/.ICE-unix/2098
USERNAME=thoraxe
PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/thoraxe/.rvm/bin:/home/thoraxe/.local/bin:/home/thoraxe/bin
MAIL=/var/spool/mail/thoraxe
DESKTOP_SESSION=gnome
QT_IM_MODULE=ibus
XDG_SESSION_TYPE=x11
PWD=/home/thoraxe
XMODIFIERS=@im=ibus
LANG=en_US.UTF-8
MODULEPATH=/etc/scl/modulefiles:/etc/scl/modulefiles:/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles
GDM_LANG=en_US.UTF-8
LOADEDMODULES=
KDEDIRS=/usr
GDMSESSION=gnome
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HISTCONTROL=ignoredups
HOME=/home/thoraxe
SHLVL=2
XDG_SEAT=seat0
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
XDG_SESSION_DESKTOP=gnome
LOGNAME=thoraxe
QTLIB=/usr/lib64/qt-3.3/lib
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-YJ5yiBZV7A,guid=013d922b4d3bb749a215132a55cb3877
MODULESHOME=/usr/share/Modules
LESSOPEN=||/usr/bin/lesspipe.sh %s
WINDOWPATH=2
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:0
XDG_CURRENT_DESKTOP=GNOME
XAUTHORITY=/run/user/1000/gdm/Xauthority
BASH_FUNC_module()=() {  eval `/usr/bin/modulecmd bash $*`
}
BASH_FUNC_scl()=() {  local CMD=$1;
 if [ "$CMD" = "load" -o "$CMD" = "unload" ]; then
 eval "module $@";
 else
 /usr/bin/scl "$@";
 fi
}
OLDPWD=/home/thoraxe
_=/usr/bin/env

[thoraxe@t440 ~]$ rpm -V bash
[thoraxe@t440 ~]$ 

[thoraxe@t440 ~]$ rpm -qa | grep bash
bash-4.3.33-2.fc22.x86_64
bash-completion-2.1-6.20141110git52d8316.fc22.noarch
Comment 4 Ville Skyttä 2015-08-14 03:15:41 EDT
(In reply to Erik M Jacobs from comment #3)
> Doesn't work:
> [thoraxe@t440 ~]$ mkdir -p ~/Space\ Directory/foo/bar
> [thoraxe@t440 ~]$ cd ~/Space
> 
> When I hit "tab" I get:
> 
> [thoraxe@t440 ~]$ cd ~/Space\ Directory/
> 
> Then if I type "f" and hit tab:
> 
> [thoraxe@t440 ~]$ cd ~/Space\ Directory/f
> 
> I just get bells/dings. It doesn't complete to "foo"

I'd just like to note that this is a different use case than in the initial comment. Now you're invoking "cd $something" whereas in the initial one it was directly "$something". And since you now do invoke it with cd, bash-completion is involved again. But that use case works just fine for me too.

I suggest first removing bash-completion temporarily and seeing if that makes any difference to your test cases. (Make sure to get a new shell after removing bash-completion when you test so the old already loaded one won't kick in.)
Comment 5 Erik M Jacobs 2015-08-14 15:13:06 EDT
With bash-completion removed, if I use ctrl-alt-f3 to go to a new window and login, I can successfully tab-complete directory names with cd.
Comment 6 Ville Skyttä 2015-08-14 15:32:18 EDT
You mean directory names with spaces in them, and it doesn't work if bash-completion is installed? If that's so, please reassign back to bash-completion and do this in a shell where the completion fails:

set -x
# invoke the completion
set +x

...and attach the output here.
Comment 7 Erik M Jacobs 2015-08-14 15:56:15 EDT
Today I cannot seem to make it not work... so, I'm not sure. Closing until I can reproduce.

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