[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Avoid sourcing bashrc when connected to sockets
From: |
Chet Ramey |
Subject: |
Re: Avoid sourcing bashrc when connected to sockets |
Date: |
Mon, 21 Feb 2022 16:11:07 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 |
On 2/21/22 2:15 PM, Andrew Gregory wrote:
On 02/21/22 at 02:01pm, Greg Wooledge wrote:
On Mon, Feb 21, 2022 at 10:31:21AM -0800, Andrew Gregory wrote:
On 02/14/22 at 11:11am, Chet Ramey wrote:
You might also want to tell your vendor about this, since they built bash
with the non-standard option that enables this behavior.
Can you explain this? Looking at the package build script[1] and the bash
source, nothing stands out to me as specifically enabling this behavior.
I don't know Arch, but Debian does it by applying a patch:
https://sources.debian.org/src/bash/5.1-2/debian/patches/deb-bash-config.diff/
The last piece of that patch sets the SSH_SOURCE_BASHRC macro in the
config-top.h file, which is what enables the feature. I would guess
that Arch does something similar, with whatever system of source code
patches it uses.
Hmmm, that appears to be a different check, specific to ssh. That shouldn't be
what we're hitting.
It doesn't appear so.
I believe we're hitting the isnetconn check below it,
which doesn't appear to be behind a configure option that I can see.
It's not.
The original reason for the SSH_CLIENT check (it dates from 1997) was that
sshd ran its children with their stdin and stdout connected to pipes, so
the isnetconn() check would fail.
The reason it's a configurable option is that checking for SSH_CLIENT can
fail and cause the bashrc to be read under circumstances other than being
run directly by sshd, like when `make' runs `$SHELL -c command' and doesn't
pass SHLVL through the environment (or it wasn't there to begin with), but
SSH_CLIENT is present in the environment.
Clearly times have changed, and maybe it's time to revisit that piece of
code.
We might be able to get rid of the SSH_CLIENT check for good. That doesn't
help you with your problem, of course.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
- Avoid sourcing bashrc when connected to sockets, Andrew Gregory, 2022/02/13
- Re: Avoid sourcing bashrc when connected to sockets, Kerin Millar, 2022/02/13
- Re: Avoid sourcing bashrc when connected to sockets, Alex fxmbsw7 Ratchev, 2022/02/13
- Re: Avoid sourcing bashrc when connected to sockets, Chet Ramey, 2022/02/14
- Re: Avoid sourcing bashrc when connected to sockets, Andrew Gregory, 2022/02/21
- Re: Avoid sourcing bashrc when connected to sockets, Greg Wooledge, 2022/02/21
- Re: Avoid sourcing bashrc when connected to sockets, Andrew Gregory, 2022/02/21
- Re: Avoid sourcing bashrc when connected to sockets, Greg Wooledge, 2022/02/21
- Re: Avoid sourcing bashrc when connected to sockets,
Chet Ramey <=
- Re: Avoid sourcing bashrc when connected to sockets, Chet Ramey, 2022/02/21
- Re: Avoid sourcing bashrc when connected to sockets, Andrew Gregory, 2022/02/21