Describe the bug
If an interactive shell has set -a, completion functions are exported and inherited by spawned non-interactive shells, which typically do not have extglob. This results in spurious errors like
/bin/bash: _patch: line 3: syntax error near unexpected token `('
/bin/bash: _patch: line 3: ` --strip | --ifdef | --prefix | --basename-prefix | --suffix | --get | -!(-*)[pDBYzg])'
/bin/bash: error importing function definition for `_patch'
(Similarly for _sudo, _tar, etc.)
To reproduce
Add set -a to you .bashrc.