Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
bash-completion failes if directory has spaces
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
miriya
n00b
n00b


Joined: 16 Jan 2008
Posts: 36

PostPosted: Thu Jul 23, 2015 3:18 am    Post subject: bash-completion failes if directory has spaces Reply with quote

I searched around on the forum and I haven't found any question to address this yet. After updating my system and installing what I believe to be the most recent bash-completion package (version 2.1_p20141224) auto-completion of directories and files doesn't seem to work if there are any spaces. For example, no amount of hitting tab will get this

Code:
cd /mydocs/misc\ files/


to tab-complete any further. Does anyone know what I could do to fix it? I'm happy to provide any additional details about my system configuration. Please let me know what would be the most helpful.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 6446
Location: almost Mile High in the USA

PostPosted: Fri Jul 24, 2015 6:33 pm    Post subject: Reply with quote

I don't have bash-completion installed and spaces in filenames and directorynames seem to auto detect and escape...
I've never used bash-completion, are there special rules in there that may affect this?

And just to be complete, are you sure you don't have another directory called misc-something-something?
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
russK
Guru
Guru


Joined: 27 Jun 2006
Posts: 522

PostPosted: Fri Jul 24, 2015 11:17 pm    Post subject: Reply with quote

Same here. Worksforme. I don't have bash-completion installed, and my tab key completes names with spaces without a hitch.

I never noticed before, but BASHOPTS has some settings in it that are relevant, have you set or changed your BASHOPTS? Here's mine:

Code:
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:expand_aliases:extquote:force_fignore:histappend:hostcomplete:interactive_comments:no_empty_cmd_completion:progcomp:promptvars:sourcepath
Back to top
View user's profile Send private message
Satuya Lekany
n00b
n00b


Joined: 26 Jul 2015
Posts: 1

PostPosted: Mon Jul 27, 2015 12:48 am    Post subject: Reply with quote

I have the same issue.

I have app-shells/bash-4.3_p39 and app-shells/bash-completion-2.1_p20141224.

Related bug on Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=740971

The patch of Chet Ramey (Bash upstream maintainer) in message #42 (at the bottom of his message, "pcomplete-dequote") as been officialized as "bash43-010" (available officially here: https://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-010).

So on Gentoo, it should be present if you have >=app-shells/bash-4.3_p10.

I have the last version, app-shells/bash-4.3_p39, and the patch is indeed in /usr/portage/distfiles/bash43-010, and I suppose it is applied properly.

The problem is, with app-shells/bash-completion-2.1_p20141224 (latest version on Gentoo), it still doesn't work, or doesn't work anymore :/

It can be tested with:

Code:
mkdir /tmp/foo
cd /tmp/foo
mkdir "abc def" "abc ghi"
cd <Tab>


The shell properly starts completing with "abc\ ", and returns both directories as suggestions to continue the completion. But if now I press 'd', then the tabulation key again, nothing happens anymore, instead of finishing the completion to "abc\ def"...

Note it works with `ls` and `rm`. But not with `cd` or `rmdir`, for example.

Removing bash-completion makes it work, but I want bash-completion for its many additional rules (e.g., "cd <TAB>" will only complete directories, "mplayer <TAB>" will only complete video files, etc.).

I could try to downgrade bash-completion to test if a more recent change caused a new issue, but as there as been file location changes recently, I would prefer not having to deal with this in reverse, with the risk of having to downgrade many other packages to make it work...

It remains the possibility of upgrading to a new snapshot.

Their Git info: http://bash-completion.alioth.debian.org/#download

I don't have time to test it anytime soon though.

Some old Gentoo bug report has been recently highjacked by someone else: https://bugs.gentoo.org/show_bug.cgi?id=417929... no reply though. A new report should be posted, if there are no more recent ones (>=2014), as it is a more recent problem.

There are two workarounds:

- The first one, as per message #17 on the Debian report, is to prefix a single quote character. In my example: "cd '<Tab>", then 'd', and it will complete properly to "'abc def'/".

- The second one is to force Bash native filename completion, using the M-/ keys (that is <Alt+/> in general... using <Shift> on AZERTY keyboards if needed to access the slash character). So: "cd <Tab>", then 'd', then <Alt+/>. It's a useful key combination to know about, when you want to complete filenames, and bash-completion rules are not flexible enough, or not updated, and refuse to complete the string as a filename. But it's not as simple as pressing <Tab>, so the issue should still be solved properly.


Thanks in advance to anyone who may work on this.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum