-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(scp): keep tilde in local paths by using _filedir instead of _expand #765
base: main
Are you sure you want to change the base?
Conversation
I have a little experience with bash completion, so I can easily miss important use cases. You can consider this pull request as an invitation to discuss how to properly fix the issue with expanding of tilde during completion of I do not like when The cases that this change should address:
[1] lp:622403 bash-completion: readline expand-tilde not acknowledged |
The pathname completions are originally processed by $ scp ./COPYING[TAB twice]
COPYING COPYING |
Mea culpa. I have added a bit more code to avoid _comp_xfunc_ssh_scp_local_files when possible, however I am not sure that I have not broken something else. Counting |
While I dislike the tilde expansion myself as well and do support efforts to get rid of it as much as possible, I don't think we should make behavioral changes here without a set of unit tests having good coverage over the possibilities. This has been a tricky and bug prone thing in the past. The same probably applies to all other uses of |
Do not replace `~` by `/home/user/` for local files to get behavior consistent with other tools like `ls`. Previous variant of candidates generating using `ls` is slightly modified to match literal tilde after a prefix like in `-F~configfile`. Earlier attempt to suppress `_expand` of tilde for whole bash completion [Debian #521406. bash-completion: leading tilde always expanded](https://bugs.debian.org/521406) was reverted since it broke tilde completion for `scp` [Ville Skyttä \[Bash-completion-devel\] `_expand`, scp and quoting](https://alioth-lists-archive.debian.net/pipermail/bash-completion-devel/2009-February/000973.html)
58ed923
to
c555c90
Compare
It would be great to have unit tests and it can be done by an independent pull request since it would be improvement even in the case of declining of this change. In the meanwhile I have updated the patch to avoid changing of I am not motivated enough to create unit tests for so fragile code. I have missed an obvious issue with initial variant of my patch partially because I noticed enough glitches with original code:
|
Do not replace
~
by/home/user/
for local files to get behavior ofscp
consistent with other tools likels
. I hope, dropping_expand
and adding_filedir
to have file name completion will not cause issues like Ville Skyttä [Bash-completion-devel]_expand
, scp and quoting when a patch intended to fix Debian #521406. bash-completion: leading tilde always expandedwas reverted.