[Bug 589496] Re: bash --rcfile does not behave as documented
Michael McNeil Forbes
589496 at bugs.launchpad.net
Thu Jun 1 18:50:28 UTC 2023
My use case: I want to be able to spawn a clean shell with a customized
development environment (python) from a Makefile (i.e. `make shell`
runs `bash --init-file .init_file.bash` which does not inherit cruft
from the environment (such as activated conda environments, PATHs etc.)
```
shell:
bash --init-file .init_file.bash
```
This worked fine until I started trying to use this on Debian-based
systems with -DSYS_BASHRC where, sometimes, admins activate a conda
environment for all users by default.
So, no admin access in the typical case. Now a user can do this by
running `bash --norc` then manually sourcing `.init_file.bash` from that
shell.
How do I achieve this effect from my Makefile? This is what I would
have expected `bash --norc --init-file .init_file.bash` but that is not
what bash does. I tend to agree that ignoring `--rcfile` flag behaviour
with `--norc` is the error... but it looks like that is not going to
change.
So what do I do? That non-admins are "not supposed to be able to bypass
it" seems moot, since they can with `--norc`. Am I missing something?
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/589496
Title:
bash --rcfile does not behave as documented
Status in bash package in Ubuntu:
Confirmed
Status in bash package in Debian:
New
Bug description:
Binary package hint: bash
the bash manpage says this about --rcfile
--rcfile file
Execute commands from file instead of the system wide initial‐
ization file /etc/bash.bashrc and the standard personal initial‐
ization file ~/.bashrc if the shell is interactive (see INVOCA‐
TION below).
under INVOCATION it says
When an interactive shell that is not a login shell is started, bash
reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
these files exist. This may be inhibited by using the --norc option.
The --rcfile file option will force bash to read and execute commands
from file instead of /etc/bash.bashrc and ~/.bashrc.
but when i execute
$ bash --rcfile somercfilewhichreallydoesexistandisreadableandall
it will still read /etc/bash/bashrc (can be verified by adding --verbose)
using lucid with bash 4.1-2ubuntu3
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/589496/+subscriptions
More information about the foundations-bugs
mailing list