From: Roel Janssen <roel@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 29337-done@debbugs.gnu.org
Subject: bug#29337: Bash reads system-wide bashrc unconditionally.
Date: Mon, 20 Nov 2017 22:48:37 +0100 [thread overview]
Message-ID: <87mv3gsjt6.fsf@gnu.org> (raw)
In-Reply-To: <87o9o039cb.fsf@gnu.org>
Ludovic Courtès writes:
> Hi,
>
> Roel Janssen <roel@gnu.org> 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
next prev parent reply other threads:[~2017-11-20 21:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 12:16 bug#29337: Bash reads system-wide bashrc unconditionally Roel Janssen
2017-11-17 21:04 ` Ludovic Courtès
2017-11-20 21:48 ` Roel Janssen [this message]
2017-11-21 8:50 ` Ludovic Courtès
2017-11-24 15:46 ` Roel Janssen
2017-11-24 20:51 ` Ludovic Courtès
2017-12-11 11:35 ` Roel Janssen
2017-12-11 13:19 ` Ludovic Courtès
2017-12-11 15:31 ` Roel Janssen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mv3gsjt6.fsf@gnu.org \
--to=roel@gnu.org \
--cc=29337-done@debbugs.gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.