New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: run bash with --norc to avoid system bashrc #117
Conversation
|
I cannot reproduce. I do have the (Fedora provided) bash-completion package installed and enabled, and it gets loaded on shell startup. When I cd to my |
|
Maybe you it is loading from your user In void linux the bash-completion is loading from the system bashrc, thus the issue I described. Note that the system bashrc has a different filename in different distros, in debian it is Try adding to your system bashrc, to be able to reproduce the bug and to test the fix. |
|
In Fedora (and e.g. CentOS), the system bashrc |
|
Not so in debian or void linux. Indeed, bash has a configuration option If defined, bash loads this file before loading the user When you use This is what happens when I run bash in interactive mode with You can see that the system bashrc is loaded, and the bash_completion script is loaded through that. The only way to avoid loading the system bashrc is to pass the Hence the proposed patch, which runs Can you check that running the tests with my patch works fine on fedora? I tested on debian and void linux and it works fine on both. Otherwise, I cannot run the tests without modifying my system bashrc. |
|
I'll have a closer look a bit later, but in the meantime, it would be interesting to know why the error occurs. Your output in this issue only contains the error message, not its cause. The cause can be found in FYI I found these two external completion issues related to this in my system: |
|
I'm sorry. The error is that In fact, running the system bashrc may do other wrong things, I presume one really wants to run bash without any system configuration for the tests to avoid random issues. |
|
Could be, but on the other hand if the maintainers have defined a system bashrc that should always be loaded that early on shell init, it could be a sign that there's something essential in it which shouldn't be skipped... |
|
I'll still get back to this later, but I've removed the read only variable in c41a762 |
|
That change doesn't fix the issue, because the system provided bash-completion is still declaring the variable to be read only (of course, this will fix itself with time). I thought the point of running the tests without loading the rc file is to make sure it's running on a well know configuration to avoid any trouble like here. |
|
I have rebased the patch, and added a small fix: one needs to set |
|
I know it doesn't solve the issue, that's why I'm still going to get back to this one later. |
|
Another small fix: we need to set stty columns to 150 before running bash, because after startup it won't take effect. Now all the tests pass for me on debian and on void linux (except a very small number which give trouble on master as well: alias, cd, ssh) |
|
Rebased on top of 2.7 in 14b033b |
When running bash with `--rcfile` it skips loading the user bashrc, but it doesn't skip loading the system bashrc. If bash completions before 2.6 is installed and loaded from system bashrc, this causes an error: ``` FAIL: ERROR Unexpected output from bash command "BASH_COMPLETION_COMPAT_DIR="$SRCDIR/fixtures/shared/empty_dir"" FAIL: ERROR executing bash command "BASH_COMPLETION_COMPAT_DIR="$SRCDIR/fixtures/shared/empty_dir"" ``` This is because `BASH_COMPLETION_COMPAT_DIR` is a readonly variable before 2.6. In order to avoid that, we can run bash with the `--norc` option which skips loading any bashrc, and immediately source our `config/bashrc`. It is important to set PS1, INPUTRC, TERM, and stty columns *before* running bash.
|
The fedoradev test setup had started to reproduce this once they added a system default-loaded bashrc. Merged along with some followup cleanup commits. Thanks! |
When running bash with
--rcfileit skips loading the user bashrc, butit doesn't skip loading the system bashrc.
If bash completions is installed and loaded from system bashrc, this
causes an error:
In order to avoid that, run bash with the
--norcoption which skipsloading any bashrc, and immediately source our
config/bashrc.It is important to set INPUTRC and PS1 before running bash.