[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Unexpected sourcing of ~/.bashrc under ssh
From: |
Francis . Montagnac |
Subject: |
Unexpected sourcing of ~/.bashrc under ssh |
Date: |
Thu, 24 Oct 2019 09:01:07 +0200 |
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
- Unexpected sourcing of ~/.bashrc under ssh,
Francis . Montagnac <=