diff --git a/bash_completion b/bash_completion index 4e488d44564..ecaecd3511c 100644 --- a/bash_completion +++ b/bash_completion @@ -2860,7 +2860,7 @@ _comp_command_offset() _comp_compgen_commands else _comp_dequote "${COMP_WORDS[0]}" || REPLY=${COMP_WORDS[0]} - local cmd=$REPLY compcmd=$REPLY + local cmd=${REPLY-} compcmd=${REPLY-} local cspec=$(complete -p -- "$cmd" 2>/dev/null) # If we have no completion for $cmd yet, see if we have for basename diff --git a/completions/ssh b/completions/ssh index 279c44b040a..d32819e1d13 100644 --- a/completions/ssh +++ b/completions/ssh @@ -302,7 +302,7 @@ _comp_cmd_ssh() _comp_cmd_ssh__compgen_suboption_check "$1" && return - local ipvx + local ipvx= # Keep cases sorted the same they're in ssh's usage message # (but do group ones with same arg completion) @@ -459,7 +459,6 @@ _comp_cmd_sftp() shopt -u hostcomplete && complete -F _comp_cmd_sftp sftp # things we want to backslash escape in scp paths -# shellcheck disable=SC2089 _comp_cmd_scp__path_esc='[][(){}<>"'"'"',:;^&!$=?`\\|[:space:]]' # Complete remote files with ssh. Returns paths escaped with three backslashes @@ -493,7 +492,6 @@ _comp_xfunc_scp_compgen_remote_files() local _path=${cur#*:} # unescape (3 backslashes to 1 for chars we escaped) - # shellcheck disable=SC2090 _path=$(command sed -e 's/\\\\\\\('"$_comp_cmd_scp__path_esc"'\)/\\\1/g' <<<"$_path") # default to home dir of specified user on remote host @@ -509,14 +507,12 @@ _comp_xfunc_scp_compgen_remote_files() local _files if [[ $_dirs_only ]]; then # escape problematic characters; remove non-dirs - # 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') 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/[*@|=]$//g' \ @@ -539,26 +535,26 @@ _scp_remote_files() # @since 2.12 _comp_xfunc_scp_compgen_local_files() { - local _dirsonly="" + local _dirs_only="" if [[ ${1-} == -d ]]; then - _dirsonly=set + _dirs_only=set shift fi local files _comp_expand_glob files '"$cur"*' || return 0 - if [[ $_dirsonly ]]; then - _comp_compgen -RU files split -l -- "$( + if [[ $_dirs_only ]]; then + _comp_compgen -RU files split -l ${1:+-P "$1"} -- "$( command ls -aF1dL "${files[@]}" 2>/dev/null | command sed -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \ - -e '/[^/]$/d' -e "s/^/${1-}/" + -e '/[^/]$/d' )" else - _comp_compgen -RU files split -l -- "$( + _comp_compgen -RU files split -l ${1:+-P "$1"} -- "$( command ls -aF1dL "${files[@]}" 2>/dev/null | command sed -e 's/[*@|=]$//g' \ -e "s/$_comp_cmd_scp__path_esc/\\\\&/g" \ - -e 's/[^/]$/& /g' -e "s/^/${1-}/" + -e 's/[^/]$/& /g' )" fi } @@ -588,7 +584,7 @@ _comp_cmd_scp() return } - local ipvx + local ipvx= case $prev in -*c) @@ -640,7 +636,7 @@ _comp_cmd_scp() ;; esac - local prefix + local prefix= if [[ $cur == -F* ]]; then cur=${cur#-F} diff --git a/test/t/test_cancel.py b/test/t/test_cancel.py index 4aeafd2c5fa..9384908c630 100644 --- a/test/t/test_cancel.py +++ b/test/t/test_cancel.py @@ -16,7 +16,7 @@ def added_job(self, request, bash): ) except AssertionError: pytest.skip("Could not add test print job") - return + if len(got) > 3: request.addfinalizer( lambda: assert_bash_exec(bash, "cancel %s" % got[3]) diff --git a/test/t/test_ls.py b/test/t/test_ls.py index f91ee6b2e2e..56f0ee71e90 100644 --- a/test/t/test_ls.py +++ b/test/t/test_ls.py @@ -33,7 +33,7 @@ def test_3(self, bash): part_full = find_unique_completion_pair(res) if not part_full: pytest.skip("No suitable test user found") - return + part, full = part_full completion = assert_complete(bash, "ls ~%s" % part) assert completion == full[len(part) :] diff --git a/test/t/test_man.py b/test/t/test_man.py index 081b8fcc1e7..bec41de9613 100644 --- a/test/t/test_man.py +++ b/test/t/test_man.py @@ -23,7 +23,7 @@ def colonpath(self, request, bash): pass else: pytest.skip("Cygwin doesn't like paths with colons") - return + tmpdir, _, _ = prepare_fixture_dir( request, files=["man/man3/Bash::Completion.3pm.gz"],