AW: [PATCH] ash: Load $ENV file also if $SSH_CLIENT/SSH2_CLIENT is preset in env, reformat

Denys Vlasenko vda.linux at googlemail.com
Mon Jan 4 20:26:30 UTC 2021


On Mon, Jan 4, 2021 at 8:48 PM Björn Bidar <bjorn.bidar at jolla.com> wrote:
> Am Montag, 4. Januar 2021, 14:43:46 EET schrieben Sie:
> > > > Please explain your real-world scenario which prompted you
> > > > to create the patch.
> > >
> > > The real world scenario is that a user might run commands via ssh on a
> > > device using busybox ash but expect a certain set of environment
> > > variables present or run some scripts that set up the shell session.
> >
> > I meant: what was _your_ real-world scenario which prompted you to create
> > the patch. You had $ENV set up? Where it was set from - /etc/profile?
> > ~/.profile?
> > It was doing which important setup? Why moving this setup to .profile
> > was not feasible? etc...
> Profile is not sourced in an non interactive session eg. Ssh foobar bar
>
> I explained my real world scenario already a developer running a common to a
> device via ssh and needing to have that environment setup.
>
> I set the Env Variable in sshd_config but it could be setup anywhere eg. to
> emulate  an rc file.

Thank you.
I don't think we should address it this way.

What bash does is essentially an undocumented hack ("if run by SSH,
make my shell
a little bit like interactive one, but not really), albeit the hack is useful
enough to be adopted.

The same rationale says ash users will also want this hack. Okay.
But what you propose is not exactly the same hack. It's a slightly
different one:
it executes "$ENV", not .bashrc. If we'd do this, now bash and ash
will have two subtly different hacks. When run from ssh, bash -c "CMD"
will run .bashrc, but not "$ENV". ash will run "$ENV", but not .[b]ashrc

Care to just add functionality to ash to have .ashrc startup file, with the same
rules as bash has for .bashrc?


More information about the busybox mailing list