Subject: bug#29337: Bash reads system-wide bashrc unconditionally.

From: Roel Janssen <[email-masked]>
Date: Fri, 17 Nov 2017 13:16:13 +0100

Dear Guix,

This is more of an issue for GuixSD.
Our 'bash' package seems to behave differently from other distributions
(like CentOS 7), and it behaves differently from the way described in its
manual page.

I added the following line to /etc/bashrc:
echo "Hello, world"

Here's the command to reproduce the problem:
$ env - bash --init-file <(echo "echo \"Goodbye, world\"") -i
Hello, world
Goodbye, world

>From the manpage:
...
       -i        If the -i option is present, the shell is interactive.
...
       --init-file file
       --rcfile file
              Execute commands from file instead of the standard personal initialization file ~/.bashrc if the shell is interactive (see INVOCATION below).
...

So, what should happen, is that it ignores the system-wide initialization
file (and the user's initialization file).

On CentOS 7, the following happens (yes, I added the echo-statement to
/etc/bashrc on CentOS as well):
$ env - bash --init-file <(echo "echo \"Goodbye, world\"") -i
Goodbye, world

On GuixSD:
$ env - bash --init-file <(echo "echo \"Goodbye, world\"") -i
Hello, world
Goodbye, world

Where does this difference come from?  And could we make its behavior
similar to CentOS 7, and more importantly, to the description in the
manpage?

Kind regards,
Roel Janssen