You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Tab completion of paths prefixed by ~ does not work #4061
cd /home/kenny/sr<TAB> correctly completes to cd /home/kenny/src whereas cd ~/sr<TAB> does not (though I can press the right arrow key to complete). I ran a bisect which identified a3a0692 as the offending commit.
Reacted by David Adam and Bertrand Bonnefoy-Claudet
Good catch. Thanks for the bug report. This is an example of why we didn't want to include that change in the forthcoming 2.6.0 release. It wasn't clear that change wouldn't have negative side-effects.
P.S., Pressing [right-arrow] is accepting the autosuggestion. Something that is independent of file name completions.
The issue here is that cd is using two kinds of completions - the script, and some hardcoded ones in c++. These latter ones are classified as "file" completions.
The script does essentially one thing the hardcoded completions don't - for candidates from $CDPATH, it adds the corresponding $CDPATH-component as a description (which I find rather useful). On the other hand, it does not do various expansions, as you've seen here.
There are a few things we can do:
Remove the cd.fish completion script since it's barely useful anyway - we can add the descriptions back later
Add these expansions to the cd.fish script (and then remove the special expansion code). This is difficult to do since we'd have to redo a bunch of the matching logic, and then keep it in sync.
Remove the "-x" from cd.fish - this makes it work immediately, and is exactly as clean as the status quo.
Since the third option is really easy to do and fixes everything now, I'm going to do that.
The good news is that we now know what to look out for when testing the underlying change - anything that might use the file-matching logic as a fallback for missing expansions, which includes everything using __fish_complete_directories.
Most other completions won't be affected since they either use the builtin file-completion logic or don't accept files at all.
@faho4afd418 seems to have fixed the "partial completion" issue and the cd ~/<TAB> cases but cd ~<TAB> (without the / after ~) still seems to be broken (i.e. on my mac, it somehow autocompletes to cd ~_amavisd). Previously, it would autocomplete all the directories within ~.
cd ~ (without the / after ~) still seems to be broken (i.e. on my mac, it somehow autocompletes to cd ~_amavisd)
That means you have a user called "_amavisd" - tilde-expansion covers not just ~/ for the current user's home, but also ~$USER/ for $USER's home. E.g. on my system ~root/ expands to "/root/".
This isn't directly caused by the change to not offer files. It is caused by c114cbc since that breaks on the first match.
@faho Aha, I see. I'm assuming also related to c114cbc, it seems to complete ~_amavisd even if the target directory doesn't exist:
$ grep _amavisd /etc/passwd
_amavisd:*:83:83:AMaViS Daemon:/var/virusmails:/usr/bin/false
$ cd ~_amavisd
cd: The directory '/private/var/virusmails' does not exist
it seems to complete ~_amavisd even if the target directory doesn't exist
I'm unsure if we should do anything about that. That is what the "_amavisd" user's $HOME is set to, and it might be useful for some commands. I'm assuming the path is still marked as non-existing (i.e. it's not underlined)?
Anyway, I've now opened #4074 to track the ~/ issue (which I don't was ever offered as a completion).
Activity
krader1961 commentedon May 24, 2017
Good catch. Thanks for the bug report. This is an example of why we didn't want to include that change in the forthcoming 2.6.0 release. It wasn't clear that change wouldn't have negative side-effects.
P.S., Pressing [right-arrow] is accepting the autosuggestion. Something that is independent of file name completions.
zx8 commentedon May 26, 2017
In addition, this seems to have broken "partial matching" of directories as well, i.e.
Expected
Actual
faho commentedon May 26, 2017
The issue here is that
cdis using two kinds of completions - the script, and some hardcoded ones in c++. These latter ones are classified as "file" completions.The script does essentially one thing the hardcoded completions don't - for candidates from $CDPATH, it adds the corresponding $CDPATH-component as a description (which I find rather useful). On the other hand, it does not do various expansions, as you've seen here.
There are a few things we can do:
Remove the cd.fish completion script since it's barely useful anyway - we can add the descriptions back later
Add these expansions to the cd.fish script (and then remove the special expansion code). This is difficult to do since we'd have to redo a bunch of the matching logic, and then keep it in sync.
Remove the "-x" from cd.fish - this makes it work immediately, and is exactly as clean as the status quo.
Since the third option is really easy to do and fixes everything now, I'm going to do that.
The good news is that we now know what to look out for when testing the underlying change - anything that might use the file-matching logic as a fallback for missing expansions, which includes everything using
__fish_complete_directories.Most other completions won't be affected since they either use the builtin file-completion logic or don't accept files at all.
zx8 commentedon May 27, 2017
@faho 4afd418 seems to have fixed the "partial completion" issue and the
cd ~/<TAB>cases butcd ~<TAB>(without the/after~) still seems to be broken (i.e. on my mac, it somehow autocompletes tocd ~_amavisd). Previously, it would autocomplete all the directories within~.faho commentedon May 27, 2017
That means you have a user called "_amavisd" - tilde-expansion covers not just
~/for the current user's home, but also~$USER/for $USER's home. E.g. on my system~root/expands to "/root/".This isn't directly caused by the change to not offer files. It is caused by c114cbc since that
breaks on the first match.@krader1961: Mind taking a look?
zx8 commentedon May 27, 2017
@faho Aha, I see. I'm assuming also related to c114cbc, it seems to complete
~_amavisdeven if the target directory doesn't exist:faho commentedon May 27, 2017
I'm unsure if we should do anything about that. That is what the "_amavisd" user's $HOME is set to, and it might be useful for some commands. I'm assuming the path is still marked as non-existing (i.e. it's not underlined)?
Anyway, I've now opened #4074 to track the
~/issue (which I don't was ever offered as a completion).faho commentedon May 27, 2017
Also #4075 tracks the issue of only completing one user.