bash --rcfile does not behave as documented

Bug #589496 reported by Lesmana Zimmer on 2010-06-04
This bug affects 4 people
Affects Status Importance Assigned to Milestone
bash (Debian)
bash (Ubuntu)

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

Lesmana Zimmer (lesmana) wrote :

here are two "upstream" bugs (debian is upstream, right?)

note: those two bugs are duplicates of each other, but i was not able to find out how to mark bugs as duplicate in the debian bug tracker.

littlebat (dashing-meng) wrote :

Yes, I confirmed it. Ubuntu 10.04 bash. when execute "/bin/bash --rcfile someexistedrcfile", it still read and execute /etc/bash.bashrc and will not read ~./bashrc

Jonathan Wiltshire (jwiltshire) wrote :

Merged the two Debian bugs for you.

Lesmana Zimmer (lesmana) on 2010-08-27
Changed in bash (Ubuntu):
status: New → Confirmed
Changed in bash (Debian):
status: Unknown → New
MestreLion (mestrelion) wrote :

Debian bug #516152 is from 2009, and #343673 from 2006 ... none of them are fixed, so I don't think they care.

This is not an irrelevant package we are talking about, its a flaw in invocation of something critical like bash. Is there any chance this could be patched ASAP in Ubuntu and then the patch submitted to Debian afterwards?

Also, this is not only a bug in documentation as #516152 and #343673 suggests: with current behaviour, it's impossible to "disable" the execution of /etc/bash.bashrc and still give the user a choice of executing a personal rcfile.


$ cat /etc/bash.bashrc
echo etcbashrc
$ cat ~/customrc
echo customrc
$ cat ~/.bashrc
echo bashrc
$ bash
$ bash --rcfile ~/customrc
$ bash --norc --rcfile ~/customrc

MestreLion (mestrelion) wrote :

This patch fixes the behaviour of --rcfile. It was also reported in both Debian and upstream. But since Ubuntu is usually much more responsive, the fix could be patched in Ubuntu until either Debian or GNU merges.

Also, to speed things up, everyone interested could voice their opinion in GNU's bug report at , there's a VOTE section that maybe would help getting attention to this issue

The attachment "Do not execute /etc/bash.bashrc if --rcfile is set" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
mpb (mpb) wrote :

[TL;DR: Bash developer Chet Ramey claimed in 2015 that this is a documentation bug. Then, in 2016, a documentation patch has been proposed to (and possibly accepted by?) Debian.]

On 16 Sep 2016, Chet Ramey released version 4.4 of bash. This inspired me to check and see if this long standing issue has been fixed. Here is what I learned.

Debian bug # 343673 from 2005.

Debian bug # 516152 from 2009.

GNU Savannah bug #107950 from 2012.

In 2015, Chet Ramey commented on the above Savannah bug report:

"Debian made that documentation error. If you compile with -DSYS_BASHRC, it's always executed, as is ~/.bashrc (or the file specified with --rcfile)"

In other words, Ramey claims this is a documentation bug. I do not know if -DSYS_BASHRC has only the one above effect, or if it also has other effects as well.

In 2016, Tom Levy posted the following comment on Debian bug #516152 (see above link).

"Convincing Chet that the behaviour in Debian's documentation is preferable
to the current behaviour seems hard considering his 3-year response time. I propose changing the documentation."

Levy also included a patch to Debian's bash man page. The patch is here:;bug=516152;filename=man-bashrc.diff.patch;msg=27

I am not an expert on the Debian development process, so I am unable to determine if the patch has been accepted by Debian.

The patch does not appear to have been applied to the following file, but this might not be the correct place to look for the patch. (Again, I am not a Debian expert.)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.