From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roel Janssen Subject: bug#29337: Bash reads system-wide bashrc unconditionally. Date: Mon, 20 Nov 2017 22:48:37 +0100 Message-ID: <87mv3gsjt6.fsf@gnu.org> References: <878tf5ksmq.fsf@gnu.org> <87o9o039cb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGtw9-0005YM-R5 for bug-guix@gnu.org; Mon, 20 Nov 2017 16:49:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGtw6-00033d-PK for bug-guix@gnu.org; Mon, 20 Nov 2017 16:49:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:40858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eGtw6-00033N-LU for bug-guix@gnu.org; Mon, 20 Nov 2017 16:49:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eGtw6-00081W-FA for bug-guix@gnu.org; Mon, 20 Nov 2017 16:49:02 -0500 Sender: "Debbugs-submit" Resent-To: bug-guix@gnu.org Resent-Message-ID: In-reply-to: <87o9o039cb.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 29337-done@debbugs.gnu.org Ludovic Courtès writes: > Hi, > > Roel Janssen 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 > this: > > --8<---------------cut here---------------start------------->8--- > if [ -n "$BASH_VERSION" -a -f /etc/bashrc ] > then > # Load Bash-specific initialization code. > . /etc/bashrc > fi > --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. > > Thoughts? Thanks for your reply, Ludo’! Well it seems that it isn't ignored when it ought to be ignored -> when specifying --init-file. This is a difference between how Bash works on CentOS 7, and how Bash works on Guix(SD). I can't find a user-configurable option to make it work the same as on CentOS 7. I think I can also achieve my goal by invoking it as "sh", prepending "env - ENV=/path/to/etc/profile", and setting some environment variables like HOME and PS1. So I'll go that route, leaving Guix's Bash alone. :-) Kind regards, Roel Janssen