-
Notifications
You must be signed in to change notification settings - Fork 391
fix(rsync,ssh,sshfs): do not generate regular files *'\' as dirs #1397
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -512,15 +512,15 @@ _comp_xfunc_scp_compgen_remote_files() | |
# shellcheck disable=SC2090 | ||
_files=$(ssh -o 'Batchmode yes' "$_userhost" \ | ||
command ls -aF1dL "$_path*" 2>/dev/null | | ||
command sed -e 's/'"$_comp_cmd_scp__path_esc"'/'"$_escape_replacement"'/g' -e '/[^\/]$/d') | ||
command sed -e 's/'"$_comp_cmd_scp__path_esc"'/'"$_escape_replacement"'/g' -e '/[^/]$/d') | ||
else | ||
# escape problematic characters; remove executables, aliases, pipes | ||
# and sockets; add space at end of file names | ||
# shellcheck disable=SC2090 | ||
_files=$(ssh -o 'Batchmode yes' "$_userhost" \ | ||
command ls -aF1dL "$_path*" 2>/dev/null | | ||
command sed -e 's/'"$_comp_cmd_scp__path_esc"'/'"$_escape_replacement"'/g' -e 's/[*@|=]$//g' \ | ||
-e 's/[^\/]$/& /g') | ||
-e 's/[^/]$/& /g') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to add a test for this |
||
fi | ||
_comp_compgen -R split -l -- "$_files" | ||
} | ||
|
@@ -550,13 +550,13 @@ _comp_xfunc_scp_compgen_local_files() | |
_comp_compgen -RU files split -l -- "$( | ||
command ls -aF1dL "${files[@]}" 2>/dev/null | | ||
command sed -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \ | ||
-e '/[^\/]$/d' -e "s/^/${1-}/" | ||
-e '/[^/]$/d' -e "s/^/${1-}/" | ||
)" | ||
else | ||
_comp_compgen -RU files split -l -- "$( | ||
command ls -aF1dL "${files[@]}" 2>/dev/null | | ||
command sed -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \ | ||
-e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e "s/^/${1-}/" | ||
-e 's/[*@|=]$//g' -e 's/[^/]$/& /g' -e "s/^/${1-}/" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A test for the local-path generation without |
||
)" | ||
fi | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
import pytest | ||
|
||
from conftest import assert_bash_exec, assert_complete | ||
|
||
|
||
@pytest.mark.bashcomp(ignore_env=r"^[+-]_comp_cmd_scp__path_esc=") | ||
class TestSshfs: | ||
@pytest.mark.complete("sshfs ./") | ||
def test_1(self, completion): | ||
assert completion | ||
|
||
@pytest.mark.complete("sshfs local_path", cwd="sshfs") | ||
def test_local_path_suffix_1(self, completion): | ||
assert completion == "-dir/" | ||
|
||
def test_remote_path_ending_with_backslash(self, bash): | ||
assert_bash_exec(bash, "ssh() { echo 'hypothetical\\'; }") | ||
completion = assert_complete(bash, "sshfs remote_host:hypo") | ||
assert_bash_exec(bash, "unset -f ssh") | ||
assert not completion |
Uh oh!
There was an error while loading. Please reload this page.