[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Ludovic Courtès
Subject: bug#29337: Bash reads system-wide bashrc unconditionally.
Date: Fri, 17 Nov 2017 22:04:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)


Roel Janssen <address@hidden> skribis:

> 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?

By default GuixSD’s /etc/profile (sourced by interactive shells) does

--8<---------------cut here---------------start------------->8---
if [ -n "$BASH_VERSION" -a -f /etc/bashrc ]
  # Load Bash-specific initialization code.
  . /etc/bashrc
--8<---------------cut here---------------end--------------->8---

It comes from commit 1d167b6e3779bcc1666b5c7d5ee802170c7023b6, which was
about loading the Bash completion code.

Looking at the manual (info "(bash) Bash Startup Files"), I think that
/etc/bashrc is ignored by default.  Thus it’s up to users/distros to
decide what to do with it, IIUC.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]