Closed satmandu closed 5 months ago
Same issue using bash completion built from https://github.com/scop/bash-completion/commit/5cb74f805d13fb49989aee08da132cb24135631f
Do you unset extglob
in your ~/.bashrc
? bash-completion
relies on the Bash option extglob
. bash_completion
turns extglob
on, but if extglob
is turned off later, it will cause the problem. extglob
shouldn't be turned off to make bash-completion
work.
bash: error importing function definition for `_comp_complete_longopt' bash: error importing function definition for `_comp_compgen_usage'
Hmm, those functions are exported by the parent shell and then evaluated by the child shells before extglob
is set. Do you mark those functions with the export attribute?
bash: error importing function definition for `_comp_complete_longopt' bash: error importing function definition for `_comp_compgen_usage'
Hmm, those functions are exported by the parent shell and then evaluated by the child shells before
extglob
is set. Do you mark those functions with the export attribute?
I'm trying to figure out where the parent shell is exporting those. The problem we have is that /bin/bash is from ChromeOS, and a such we are stuck with whatever it sets before we get our shell...
Do you unset
extglob
in your~/.bashrc
?bash-completion
relies on the Bash optionextglob
.bash_completion
turnsextglob
on, but ifextglob
is turned off later, it will cause the problem.extglob
shouldn't be turned off to makebash-completion
work.
Ah, yes it appears that somewhere extglob
is being unset. Let us see if we can get it to stay set, and also set our bash build to have it set by default...
OK, this line causes the issue:
Because set -a
is specified in the parent shell, all the functions including the ones bash-completion
defines are automatically exported and passed to the new shell instance. The new shell instance loads the functions defined in the parent shell, which require a specific set of shell options, before evaluating any initialization scripts. Since this is performed on the stage earlier than any setups of the shell options, the exported functions cause the syntax error.
You seem to have added shopt -s extglob
in https://github.com/chromebrew/crew-profile-base/pull/20, but I think it doesn't have an effect. Or have you confirmed that it fixes the issue?
In addition, as far as I read README of chromebrew/crew-profile-base
, the Bash-specific option shopt -s extglob
shouldn't be put in profile
because it should contain only Bourne-shell compatible settings.
Thanks all for debugging this issue for our users.
I will make these changes and see if that helps!
Describe the bug
Getting this after installing 2.12 and 2.13 whenever I open a new shell using bash 5.2 patchlevel 26:
To reproduce
Install bash-completion, and open a new shell.
Expected behavior
Versions (please complete the following information)
echo "$BASH_VERSION"
: 5.2.26(1)-release(IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}")
: 2.13.0Additional context
Debug trace