I've been dealing with this issue for years and finally tracked it down a few 
minutes ago.
This is caused by the line:

    declare -A _xspecs

around line 1909 of /usr/share/bash-completion/bash_completion

this line *should* read:

    declare -Ag _xspecs

to ensure the _xspecs variable remains in the global scope, regardless
of where bash_completion is sourced from.

This has been fixed in the upstream repository for over a year:

    https://github.com/wpalmer/bash-
completion/commit/a47bd375bb0f95dc6d388d4097c420bddb72ae33

This also causes errors in which _xspecs, having not been seen to be
previously-declared, is treated as a non-associative array, resulting in
errors when strings are erroneously treated as arithmetic operations to
return an integer (ie: 'invalid arithmetic operator (error token is
".sh")' when trying to complete a command with .sh in the name)

This issue has already been fixed, Ubuntu needs to either sync with
upstream, or to apply the patch found at the above link.

In the meantime, the attached patch can be used as a quick workaround

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1813090

Title:
  bash completions in /usr/share/bash-completion generate unbound
  variable errors

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1813090/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to