Mon 06 Feb 2012 05:27:23 PM UTC, original submission:
Debian's bash (compiled with -DSYS_BASHRC) documentation says
"--rcfile file: Execute commands from file instead of the system wide initialization file /etc/bash.bashrc and the standard personal initialization file ~/.bashrc if the shell is interactive."
But testing shows that /etc/bash.bashrc is being executed even when a --rcfile is set.
So the only way for the user to disable the system-wide rc is to use the --norc option, which also disables both ~/.bashrc and any custom rc specified in --rcfile
User should be able to prevent system rc and selecting a custom rc by using the --rcfile option, as per the documentation.
from any terminal:
$ sudo echo "echo systemrc" > /etc/bash.bashrc
$ echo "echo customrc" > ~/customrc
$ echo "echo bashrc" > ~/.bashrc
$ bash
systemrc
bashrc
$ bash --rcfile ~/customrc --norc
$
Current behavior:
$ bash --rcfile ~/customrc
systemrc
customrc
$
Expected behavior:
$ bash --rcfile ~/customrc
customrc
$
To fix the behavior so it matches the documentation, SYS_BASHRC should only be executed if --rcfile is NOT used.
Also, documentation should be updated to clarify that --norc option disables --rcfile option.
Last but not least, -DSYS_BASHRC compile option should be properly documented, or at least included in configure options (suggestion: --enable-system-bashrc)
|