Public bug reported:

Release: Ubuntu 20.04.1 LTS
Bash version: GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

>From Bash's manual page, this should be the behaviour of the --rcfile
option.

<< Execute commands from file instead of the system wide initialization
file /etc/bash.bashrc and the  standard  personal  initialization file
~/.bashrc if the shell is interactive (see INVOCATION below). >>

However, that is not the case in practice. Let's consider a short script
named "test.sh", which is made up of only one line:

echo "Just testing"

When I open a terminal on my Ubuntu 20.04 machine, and type in the
command "bash --rcfile test.sh", I expect my file test.sh to be run
instead of /etc/bash.bashrc and ~/.bashrc. However, though my file is
run successfully, /etc/bash.bashrc is still run, and is even run before
my script. I don't get why (it contradicts the manual page). I noticed
that because I introduced an echo command in both /etc/bash.bashrc and
~/.bashrc to monitor their executions.

Upon googling, I noticed I wasn't the first who had such an issue, but
no solution was proposed (see the first comment on the accepted answer
on this post: https://unix.stackexchange.com/questions/187369/when-is-
etc-bash-bashrc-invoked). Finally, it was advised to file a bug.

Hope I clearly described the issue.

P.S. I know this is out of your scope, but just so you know: I had the
same issue on Kali-5.6.0-kali2-amd64 (bash 5.0-6)

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: bash 5.0-6ubuntu1.1
ProcVersionSignature: Ubuntu 5.4.0-53.59-generic 5.4.65
Uname: Linux 5.4.0-53-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.12
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Tue Nov 17 13:45:49 2020
InstallationDate: Installed on 2020-04-26 (205 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
SourcePackage: bash
UpgradeStatus: No upgrade log present (probably fresh install)
mtime.conffile..etc.bash.bashrc: 2020-11-17T13:26:33.214663

** Affects: bash (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug focal

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1904552

Title:
  Bash option "--rcfile" doesn't prevent /etc/bash.bashrc from being
  executed when launching an interactive shell

Status in bash package in Ubuntu:
  New

Bug description:
  Release: Ubuntu 20.04.1 LTS
  Bash version: GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

  From Bash's manual page, this should be the behaviour of the --rcfile
  option.

  << Execute commands from file instead of the system wide
  initialization file /etc/bash.bashrc and the  standard  personal
  initialization file ~/.bashrc if the shell is interactive (see
  INVOCATION below). >>

  However, that is not the case in practice. Let's consider a short
  script named "test.sh", which is made up of only one line:

  echo "Just testing"

  When I open a terminal on my Ubuntu 20.04 machine, and type in the
  command "bash --rcfile test.sh", I expect my file test.sh to be run
  instead of /etc/bash.bashrc and ~/.bashrc. However, though my file is
  run successfully, /etc/bash.bashrc is still run, and is even run
  before my script. I don't get why (it contradicts the manual page). I
  noticed that because I introduced an echo command in both
  /etc/bash.bashrc and ~/.bashrc to monitor their executions.

  Upon googling, I noticed I wasn't the first who had such an issue, but
  no solution was proposed (see the first comment on the accepted answer
  on this post: https://unix.stackexchange.com/questions/187369/when-is-
  etc-bash-bashrc-invoked). Finally, it was advised to file a bug.

  Hope I clearly described the issue.

  P.S. I know this is out of your scope, but just so you know: I had the
  same issue on Kali-5.6.0-kali2-amd64 (bash 5.0-6)

  ProblemType: Bug
  DistroRelease: Ubuntu 20.04
  Package: bash 5.0-6ubuntu1.1
  ProcVersionSignature: Ubuntu 5.4.0-53.59-generic 5.4.65
  Uname: Linux 5.4.0-53-generic x86_64
  ApportVersion: 2.20.11-0ubuntu27.12
  Architecture: amd64
  CasperMD5CheckResult: skip
  CurrentDesktop: ubuntu:GNOME
  Date: Tue Nov 17 13:45:49 2020
  InstallationDate: Installed on 2020-04-26 (205 days ago)
  InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
  SourcePackage: bash
  UpgradeStatus: No upgrade log present (probably fresh install)
  mtime.conffile..etc.bash.bashrc: 2020-11-17T13:26:33.214663

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1904552/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to