From unknown Mon Jun 23 23:49:16 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#29035 <29035@debbugs.gnu.org> To: bug#29035 <29035@debbugs.gnu.org> Subject: Status: .bashrc updates Reply-To: bug#29035 <29035@debbugs.gnu.org> Date: Tue, 24 Jun 2025 06:49:16 +0000 retitle 29035 .bashrc updates reassign 29035 guix-patches submitter 29035 Marius Bakke severity 29035 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 27 19:50:46 2017 Received: (at submit) by debbugs.gnu.org; 27 Oct 2017 23:50:46 +0000 Received: from localhost ([127.0.0.1]:37855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8EOj-00057u-UT for submit@debbugs.gnu.org; Fri, 27 Oct 2017 19:50:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54843) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8EOh-00057i-TZ for submit@debbugs.gnu.org; Fri, 27 Oct 2017 19:50:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e8EOb-00009t-VE for submit@debbugs.gnu.org; Fri, 27 Oct 2017 19:50:38 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:54940) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e8EOb-00009a-Qu for submit@debbugs.gnu.org; Fri, 27 Oct 2017 19:50:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e8EOa-0002n6-Nf for guix-patches@gnu.org; Fri, 27 Oct 2017 19:50:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e8EOX-00004r-MR for guix-patches@gnu.org; Fri, 27 Oct 2017 19:50:36 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:51953) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e8EOX-0008UX-A0 for guix-patches@gnu.org; Fri, 27 Oct 2017 19:50:33 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 6F21D20BD4 for ; Fri, 27 Oct 2017 19:50:30 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Fri, 27 Oct 2017 19:50:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= content-type:date:from:message-id:mime-version:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=djfn/Uk4F8hcoNka3 4vmLy1BqXSN3ntdvkhH5MXJYdE=; b=HVdYBGYMZiVyYhVJD6l3fVBH0G5TowsF0 yEegb3mS1pDDEQ8CDPyn/xLABNx8FkmgNqo7NKqnN3L+WSgsyrW6ro9s4xAblUUO /1Ab23frrDm7twBaRIPpiP6xeWVTfOhCTKi9wqXG4Xdpqk3Wazn0G5XZR0FQvQHw 7qzLI6cuX2GOKufQa3vB0oJWkRm2OoV5yUuRrMm8XyjwyWyaMGeJvm0gBTylWmtN c228SF6oaWoX9wFxILQxFnvBcZeOf7XH9F1Odm2TIyNJ+qja6YuMA060ms1E/OOR gNV0lcOClun7Do37jqxH2qJKa4p5/RwBC1T4uyESKlE3yWjTYmKlg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=djfn/Uk4F8hcoNka34vmLy1BqXSN3ntdvkhH5MXJYdE=; b=FbkfhsiG G11CVUfJwt4VnNuZQBgqeADtabLDITyJ54L4d1GoCCXEDQbHrzwff2DP4vTgb31m Hapg503Cqux2EDsG5cTb4uLIW3NOV/1ICdPS88fxVZV9MfBDjTRgN5ueQIi+iiL+ R6kGmLWHFR/xVvNXU2zjoFb3PrfK9qtisJk81gbcMW+yWj85tB6CAe0NZEHfuiTP tDXppUr58Zlh5+oOzp7DK5dtIX6Ee1dsBQ+K/cHl4eCSTUOZ+fKI+wv7SgQsisdQ ZWdNk84h3TWLRoPgZ3uHA9sUORK1LmI7zm2YzfOQRmW4keq8deFanRhgBuNHwDsT ov870goDQVXkRQ== X-ME-Sender: Received: from localhost (cm-84.214.173.174.getinternet.no [84.214.173.174]) by mail.messagingengine.com (Postfix) with ESMTPA id F0ED424009 for ; Fri, 27 Oct 2017 19:50:29 -0400 (EDT) From: Marius Bakke To: guix-patches@gnu.org Subject: .bashrc updates User-Agent: Notmuch/0.25.1 (https://notmuchmail.org) Emacs/25.3.1 (x86_64-pc-linux-gnu) Date: Sat, 28 Oct 2017 01:50:28 +0200 Message-ID: <87mv4cxi9n.fsf@fastmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.4 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.4 (----) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hello Guix! These patches changes the default .bashrc so that it always sources /etc/profile when the shell is non-interactive, and promptly exits after that. Marius Bakke (2): skel: Test for interactive shell instead of $SSH_CLIENT in .bashrc. skel: Return early from .bashrc when the shell is non-interactive. gnu/system/shadow.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) =2D-=20 2.14.3 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlnzxkQACgkQoqBt8qM6 VPq1vggAwsbId/w+OgDu8cROPq5RIuCQB9GSonAcwUtefXKQhgm0CUmrPgjs1wO0 g9Ogp2IfF1kG7YFrT6k3jURwvj0dBLtx8LFlS4KfQOej+gW34BWV08yjGKLVnJd2 VQ16tubX1YqLs15DZhIfEOQKv0eelLjTESYW1gOnyNISHy03WfGyWxZS7PMPSq62 Xsgr6zSvAz+HlU7ra598z6KpwgUKUWpRq7rBz8CTxIFc+HSnPUXYUT3SgMzJWOuG LL+3Tz/7uXi6qjYwCDwSH+4oXWkB2isz/IYT5MIaP5p1RMWQRi2CVxOf4ep/Xn7y 0fOvyvUZoEOjP5UVIMNpIhY8mFF2Ag== =cSyh -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 27 19:54:12 2017 Received: (at 29035) by debbugs.gnu.org; 27 Oct 2017 23:54:12 +0000 Received: from localhost ([127.0.0.1]:37862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8ES4-0005DW-E7 for submit@debbugs.gnu.org; Fri, 27 Oct 2017 19:54:12 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:59277) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8ES2-0005DN-Q7 for 29035@debbugs.gnu.org; Fri, 27 Oct 2017 19:54:11 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 0155B20B53; Fri, 27 Oct 2017 19:54:10 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Fri, 27 Oct 2017 19:54:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=N0PiMC8oELCUlMHBDCIgy1woUWUkU6hIRWqpZFbeL yo=; b=3z36l3ItbuBEwykzyvyF6+UQDQFcmsQuZO0EB8nqwXYPv59SnJCUrgNQ9 P+RF7kMVgIqyG5oQLdMwxFHy1EaF3ZY8P9M3v3eCBNR+u2b/J9+30LzccMiL6Fb2 W1sXTxrslEtzDgLElwPmvjiLo/TMwpigZS2V43/dERFs1iwr8VkItITGQJh8F+7Z IEXT2WrT/rB7j+OB/3epngXEWE1YJIEihevlN6tEuaijZlyUndB0Q4RxSNfe5PVB sT9TOyskJ0MHqeAcJzSozj4bYZFhdT/kSIkJ0Hib5ZhbGGU2h90iAzsji67rlA64 R/WivoDNPgnBCQzNatuA04T+AuKbg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=N0PiMC8oELCUlMHBD CIgy1woUWUkU6hIRWqpZFbeLyo=; b=eSqhx/WjW0qqnBx7bPo5GCvSmYcSWjR0n Mqy9pNYno1bn3P6mALdAWnkr+/l/el/kLn10z+/LzbbZbbIXgjGfogazASP/Vv3D SSSAjCvL3WScp4upkEljsoc+fITySSXK+uWxfzMyz0iQ2mRJjipdLvFATAlJzbAM F9zIgqtkzP6tjOCzzOvAdHbRVQ6KOEEDwvOl1V9LB28pnChhxbdM3pFS4lMp3vVB 7Cay54eSCFnn1ErUuoJeKKricsnxgAmS3C7Apnvjo4ouOKVE+FTajxJjSVQFzeYY SyhfVwEwi16MqT0B7coT1y/DS4Se39FDpS0NEI9vSl/dZH28x76Wg== X-ME-Sender: Received: from localhost (cm-84.214.173.174.getinternet.no [84.214.173.174]) by mail.messagingengine.com (Postfix) with ESMTPA id 88CC024009; Fri, 27 Oct 2017 19:54:09 -0400 (EDT) From: Marius Bakke To: 29035@debbugs.gnu.org Subject: [PATCH 1/2] skel: Test for interactive shell instead of $SSH_CLIENT in .bashrc. Date: Sat, 28 Oct 2017 01:53:56 +0200 Message-Id: <20171027235357.28600-1-mbakke@fastmail.com> X-Mailer: git-send-email 2.14.3 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 29035 Cc: Marius Bakke X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) * gnu/system/shadow.scm (default-skeletons): Instead of testing for $SSH_CLIENT, check whether '$-' includes the letter 'i'. --- gnu/system/shadow.scm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 236807c70..475960b89 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -157,12 +157,11 @@ if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n")) # honor it and otherwise use /bin/sh. export SHELL -if [ -n \"$SSH_CLIENT\" -a -z \"`type -P cat`\" ] +if [[ $- != *i* ]] then # We are being invoked from a non-interactive SSH session - # (as in \"ssh host command\") but 'cat' cannot be found - # in $PATH. Source /etc/profile so we get $PATH and other - # essential variables. + # (as in \"ssh host command\"). Source /etc/profile so we + # get $PATH and other essential variables. source /etc/profile fi -- 2.14.3 From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 27 19:54:17 2017 Received: (at 29035) by debbugs.gnu.org; 27 Oct 2017 23:54:18 +0000 Received: from localhost ([127.0.0.1]:37867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8ES9-0005Dp-MR for submit@debbugs.gnu.org; Fri, 27 Oct 2017 19:54:17 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:37441) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8ES4-0005De-SD for 29035@debbugs.gnu.org; Fri, 27 Oct 2017 19:54:13 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id ADA5520AE2; Fri, 27 Oct 2017 19:54:12 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Fri, 27 Oct 2017 19:54:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=3teQdYpYuF5a9b9+b V24+qGSrojiUBxBNc+dx+wI6XA=; b=EqGPwnQ1QLk68THarwFdYo/fYSVit1MlM Y6T5WyWtXiOUy+WFoO24uBUIrBwvl2qbktnkE8Y1arXGU+bFn4Ncu3wtFyA8rRi0 An3nNz9UgHTzjgCiFdjtEbepOkH0EFXJZpFGX8dZAUI4QYV1nUx6U9byO7BGKar7 RAv2l8v4iHtOlllP84L0C3RGUgfzNfGyjDJN3O/1HK2vlsxb2qdmqFmI2T9WujjO DycfdLkFYa6jt3MXuPlPTcnRAaeex9UD763VBsObfHhCxe2eEmDdkwWOhCjJWK7A HU2EQE/jOFnRPRgcZ3UbLT0kRY55F9qhkJccYAdGjA4uj2+buTxLA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=3teQdYpYuF5a9b9+bV24+qGSrojiUBxBNc+dx+wI6XA=; b=YB7S8HsW bACBWgzRfJZh2avpvuPI2p+Ivxv2qKJZzvmyltzFhaStJ+Iho1hMAE9bpBmRaA5a mas6mcqqkVvabGcgmb7g2VPtu4Qk03T6vfEPR4G24Fzs1nv6yB2K35td+wMfyYGe iVlOp1ljWAciv1aDLc5HWqIgyIB2dUWicMrVqVmQ6iMq2BANIiFbBz9G5ZmDGaKf wVpxagh3kcoSl5sd37nrAsRMpAKLOAFCgKaPVwOrVzsZ3dL/jtMIgGKVjLubrrxe 5mLUwQ5WEcR0fFljkG2ge66txPzukmTKxdZF2uTjGxIh0kr13OBkq7TdbKSJzSMY BGYYQNb6LirbJg== X-ME-Sender: Received: from localhost (cm-84.214.173.174.getinternet.no [84.214.173.174]) by mail.messagingengine.com (Postfix) with ESMTPA id 1245924009; Fri, 27 Oct 2017 19:54:11 -0400 (EDT) From: Marius Bakke To: 29035@debbugs.gnu.org Subject: [PATCH 2/2] skel: Return early from .bashrc when the shell is non-interactive. Date: Sat, 28 Oct 2017 01:53:57 +0200 Message-Id: <20171027235357.28600-2-mbakke@fastmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171027235357.28600-1-mbakke@fastmail.com> References: <20171027235357.28600-1-mbakke@fastmail.com> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 29035 Cc: Marius Bakke X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) * gnu/system/shadow.scm (default-skeletons): Add return statement. --- gnu/system/shadow.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 475960b89..8d8dbc70a 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -163,6 +163,9 @@ then # (as in \"ssh host command\"). Source /etc/profile so we # get $PATH and other essential variables. source /etc/profile + + # Don't do anything else. + return fi # Adjust the prompt depending on whether we're in 'guix environment'. -- 2.14.3 From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 28 03:57:39 2017 Received: (at 29035) by debbugs.gnu.org; 28 Oct 2017 07:57:39 +0000 Received: from localhost ([127.0.0.1]:38008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8Lzv-0000Mu-Ir for submit@debbugs.gnu.org; Sat, 28 Oct 2017 03:57:39 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:57922) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8Lzt-0000Ml-RJ for 29035@debbugs.gnu.org; Sat, 28 Oct 2017 03:57:38 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 81158F5D1; Sat, 28 Oct 2017 09:57:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v5V5LSEpUCkD; Sat, 28 Oct 2017 09:57:37 +0200 (CEST) Received: from ribbon (smb-adpcdg1-02.hotspot.hub-one.net [213.174.99.130]) by hera.aquilenet.fr (Postfix) with ESMTPSA id CC4C7F559; Sat, 28 Oct 2017 09:57:37 +0200 (CEST) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Marius Bakke Subject: Re: [bug#29035] [PATCH 1/2] skel: Test for interactive shell instead of $SSH_CLIENT in .bashrc. References: <87mv4cxi9n.fsf@fastmail.com> <20171027235357.28600-1-mbakke@fastmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 7 Brumaire an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 28 Oct 2017 09:57:33 +0200 In-Reply-To: <20171027235357.28600-1-mbakke@fastmail.com> (Marius Bakke's message of "Sat, 28 Oct 2017 01:53:56 +0200") Message-ID: <87lgjv7lhu.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 29035 Cc: 29035@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Heya, Marius Bakke skribis: > * gnu/system/shadow.scm (default-skeletons): Instead of testing for > $SSH_CLIENT, check whether '$-' includes the letter 'i'. That=E2=80=99s an improvement indeed, LGTM! Ludo=E2=80=99, who can still learn new things about Bash after all these ye= ars. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 28 03:59:16 2017 Received: (at 29035) by debbugs.gnu.org; 28 Oct 2017 07:59:16 +0000 Received: from localhost ([127.0.0.1]:38012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8M1T-0000PZ-Uj for submit@debbugs.gnu.org; Sat, 28 Oct 2017 03:59:16 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:57926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8M1S-0000PR-KN for 29035@debbugs.gnu.org; Sat, 28 Oct 2017 03:59:14 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 63B7FF5D1; Sat, 28 Oct 2017 09:59:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZPMZ8vwX724n; Sat, 28 Oct 2017 09:59:14 +0200 (CEST) Received: from ribbon (smb-adpcdg1-02.hotspot.hub-one.net [213.174.99.130]) by hera.aquilenet.fr (Postfix) with ESMTPSA id BB065F559; Sat, 28 Oct 2017 09:59:14 +0200 (CEST) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Marius Bakke Subject: Re: [bug#29035] [PATCH 2/2] skel: Return early from .bashrc when the shell is non-interactive. References: <20171027235357.28600-1-mbakke@fastmail.com> <20171027235357.28600-2-mbakke@fastmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 7 Brumaire an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 28 Oct 2017 09:59:10 +0200 In-Reply-To: <20171027235357.28600-2-mbakke@fastmail.com> (Marius Bakke's message of "Sat, 28 Oct 2017 01:53:57 +0200") Message-ID: <87h8uj7lf5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 29035 Cc: 29035@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Marius Bakke skribis: > * gnu/system/shadow.scm (default-skeletons): Add return statement. > --- > gnu/system/shadow.scm | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm > index 475960b89..8d8dbc70a 100644 > --- a/gnu/system/shadow.scm > +++ b/gnu/system/shadow.scm > @@ -163,6 +163,9 @@ then > # (as in \"ssh host command\"). Source /etc/profile so we > # get $PATH and other essential variables. > source /etc/profile > + > + # Don't do anything else. > + return > fi LGTM, thanks! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 29 06:17:16 2017 Received: (at 29035) by debbugs.gnu.org; 29 Oct 2017 10:17:16 +0000 Received: from localhost ([127.0.0.1]:39765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8kea-00043X-5L for submit@debbugs.gnu.org; Sun, 29 Oct 2017 06:17:16 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:56439) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8keY-00043O-8d for 29035@debbugs.gnu.org; Sun, 29 Oct 2017 06:17:14 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 8E189206CC; Sun, 29 Oct 2017 06:17:12 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sun, 29 Oct 2017 06:17:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=svvO2y29VCL7v7ke+wBRF15WECbukiywxKjmeBSlDS0=; b=qRmE3m7R Ma5Ghz4Ey006xf6llInsv6nzE1EyndxKtya1nvSJPANPqEN9M7HRda3RUXQXbx42 51v6FIcVymXC4bG126CeUOReaqLbJyKudYOqfqXIFNqbQyUocJtZ/ySCtQ9U5UuP ZBTEBfyv53rD4x+4haH7ZDGI1n8t4uVXLwM+uRSMFiG5010nPDckUCodzu7Wn6gL dLmhXaey9yhQhcjD0bzy7Gw/YJKnyxxhmpBrtpJphYcpSEH0kavoxU6rECkz2M4I v2CXpFaeBZYoNGcAko8noHA1dcerBW2P3s+nMli4DoD1ZpCdDKNY16bixSXhkimi 6gy5F1UYn4AuOA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=svvO2y29VCL7v7ke+wBRF15WECbuk iywxKjmeBSlDS0=; b=WazgteBVZHgCWuvX8mQd1UqaV9hvWs3O40HSsCipflGw0 YYrZ+sRnBz3h93r7np4v7m/JV/OS1QjEvB4Yeuk1bkZ7sYtweGs5gE1+OPBT7pVg RPeSqHgX9ts6ctLjPqqDZKyPrhWmfucr6N7HJBLL9P8wg9NOh8rQgo+NdSpQ0iQm awwP3mJtG8TY4J0W/TFfthUuK24GuThllnJ/bsTYuqjtfAe0gycqbaTJEVj/7Dfb xUygYD7lyOCHeEl1Ll7yHbGaHfJ2TfmkkxTFzAdcFh0gE8LuwvYBipi5ZgGwuVnK BB41KVbn8yK81B+2oOPhdbFRqXi/Yft7hFozoe+ig== X-ME-Sender: Received: from localhost (cm-84.214.173.174.getinternet.no [84.214.173.174]) by mail.messagingengine.com (Postfix) with ESMTPA id 1993A7FAA3; Sun, 29 Oct 2017 06:17:11 -0400 (EDT) From: Marius Bakke To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#29035] [PATCH 1/2] skel: Test for interactive shell instead of $SSH_CLIENT in .bashrc. In-Reply-To: <87lgjv7lhu.fsf@gnu.org> References: <87mv4cxi9n.fsf@fastmail.com> <20171027235357.28600-1-mbakke@fastmail.com> <87lgjv7lhu.fsf@gnu.org> User-Agent: Notmuch/0.25.1 (https://notmuchmail.org) Emacs/25.3.1 (x86_64-pc-linux-gnu) Date: Sun, 29 Oct 2017 11:17:10 +0100 Message-ID: <8760ay5kd5.fsf@fastmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 29035 Cc: 29035@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Heya, > > Marius Bakke skribis: > >> * gnu/system/shadow.scm (default-skeletons): Instead of testing for >> $SSH_CLIENT, check whether '$-' includes the letter 'i'. > > That=E2=80=99s an improvement indeed, LGTM! I realized this will source /etc/profile twice when bash is invoked as 'bash -l -c foo', which isn't great. It also assumes /etc/profile exists at all, which might not hold true e.g. in a container. The main motivation for this commit is to make things like 'git-receive-pack', 'rsync' etc work out-of-the-box when installed in a user profile. The test for `cat` was ineffective on OpenSSH since it has a default PATH set to "/run/current-system/profile/bin". I've tested adding ~/.guix-profile/bin to the compiled-in default OpenSSH PATH instead, and it works. WDYT of this series? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=bashrc.patch Content-Transfer-Encoding: quoted-printable From=20fc37dd6dfb6beab9cc4e52de7b7c98946125e7cc Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sun, 29 Oct 2017 10:31:25 +0100 Subject: [PATCH 1/3] gnu: openssh: Add user profiles to the default PATH. * gnu/packages/ssh.scm (openssh)[arguments]<#:configure-flags>: Add '~/guix-profile/bin' to '--with-default-path' arguments. =2D-- gnu/packages/ssh.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnu/packages/ssh.scm b/gnu/packages/ssh.scm index 8317f29cd..2aeeeae1e 100644 =2D-- a/gnu/packages/ssh.scm +++ b/gnu/packages/ssh.scm @@ -149,7 +149,9 @@ a server that supports the SSH-2 protocol.") #:configure-flags `("--sysconfdir=3D/etc/ssh" =20 ;; Default value of 'PATH' used by sshd. =2D "--with-default-path=3D/run/current-system/pro= file/bin" + ,(string-append "--with-default-path=3D" + "/run/current-system/profile/bi= n:" + "~/.guix-profile/bin") =20 ;; configure needs to find krb5-config ,(string-append "--with-kerberos5=3D" =2D-=20 2.14.3 From=20cc817dd809c85571d3e54a226ff16a7a3aa5bdae Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sun, 29 Oct 2017 11:07:49 +0100 Subject: [PATCH 2/3] system: Don't try to source /etc/profile in '.bashrc' skeleton. * gnu/system/shadow.scm (default-skeletons)[bashrc]: Remove test for $SSH_C= LIENT. =2D-- gnu/system/shadow.scm | 9 --------- 1 file changed, 9 deletions(-) diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 236807c70..f6484f85e 100644 =2D-- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -157,15 +157,6 @@ if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n")) # honor it and otherwise use /bin/sh. export SHELL =20 =2Dif [ -n \"$SSH_CLIENT\" -a -z \"`type -P cat`\" ] =2Dthen =2D # We are being invoked from a non-interactive SSH session =2D # (as in \"ssh host command\") but 'cat' cannot be found =2D # in $PATH. Source /etc/profile so we get $PATH and other =2D # essential variables. =2D source /etc/profile =2Dfi =2D # Adjust the prompt depending on whether we're in 'guix environment'. if [ -n \"$GUIX_ENVIRONMENT\" ] then =2D-=20 2.14.3 From=2053761ac682cf0de4161c40aa7ec5372a2070c2b2 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sat, 28 Oct 2017 01:19:01 +0200 Subject: [PATCH 3/3] system: Return early in skeleton '.bashrc' when the sh= ell is non-interactive. * gnu/system/shadow.scm (default-skeletons)[bashrc]: Test if $- includes the letter 'i', and return if it doesn't. =2D-- gnu/system/shadow.scm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index f6484f85e..e1ff3c42d 100644 =2D-- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -157,6 +157,12 @@ if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n")) # honor it and otherwise use /bin/sh. export SHELL =20 +# If not running interactively, don't do anything else. +if [[ $- !=3D *i* ]] +then + return +fi + # Adjust the prompt depending on whether we're in 'guix environment'. if [ -n \"$GUIX_ENVIRONMENT\" ] then =2D-=20 2.14.3 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAln1qqYACgkQoqBt8qM6 VPryFggA1G4sayn5KVKr75W77Fl/7k7ZIHHp7mnmG0vb6QqHgI/0abnFp0ZMvvO1 +jDjVHGFiI0KsTriZVJvwQ7zRWCY7sndtOShTDKLcQy0MW6QmMDvmtlOATbuZpOS Qkl6zmQKAWSRO9cHnxM8Eq499UBOU1KVcg7MHwQrVm/o4LLYM9IbXkYr843+zxH/ 4n9vHW1q6qBkCR2G7P5obLayU8xvLAWmR66fUaFH7/eutHbk8ZtVzULB28HkGBw/ d0nMOKJjaFzXSjw9iPX48p75ZwICp/GL03cXpiHT13ShQ3uv/X1Pdb4JpCmLJKti aUjnO1OYnmMGeIf2dWZlpNGlSi+f8A== =0px6 -----END PGP SIGNATURE----- --==-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 29 10:24:49 2017 Received: (at 29035) by debbugs.gnu.org; 29 Oct 2017 14:24:49 +0000 Received: from localhost ([127.0.0.1]:40753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8oW9-0003hf-DK for submit@debbugs.gnu.org; Sun, 29 Oct 2017 10:24:49 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:33955) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8oW7-0003hW-L7 for 29035@debbugs.gnu.org; Sun, 29 Oct 2017 10:24:48 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id AEE5AF940; Sun, 29 Oct 2017 15:24:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zgT4QIL8ljqz; Sun, 29 Oct 2017 15:24:46 +0100 (CET) Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:6a6c:dc17:fc02:cfda]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 5FFF4F93E; Sun, 29 Oct 2017 15:24:46 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Marius Bakke Subject: Re: [bug#29035] [PATCH 1/2] skel: Test for interactive shell instead of $SSH_CLIENT in .bashrc. References: <87mv4cxi9n.fsf@fastmail.com> <20171027235357.28600-1-mbakke@fastmail.com> <87lgjv7lhu.fsf@gnu.org> <8760ay5kd5.fsf@fastmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 8 Brumaire an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 29 Oct 2017 15:24:44 +0100 In-Reply-To: <8760ay5kd5.fsf@fastmail.com> (Marius Bakke's message of "Sun, 29 Oct 2017 11:17:10 +0100") Message-ID: <877eve3uc3.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 29035 Cc: 29035@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Hi Marius! Marius Bakke skribis: > Ludovic Court=C3=A8s writes: > >> Heya, >> >> Marius Bakke skribis: >> >>> * gnu/system/shadow.scm (default-skeletons): Instead of testing for >>> $SSH_CLIENT, check whether '$-' includes the letter 'i'. >> >> That=E2=80=99s an improvement indeed, LGTM! > > I realized this will source /etc/profile twice when bash is invoked as > 'bash -l -c foo', which isn't great. It also assumes /etc/profile > exists at all, which might not hold true e.g. in a container. OK. (Though GuixSD containers do have /etc/profile, don=E2=80=99t they?) > The main motivation for this commit is to make things like > 'git-receive-pack', 'rsync' etc work out-of-the-box when installed in > a user profile. The test for `cat` was ineffective on OpenSSH since it > has a default PATH set to "/run/current-system/profile/bin". > > I've tested adding ~/.guix-profile/bin to the compiled-in default > OpenSSH PATH instead, and it works. WDYT of this series? OK. I think it would make sense to add a test to (gnu tests ssh) for this, because it=E2=80=99s one of these things that annoy everyone. > From fc37dd6dfb6beab9cc4e52de7b7c98946125e7cc Mon Sep 17 00:00:00 2001 > From: Marius Bakke > Date: Sun, 29 Oct 2017 10:31:25 +0100 > Subject: [PATCH 1/3] gnu: openssh: Add user profiles to the default PATH. > > * gnu/packages/ssh.scm (openssh)[arguments]<#:configure-flags>: Add > '~/guix-profile/bin' to '--with-default-path' arguments. > --- > gnu/packages/ssh.scm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/gnu/packages/ssh.scm b/gnu/packages/ssh.scm > index 8317f29cd..2aeeeae1e 100644 > --- a/gnu/packages/ssh.scm > +++ b/gnu/packages/ssh.scm > @@ -149,7 +149,9 @@ a server that supports the SSH-2 protocol.") > #:configure-flags `("--sysconfdir=3D/etc/ssh" >=20=20 > ;; Default value of 'PATH' used by sshd. > - "--with-default-path=3D/run/current-system/pro= file/bin" > + ,(string-append "--with-default-path=3D" > + "/run/current-system/profile/= bin:" > + "~/.guix-profile/bin") If sshd performs tilde expansion, that=E2=80=99s fine with me. Should we do something similar for lsh and Dropbear? > From cc817dd809c85571d3e54a226ff16a7a3aa5bdae Mon Sep 17 00:00:00 2001 > From: Marius Bakke > Date: Sun, 29 Oct 2017 11:07:49 +0100 > Subject: [PATCH 2/3] system: Don't try to source /etc/profile in '.bashrc' > skeleton. > > * gnu/system/shadow.scm (default-skeletons)[bashrc]: Remove test for $SSH= _CLIENT. OK. > From 53761ac682cf0de4161c40aa7ec5372a2070c2b2 Mon Sep 17 00:00:00 2001 > From: Marius Bakke > Date: Sat, 28 Oct 2017 01:19:01 +0200 > Subject: [PATCH 3/3] system: Return early in skeleton '.bashrc' when the = shell > is non-interactive. > > * gnu/system/shadow.scm (default-skeletons)[bashrc]: Test if $- includes = the > letter 'i', and return if it doesn't. OK. Thank you! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 29 16:07:46 2017 Received: (at 29035) by debbugs.gnu.org; 29 Oct 2017 20:07:47 +0000 Received: from localhost ([127.0.0.1]:40932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8ts2-0005Fm-H1 for submit@debbugs.gnu.org; Sun, 29 Oct 2017 16:07:46 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:54789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8ts0-0005Fd-OY for 29035@debbugs.gnu.org; Sun, 29 Oct 2017 16:07:45 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id C643621649; Sun, 29 Oct 2017 16:07:42 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Sun, 29 Oct 2017 16:07:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=p4GaU068nDbGnmMjc7MFqs4pdg3PPOO9sINZWOc3q34=; b=wv4JsGRz BqTQIBWJGtPV0ZHJCjhtO9cM3eQz/8oPpRxQZhG/l+UJTFWRHuTHGBGXMjzzmfjs l+ki2/EopRsWlEaFlE2CEansPDcll/T+9vErzb5BrxIhyY3tRtT6hhNquJIcy4Tl maaPsuptBjqArizYwhKnuRev6om8ZrcR2MHQEfMQwD1zhkasVLZZ4Zhla3m+il1B kXsJv0fqW39p+XHdJ0cxKvmfGYkgRReqVK/JGnrTEuAIL3uHcJp+3ZlePTBOK+ti W9wY8pKNrVnVElT76S0rEFludNUa+j5N3sKRYQwv5X1TvCuq3lPSVgf3+fdIMtE+ qop6HTZWHC7XdA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=p4GaU068nDbGnmMjc7MFqs4pdg3PP OO9sINZWOc3q34=; b=p9NKhMsxLg5AapmNVUX9g5N8sjlDPELKstElxc7Y1xYgP r4HkvgeG4MsdxuCaPdmkb62qZ7c0X9xjJMeEpscl3IFTs3EBYVSqbgApNrokpyfg z4JCh9twbgMm2a+ighAii5LNDaDFE8u7l4y/oKfREWbg9H2b/4/KkEEwdnx7E6QL FjwqaCO1SZnm1a/r/QBx5gdyMKYJqLmmSAe3t7pDKEEkRPb9+8II83zX7n7+ZdSk vRU5nIU2P/DWNoEDDQTpnyghotQU8LRw6ZUSiaP5wfmX9VwwEvPTc9fxvncwHwMA ffzzvEhrvytGwBVX/TUw+l4HeD8vTl/EDmtngb3Jg== X-ME-Sender: Received: from localhost (cm-84.214.173.174.getinternet.no [84.214.173.174]) by mail.messagingengine.com (Postfix) with ESMTPA id 57045247F0; Sun, 29 Oct 2017 16:07:42 -0400 (EDT) From: Marius Bakke To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#29035] [PATCH 1/2] skel: Test for interactive shell instead of $SSH_CLIENT in .bashrc. In-Reply-To: <877eve3uc3.fsf@gnu.org> References: <87mv4cxi9n.fsf@fastmail.com> <20171027235357.28600-1-mbakke@fastmail.com> <87lgjv7lhu.fsf@gnu.org> <8760ay5kd5.fsf@fastmail.com> <877eve3uc3.fsf@gnu.org> User-Agent: Notmuch/0.25.1 (https://notmuchmail.org) Emacs/25.3.1 (x86_64-pc-linux-gnu) Date: Sun, 29 Oct 2017 21:07:40 +0100 Message-ID: <87y3nt4t0z.fsf@fastmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 29035 Cc: 29035@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Hi Marius! > > Marius Bakke skribis: > >> Ludovic Court=C3=A8s writes: >> >>> Heya, >>> >>> Marius Bakke skribis: >>> >>>> * gnu/system/shadow.scm (default-skeletons): Instead of testing for >>>> $SSH_CLIENT, check whether '$-' includes the letter 'i'. >>> >>> That=E2=80=99s an improvement indeed, LGTM! >> >> I realized this will source /etc/profile twice when bash is invoked as >> 'bash -l -c foo', which isn't great. It also assumes /etc/profile >> exists at all, which might not hold true e.g. in a container. > > OK. (Though GuixSD containers do have /etc/profile, don=E2=80=99t they?) I only checked `guix environment -C` (no further arguments!). >> The main motivation for this commit is to make things like >> 'git-receive-pack', 'rsync' etc work out-of-the-box when installed in >> a user profile. The test for `cat` was ineffective on OpenSSH since it >> has a default PATH set to "/run/current-system/profile/bin". >> >> I've tested adding ~/.guix-profile/bin to the compiled-in default >> OpenSSH PATH instead, and it works. WDYT of this series? > > OK. > > I think it would make sense to add a test to (gnu tests ssh) for this, > because it=E2=80=99s one of these things that annoy everyone. Good idea. I came up with this: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-tests-ssh-Make-sure-we-can-run-commands-from-PATH.patch Content-Transfer-Encoding: quoted-printable diff --git a/gnu/tests/ssh.scm b/gnu/tests/ssh.scm index 41be36035..6d367dc75 100644 =2D-- a/gnu/tests/ssh.scm +++ b/gnu/tests/ssh.scm @@ -169,6 +170,33 @@ root with an empty password." (call-with-remote-input-file sftp-session witness read))))) =20 + ;; Connect to the guest over SSH. Make sure we can run commands + ;; from the system profile. + (test-equal "run executables from system profile" + #t + (call-with-connected-session/auth + (lambda (session) + (let ((channel (make-channel session))) + (channel-open-session channel) + (channel-request-exec + channel + (string-append + "mkdir -p /root/.guix-profile/bin && " + "touch /root/.guix-profile/bin/witness && " + "chmod 755 /root/.guix-profile/bin/witness")) + (zero? (channel-get-exit-status channel)))))) + + ;; Connect to the guest over SSH. Make sure we can run commands + ;; that only exist in the user profile. + (test-equal "run executable from user profile" + #t + (call-with-connected-session/auth + (lambda (session) + (let ((channel (make-channel session))) + (channel-open-session channel) + (channel-request-exec channel "witness") + (zero? (channel-get-exit-status channel)))))) + (test-end) (exit (=3D (test-runner-fail-count (test-runner-current)) 0))))) =20 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable It works as expected with both approaches (changing .bashrc, and changing "--with-default-path"). WDYT? >> From fc37dd6dfb6beab9cc4e52de7b7c98946125e7cc Mon Sep 17 00:00:00 2001 >> From: Marius Bakke >> Date: Sun, 29 Oct 2017 10:31:25 +0100 >> Subject: [PATCH 1/3] gnu: openssh: Add user profiles to the default PATH. >> >> * gnu/packages/ssh.scm (openssh)[arguments]<#:configure-flags>: Add >> '~/guix-profile/bin' to '--with-default-path' arguments. >> --- >> gnu/packages/ssh.scm | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/gnu/packages/ssh.scm b/gnu/packages/ssh.scm >> index 8317f29cd..2aeeeae1e 100644 >> --- a/gnu/packages/ssh.scm >> +++ b/gnu/packages/ssh.scm >> @@ -149,7 +149,9 @@ a server that supports the SSH-2 protocol.") >> #:configure-flags `("--sysconfdir=3D/etc/ssh" >>=20=20 >> ;; Default value of 'PATH' used by sshd. >> - "--with-default-path=3D/run/current-system/pr= ofile/bin" >> + ,(string-append "--with-default-path=3D" >> + "/run/current-system/profile= /bin:" >> + "~/.guix-profile/bin") > > If sshd performs tilde expansion, that=E2=80=99s fine with me. Unfortunately, I think the tilde is expanded by the shell, and this made me look up how POSIX handles tilde in PATH. It appears bash, when invoked with '--posix', does *not* perform tilde expansion if it appears as the first character in a PATH element: (note 16) 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: (_PATH_STDPATH is the --with-default-path) > 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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-system-Test-for-interactive-shell-instead-of-cat-in-.patch Content-Transfer-Encoding: quoted-printable From=206f4dfbea9cd92a3b03d7e1db89c75a88f4495ba5 Mon Sep 17 00:00:00 2001 From: Marius Bakke 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. =2D-- gnu/system/shadow.scm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 236807c70..58613e620 100644 =2D-- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -157,13 +157,12 @@ if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n")) # honor it and otherwise use /bin/sh. export SHELL =20 =2Dif [ -n \"$SSH_CLIENT\" -a -z \"`type -P cat`\" ] +if [[ $- !=3D *i* ]] then =2D # We are being invoked from a non-interactive SSH session =2D # (as in \"ssh host command\") but 'cat' cannot be found =2D # in $PATH. Source /etc/profile so we get $PATH and other =2D # essential variables. =2D source /etc/profile + # We are being invoked from a non-interactive shell. If this + # is an SSH session (as in \"ssh host command\"), source + # /etc/profile so we get PATH and other essential variables. + [[ -n \"$SSH_CLIENT\" ]] && source /etc/profile fi =20 # Adjust the prompt depending on whether we're in 'guix environment'. =2D-=20 2.14.3 --=-=-= Content-Type: text/plain Thanks for the fast replies, and sorry for the round-trip! --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAln2NQwACgkQoqBt8qM6 VPpfnAgAgnfdQ3PTHHk9tyZvnIrRteVydWIWuArk2/0ywkGVH3osl3EmThlorkDU nI8hSTs8Xk/A37yfnaZ3yqn+uMybVqEnnYLaD4aW9008LHDO/hK5fWUxxmJQXCbW 1e4FQT1xfhJXfzZ82b0adwbgcguigGNM16wZav6KG6AN88WuMGRnvzRi53V/oj8X H6YdJnfDlo+8FbM5pLR9rDpY2eTFi1vKxX3nI0d8tmmAisI60KlrcxW9/uQKM4HH tdQT5yNg11ogGkjn8Dn3NlHoZHifU0FsMwVAx3+vsNqB6wXSc3cvi5HlMi6bHwxa 6ciUPemreevb4bG5Ca7g/yNlHhK1Og== =csAt -----END PGP SIGNATURE----- --==-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 29 17:26:23 2017 Received: (at 29035) by debbugs.gnu.org; 29 Oct 2017 21:26:23 +0000 Received: from localhost ([127.0.0.1]:41003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8v66-00077N-NR for submit@debbugs.gnu.org; Sun, 29 Oct 2017 17:26:22 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:35543) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e8v65-00077D-4H for 29035@debbugs.gnu.org; Sun, 29 Oct 2017 17:26:22 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 312A7F96D; Sun, 29 Oct 2017 22:26:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id f0Dp5ZcA4kFs; Sun, 29 Oct 2017 22:26:19 +0100 (CET) Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 48200F767; Sun, 29 Oct 2017 22:26:19 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Marius Bakke Subject: Re: [bug#29035] [PATCH 1/2] skel: Test for interactive shell instead of $SSH_CLIENT in .bashrc. References: <87mv4cxi9n.fsf@fastmail.com> <20171027235357.28600-1-mbakke@fastmail.com> <87lgjv7lhu.fsf@gnu.org> <8760ay5kd5.fsf@fastmail.com> <877eve3uc3.fsf@gnu.org> <87y3nt4t0z.fsf@fastmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 8 Brumaire an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 29 Oct 2017 22:26:16 +0100 In-Reply-To: <87y3nt4t0z.fsf@fastmail.com> (Marius Bakke's message of "Sun, 29 Oct 2017 21:07:40 +0100") Message-ID: <87r2tl1w93.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 29035 Cc: 29035@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Heya! Marius Bakke skribis: > Ludovic Court=C3=A8s writes: [...] >> I think it would make sense to add a test to (gnu tests ssh) for this, >> because it=E2=80=99s 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=E2=80=99t quite work (due to lack of t= ilde 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: > > > (_PATH_STDPATH is the --with-default-path) That=E2=80=99s maybe more than we=E2=80=99d like to do, and also doesn=E2= =80=99t 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 > 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 tes= t in > a conditional testing for interactive shell. LGTM. Thank you! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 01 16:38:11 2017 Received: (at 29035-done) by debbugs.gnu.org; 1 Nov 2017 20:38:11 +0000 Received: from localhost ([127.0.0.1]:46485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9zm5-0002qD-RP for submit@debbugs.gnu.org; Wed, 01 Nov 2017 16:38:10 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:37817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9zm2-0002q3-2z for 29035-done@debbugs.gnu.org; Wed, 01 Nov 2017 16:38:06 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 16186210FE; Wed, 1 Nov 2017 16:38:05 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Wed, 01 Nov 2017 16:38:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=k2nwDdVZai1yaQGeh0MMn6Vy5eE74DeYIPrQSCJyju0=; b=qxQBkR9I +TeKR8TYRp3Fpd38munTwS/OhQrMHAMiAZ/0YvsoFh/P/nkSqfHkdzmTanvrRO4o ndKN+8pl3HR7OL3tkxbxQY/camtdJEzOJzKzQAb/r5EpoOg1HSRboaclo8BTXfa/ sV2FGWOJw2QO1ZqJtD9ZyTkxVe4LbhpCDhoyRI8+nxRzqzcwhZXN8yMZxEDscI/X BArcLx7/7y+JixDHnXGO21dF6ADjdIHDPEUPgvB2ObPZltm8+eWmON7GwNTT8lmt KEYmaAJd9LBluJKIu5IiRsFMbEBsEyqUKIz5iibIdEpHWC7VCU6hZ3DE0B0Oj0gJ XamxfiL7XEhgdA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=k2nwDdVZai1yaQGeh0MMn6Vy5eE74 DeYIPrQSCJyju0=; b=A+ysIEgmbcaevhIm6LCXkMI961dhLeUcTXDmqHXhUB7qN EMnZYDGunLi+OM5NARykMX1uk30sTH0LuPcm9SC2XiSZymFUCycR1l8OZChtRJnG ISybK9e+f/bzYLLk5eu4TgyH8MsUR9q32yIbNLCr2LO6cnNyoE4+lGQxqMMSrgpr IWhqLhHhvYyrpDv/2PpKVH2zouG/aFTbJR0yI7YTUtHdHnJ/rIlhre8ke0DLVw7o GS32ao5wTXoBFKU0fQVNeeF7Ds/FUWUmjfn/24rFd8SuMgExjZCUyDEqyg0mlY2X kgiZyLYtiDaqNt9V++c0Vlpo+V3i0LpztPzzQNopg== X-ME-Sender: Received: from localhost (cm-84.214.173.174.getinternet.no [84.214.173.174]) by mail.messagingengine.com (Postfix) with ESMTPA id A9032247F0; Wed, 1 Nov 2017 16:38:04 -0400 (EDT) From: Marius Bakke To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#29035] [PATCH 1/2] skel: Test for interactive shell instead of $SSH_CLIENT in .bashrc. In-Reply-To: <87r2tl1w93.fsf@gnu.org> References: <87mv4cxi9n.fsf@fastmail.com> <20171027235357.28600-1-mbakke@fastmail.com> <87lgjv7lhu.fsf@gnu.org> <8760ay5kd5.fsf@fastmail.com> <877eve3uc3.fsf@gnu.org> <87y3nt4t0z.fsf@fastmail.com> <87r2tl1w93.fsf@gnu.org> User-Agent: Notmuch/0.25.1 (https://notmuchmail.org) Emacs/25.3.1 (x86_64-pc-linux-gnu) Date: Wed, 01 Nov 2017 21:38:03 +0100 Message-ID: <87fu9x4tw4.fsf@fastmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 29035-done Cc: 29035-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain Pushed revised series as 83a7a88f932..5d7141cd284e. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAln6MKsACgkQoqBt8qM6 VPpThggA0gN3snT0ZSAMFrDr2E6pNOTQCc7NqIOVT1ls+3vBppycRpjRK6c9J90Q N9dcxK/uwV2NffPmDLnj6xONoSlU74pPwlJIPDe2i/YbrC4yh5p2YLQBFuC9dgy5 y9ajFQz5cttxGIg/ZRNh5d0HZcDyee3r20yluKlCMkbwWvUg54TsNxJEL0JXTe4r ute1if01gcY1A5O+mtY+R+aVzLJtfzg3ZB4ESCEOV/U+lm/UnZmHqtvV1zijDOGS j8NGxwNgNbOGNiq6z9XnhNlgoRNnFtXvU4tazaNjlZdmEkdsbBP806iEgeyXS1Ms vT+cQoI6hz4TdHxAt/5vGI9rFy+Z+Q== =is8d -----END PGP SIGNATURE----- --=-=-=-- From unknown Mon Jun 23 23:49:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 30 Nov 2017 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator