Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Francis.Montagnac@inria.fr Newsgroups: gnu.bash.bug Subject: Unexpected sourcing of ~/.bashrc under ssh Date: Thu, 24 Oct 2019 09:01:07 +0200 Lines: 51 Approved: bug-bash@gnu.org Message-ID: References: <27440.1571900467@kermit.inria.fr> NNTP-Posting-Host: lists.gnu.org Content-Type: text/plain; charset=utf-8 X-Trace: usenet.stanford.edu 1571926701 23594 209.51.188.17 (24 Oct 2019 14:18:21 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-IronPort-AV: E=Sophos;i="5.68,223,1569276000"; d="scan'208";a="324068963" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.134.164.104 X-Mailman-Approved-At: Thu, 24 Oct 2019 10:18:19 -0400 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <27440.1571900467@kermit.inria.fr> Xref: csiph.com gnu.bash.bug:15534 Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switch\ es -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection \ -fcf-protection -Wno-parentheses -Wno-format-security uname output: Linux nbrume 5.3.6-200.fc30.x86_64+debug #1 SMP Mon Oct 14 12:47:59 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-redhat-linux-gnu Bash Version: 5.0 Patch Level: 7 Release Status: release Description: When logged on a machine with ssh, executing a simple command CMD1 that spawn a "/bin/bash -c some other command" do not source ~/.bashrc: normal behaviour. When executing "CMD1 | CMD2", the ~/.bashrc is sourced: wrong . I have tested that with perl and make as CMD1. This bug is not present in bash-4.2.48-2.fc14.1.x86_64 Repeat-By: Add for example in ~/.bashrc: echo "Sourcing .bashrc, \$- = $-" connect to this machine with ssh, then execute: $ perl -e 'exec "/bin/bash","-c","echo foo"' foo $ perl -e 'exec "/bin/bash","-c","echo foo"' | cat Sourcing .bashrc, $- = hBc foo $ Turnaround: For make, defines: SHELL := /bin/bash --norc Unsetting the SSH_CLIENT variable works also. -- Francis Montagnac