← Back to team overview

canonical-partner-dev team mailing list archive

[Bug 769866] Re: tab completion no longer escapes filenames and completes dirnames incorrectly (space instead of slash)

 

My situation is a little bit different, and I believe some others share my situation.
By applying the fix in #10, it only solves the problem for some commands, i.e. those listed in that for loop.
However, for commands such as mplayer and dpkg, it still does not work.
Also, I do not have file acroread.sh under /etc/bash_completion.d/
So, I cannot delete this file as others do.
I tried to move away all the files under /etc/bash_completion.d/, and the problem still remains for some commands such as xfig.
This means, if there is a problem, it has to be within /etc/bash_completion
I noticed that on my laptop, both gzip and mplayer have an autocompletion configuration file under /etc/bash_completion.d/,
and autocompletion works fine for gzip but not for mplayer.
A comparison between the configurations files reveal that:
in line 43 of gzip's configurationfile, function _compopt_o_filenames is called before autocompletion at line 44,
but for mplayer's configuration file, in the last case starting at line 253, function _filedir is invoked without calling function _compopt_o_filenames.
By adding an invocation to the function _compopt_o_filenames before line 254 in mplayer's configuration file, it makes mplayer work as expected.

This gives the idea of how to solve the problem with /etc/bash_completion
In /etc/bash_completion, line 72-126 defines the application specific autocompletion for many commands,
and they are also without calling function _compopt_o_filenames first.
However, function _compopt_o_filenames is defined in line 618, thus it cannot be called at line 72.
My fix is to paste the implementation of this function in line 623-624 before line 72.
However, there is still another problem.
The complete commands defined in line 72-126 (now 74-128) are only for filename completion.
So, the option "-o plusdirs" needs to be added to each complete command to also include the result of directory name completion.
e.g. "complete -f -X '!*.fig' xfig" -> "complete -f -o plusdirs -X '!*.fig' xfig"
After this, all the commands listed in line 74-128 work properly.

As a conclusion, this should be a bug in /etc/bash_completion and those configuration files under /etc/bash_completion.d/
My solution only fix those commands listed in /etc/bash_completion.
For commands that have a separate configuration file under /etc/bash_completion.d/, the fix should be applied to the configuration file individually.

-- 
You received this bug notification because you are a member of Canonical
Partner Developers, which is subscribed to acroread in Ubuntu.
https://bugs.launchpad.net/bugs/769866

Title:
  tab completion no longer escapes filenames and completes dirnames
  incorrectly (space instead of slash)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/acroread/+bug/769866/+subscriptions