Skip to content

shopt failglob causes bash_completiion to give error in _included_ssh_config_files #705

@idallen

Description

@idallen

Describe the bug

Running the shell with shopt -s failglob causes the ssh config file glob expansion in _included_ssh_config_files() to fail with an error.

To reproduce

bash-5.0$ shopt -s failglob
bash-5.0$ ssh <TAB>bash: no match: /etc/ssh/ssh_config.d/*.conf

Expected behavior

Completion scripts should work without error even with failglob set.

Versions (please complete the following information)

  • [GNU/linux/Ubuntu 20.04.4 LTS] Operating system name/distribution and version:
  • [5.0.17(1)-release] bash version, echo "$BASH_VERSION":
  • [2.11.0] bash-completion version, (IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}"):

Additional context

Latest completion scripts downloaded via git clone and copied into Ubuntu.

Debug trace

+ _included_ssh_config_files /etc/ssh/ssh_config
+ (( 1 < 1 ))
+ local configfile i f
+ configfile=/etc/ssh/ssh_config
++ shopt -po noglob
+ local 'IFS= 
' 'reset=set -o noglob'
+ set -o noglob
+ included=($(command sed -ne 's/^[[:blank:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:blank:]]\(.*\)$/\1/p' "${configfile}"))
++ command sed -ne 's/^[[:blank:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:blank:]]\(.*\)$/\1/p' /etc/ssh/ssh_config
++ sed -ne 's/^[[:blank:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:blank:]]\(.*\)$/\1/p' /etc/ssh/ssh_config
+ local included
+ set -o noglob
+ [[ -n /etc/ssh/ssh_config.d/*.conf ]]
+ for i in "${included[@]}"
+ [[ /etc/ssh/ssh_config.d/*.conf =~ ^~.*|^/.* ]]
+ __expand_tilde_by_ref i
+ [[ /etc/ssh/ssh_config.d/*.conf == \~* ]]
+ set +o noglob
bash: no match: /etc/ssh/ssh_config.d/*.conf

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions