Subject: [bug#29035] [PATCH 1/2] skel: Test for interactive shell instead of $SSH_CLIENT in .bashrc.

From: [email-masked] (Ludovic Courtès)
Date: Sun, 29 Oct 2017 22:26:16 +0100

Heya!

Marius Bakke <[email-masked]> skribis:

> Ludovic Courtès <[email-masked]> writes:

[...]

>> I think it would make sense to add a test to (gnu tests ssh) for this,
>> because it’s one of these things that annoy everyone.
>
> Good idea.  I came up with this:

Perfect!

> It works as expected with both approaches (changing .bashrc, and
> changing "--with-default-path").  WDYT?

Given that --with-default-path doesn’t quite work (due to lack of tilde
expansion), I suppose we should go for .bashrc?

> So while it works with "bash" as the login shell, unexpected results may
> occur with others.  It doesn't seem impossible to patch OpenSSH to
> perform this expansion, though:
>
> <https://github.com/openssh/openssh-portable/blob/b7548b12a6b2b4abf4d057192c353147e0abba08/session.c#L998>
> (_PATH_STDPATH is the --with-default-path)

That’s maybe more than we’d like to do, and also doesn’t help with the
two other SSH implementations.

>> Should we do something similar for lsh and Dropbear?
>
> Probably.  Since we have a system test, it's easy to experiment with.
> For now I think this .bashrc workaround might be the easiest approach,
> which makes the above test pass for both OpenSSH and Dropbear:
>
> From 6f4dfbea9cd92a3b03d7e1db89c75a88f4495ba5 Mon Sep 17 00:00:00 2001
> From: Marius Bakke <[email-masked]>
> Date: Sun, 29 Oct 2017 21:02:19 +0100
> Subject: [PATCH] system: Test for interactive shell instead of `cat` in
>  skeleton '.bashrc'.
>
> * gnu/system/shadow.scm (default-skeletons)[bashrc]: Wrap $SSH_CLIENT test in
> a conditional testing for interactive shell.

LGTM.

Thank you!

Ludo’.