From unknown Fri Jun 13 10:58:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66168: zsh home service breaks guix shell via ssh Resent-From: Malte Frank Gerdes Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 23 Sep 2023 10:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66168 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 66168@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.169546471624492 (code B ref -1); Sat, 23 Sep 2023 10:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Sep 2023 10:25:16 +0000 Received: from localhost ([127.0.0.1]:37842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjzp6-0006LW-6S for submit@debbugs.gnu.org; Sat, 23 Sep 2023 06:25:16 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjzp2-0006I5-VN for submit@debbugs.gnu.org; Sat, 23 Sep 2023 06:25:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjzom-0000c9-7M for bug-guix@gnu.org; Sat, 23 Sep 2023 06:24:56 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qjzok-0000zw-RT for bug-guix@gnu.org; Sat, 23 Sep 2023 06:24:55 -0400 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-52f3ba561d9so8501146a12.1 for ; Sat, 23 Sep 2023 03:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695464693; x=1696069493; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:user-agent:from:to:cc:subject:date:message-id:reply-to; bh=RsK+vewdcLQk+FDTp+pdGLom3k3FoC9MMvjVp9taJ74=; b=a35rGOs9pRE3kUCU8IxkfW4vbwNNGwNMixwRb14f1bjGNyOev50d9DcNlByB5JBQiU oLTDUhafE6DrrBr8qWzlnx6yyAKvkfqifOh2AtYo23INaxqxL0q436oriZxPKuZ9xW+z cnSZKcwmLU+2a+n131a4okefeXtF4k3V2FshTQwWbwwOEMsu214ZYmeIqMis2OiFHHBV SXVNEKNuCI+O1AACLVr830QXSAwAdzZa75bbojtVaU9pqMnXGP/9XtMZxrq9/H0OUSRb s94jJzYOno+JmfnKrIQX7aomlvtB/w1jVpb4jy6bncwaN4gNIzjO2T4sma2e6iopqODJ FqDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695464693; x=1696069493; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:user-agent:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RsK+vewdcLQk+FDTp+pdGLom3k3FoC9MMvjVp9taJ74=; b=u0ESamM5dIfBXRZb9u7hsdSkacsNyDcKXkgNqk2PdtxNEwx/KNMKA9ycCzzVOvmZjO Zro/kwPZ3PXbo1ZLSpxgmPqbDsXgKH6KC+UpL70pjcXW1YQQTiffj2aXbbg09dPLYuJu gFe9hq/km4WqXYrYcz4kuK1vUao/Rw2ngib+zWONBigo1eHlANWjhyQenIH0gycA+fzh lU2u+qOl0GFtU3Qx2SgGpExfePrqWN3Os1Rah4nx+mWk6h3C8Y66Xre1hASM7y2bOrZ9 p1IsV5wgMrPyEm7jVgf1i4mtn6c1PwKE5mOfpMbSaS0WhVFadh9yVzWPAJ/i2jEXNxtp +QdQ== X-Gm-Message-State: AOJu0YxGjMFKpwqL7rG9R/lyfjSfh/ibwSb364AXAxI/1UNcshUOShTM Y9/EVjd5ko0vVFMRwteGjQH4yKPFuI8= X-Google-Smtp-Source: AGHT+IEq+ayoDlyIdhKMvMUVEPjQ4nwrTJJBsk4u7hU2dYKREg2nRjJDV3sQbFMdomM79wQD2j9+sw== X-Received: by 2002:aa7:c914:0:b0:522:b876:9ef5 with SMTP id b20-20020aa7c914000000b00522b8769ef5mr3022390edt.8.1695464692675; Sat, 23 Sep 2023 03:24:52 -0700 (PDT) Received: from Methadon ([2a02:908:d13:e3e0:6a54:5aff:fe66:a805]) by smtp.gmail.com with ESMTPSA id be25-20020a0564021a3900b00530c81ad54asm3253252edb.41.2023.09.23.03.24.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 03:24:52 -0700 (PDT) User-agent: mu4e 1.10.7; emacs 29.0.92 From: Malte Frank Gerdes Date: Sat, 23 Sep 2023 12:19:10 +0200 Message-ID: <868r8xrxu4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=malte.f.gerdes@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) 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.0 (/) Hi, i set up a new system last weekend and am connecting to it via ssh. I also just recently started using guix home. I noticed that after connecting via ssh the profile that gets created when doing `guix shell' is not sourced, therefore the environment variables are not correct. This seems to be because guix home inserts "[ -n \"$SSH_CLIENT\" ] && source /etc/profile" into the zshenv file. I assume this is meant to ensure that /etc/profile is sourced because ssh does not start a login shell? Anyway, removing that line makes everything work normally. So am i doing it wrong or is this actually unnecessary? mfg=C2=B2 From unknown Fri Jun 13 10:58:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66168: zsh home service breaks guix shell via ssh Resent-From: Saku Laesvuori Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 24 Sep 2023 15:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66168 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Malte Frank Gerdes Cc: 66168@debbugs.gnu.org Received: via spool by 66168-submit@debbugs.gnu.org id=B66168.169556925817883 (code B ref 66168); Sun, 24 Sep 2023 15:28:02 +0000 Received: (at 66168) by debbugs.gnu.org; 24 Sep 2023 15:27:38 +0000 Received: from localhost ([127.0.0.1]:43425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkR1C-0004eK-5a for submit@debbugs.gnu.org; Sun, 24 Sep 2023 11:27:37 -0400 Received: from vmi571514.contaboserver.net ([75.119.130.101]:58638 helo=mail.laesvuori.fi) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkR16-0004e6-4h for 66168@debbugs.gnu.org; Sun, 24 Sep 2023 11:27:32 -0400 Received: from X-kone (88-113-24-127.elisa-laajakaista.fi [88.113.24.127]) by mail.laesvuori.fi (Postfix) with ESMTPSA id 926B9340160; Sun, 24 Sep 2023 17:27:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1695569270; bh=tt7zqQyBwWI7XkX693j13JX6O4hNoIbVp+tUztzxKX0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=KdabAZj+CRNsBghTo4oT+khkezPvZS8oCKrN/4D/uV1DDx8r2ecC0UW55Q92qrGRS dcdZo7sUUtxU1R0EMlD9OcJF1shsc/OKECTm44FDhpbsxpLXQ06dGuLKiafSW8/Jud m0J8LHGY/sPmHPY3awsvZF8hv2nQVRZPUs2EEahg= Date: Sun, 24 Sep 2023 18:27:08 +0300 From: Saku Laesvuori Message-ID: References: <868r8xrxu4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ef4ilseqyjhxk2nj" Content-Disposition: inline In-Reply-To: <868r8xrxu4.fsf@gmail.com> X-Spam-Score: -0.0 (/) 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 (-) --ef4ilseqyjhxk2nj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 23, 2023 at 12:19:10PM +0200, Malte Frank Gerdes wrote: > I noticed that after connecting via ssh the profile that gets created > when doing `guix shell' is not sourced, therefore the environment > variables are not correct. This seems to be because guix home inserts > "[ -n \"$SSH_CLIENT\" ] && source /etc/profile" into the zshenv file. I > assume this is meant to ensure that /etc/profile is sourced because ssh > does not start a login shell? That is correct, it was added in because commands like `ssh host -- cmd` (and commands depending on ssh such as `git pull/push`) failed.=20 > Anyway, removing that line makes everything work normally. So am i > doing it wrong or is this actually unnecessary? I can reproduce this: ``` $ ssh localhost $ guix shell gnuplot $ gnuplot zsh: command not found: gnuplot ``` However (still within the ssh session) ``` $ guix shell gnuplot -- gnuplot [gnuplot opens as expected] ``` and weirdly enough ``` $ guix shell --check gnuplot guix shell: checking the environment variables visible from shell '/gnu/sto= re/i4rj0banq044423if5xwb3df723g14r9-zsh-5.9/bin/zsh'... guix shell: All is good! The shell gets correct environment variables. $ gnuplot zsh: command not found: gnuplot ``` I don't really know what is happening here. Why does it work when running the command directly and why does `guix shell --check` claim that everything is correct when clearly something is wrong? If I understand correctly `.zshenv` should be sourced in all these cases but for some reason the problems only occur in some of them. Any ideas? --ef4ilseqyjhxk2nj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoMkZR3NPB29fCOn/JX0oSiodOjIFAmUQVUwACgkQJX0oSiod OjIKKxAAr1mNjtOoi5v5cqLEdmUTmv4KfAtdrpIUJ4orKhsjYtWDMVu9Bb180NAK JV2SkkgqoKFGLLXF3qdiURSrUXoju051Rx8OLkiTo9DC3FvJ9/etr9GzMjJo+e07 tMe1gX6DlqxV3vQ0zBRAIbfcIDmz3gWb2c1VHV9ElFErbbl5FUeh3my56zQDVDwI hR1pmQnwXJq+BKkvwCLr6qir47GpNk8Qnr/2oTF2rB92auroGLmtKm8z9DKcHv6v S8lUpl+5gojHZjJFmaenUz+GcqnWGLFy3QXBWmGD2KBkszkPQMzQP1ytFA8djOzI /8XEg5rWo501f+Gr/CAQxQiE3W1/3JSDxcY7wbmswSZwjb96De39RuDRAO0RzYLu EsJUTlNZioXXbv1NrI8am7y4rGcRSCs+L3Zf4UHOnv+9jYtONaV84q7r5zZxoUUr 9UjkS/hEs3pm57WYzmqwrzli3vmZ0pajxi9osliH9htmSNEIOWdHDvBuHFfaF0L5 rSHIti1i1si4xe7rT3qizibd67EDO+00zdEPtztzQv8Yiir5p62bCNaZ7DF4jYoU jP20tlSU+GyU+qk4UQKdYEZpV/L8vUk1gf/R3/JtAggx/9uvAVTQFLIKaigzMV2S oKA7uKXt7/BaCooNyBR5SGkbNm87dhgWpB62DSkCLvYdMvfr2UA= =MDMH -----END PGP SIGNATURE----- --ef4ilseqyjhxk2nj-- From unknown Fri Jun 13 10:58:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66168: zsh home service breaks guix shell via ssh Resent-From: Malte Frank Gerdes Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 24 Sep 2023 18:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66168 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Saku Laesvuori Cc: 66168@debbugs.gnu.org Received: via spool by 66168-submit@debbugs.gnu.org id=B66168.169558193228795 (code B ref 66168); Sun, 24 Sep 2023 18:59:01 +0000 Received: (at 66168) by debbugs.gnu.org; 24 Sep 2023 18:58:52 +0000 Received: from localhost ([127.0.0.1]:43621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkUJf-0007UM-J9 for submit@debbugs.gnu.org; Sun, 24 Sep 2023 14:58:51 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]:56729) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkUJc-0007U8-E8 for 66168@debbugs.gnu.org; Sun, 24 Sep 2023 14:58:49 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2b95d5ee18dso85351211fa.1 for <66168@debbugs.gnu.org>; Sun, 24 Sep 2023 11:58:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695581910; x=1696186710; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:from:to:cc:subject:date :message-id:reply-to; bh=Yu4i9T7FpA1Hj1CrGfDPMGYK9mf1wBchaoJsn61eZl0=; b=YyhbGzFbRRnq1htUYgI8YscKR4qKKqW/xHbLDvlcnwio0hrHVLvpfa2Zb1HC0GCRs/ vgEH56y6rSkpM6DOIAgCRtJgKfANcdlehnQsD+EiXAV7AqkdluyrGeNI4RI84U5h54jE RzWvzWqMFgwCAkGV3VH5hRWDAcLHbL4XE3VLqCskSZXy5QU8HEKLXH9lz+NvjH/MHQzl HehGCJQxVEmkwkmVDEN4WiUkMxJDTxZl/YRlwmJ5q2hic2lmy6ExT9duVm8WG3MQzQ0x fhskxEY3b6bZU6l74uQyuK1c6S8i3P5098d6jlejAtqwtzZ8RIHH8Tjeq/V6te6nczpp +xyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695581910; x=1696186710; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Yu4i9T7FpA1Hj1CrGfDPMGYK9mf1wBchaoJsn61eZl0=; b=gLYVfVeGiTKBfq9GaEsJLtPRy8IUzSxQEtb6er10E/CVQeyd04nv66z/fu20IQQXPE 5+VHj38bKxGzlDf2vQ45z3QISizQnvqfySeZXpCG1osoRher168MKDMxEm3bb7IUtwRN DGlaiF//Sg7jE+VPsSGoaVBv7L5BVeUhdvqZSquzReqbcDG/y9FFGcsl0jdeeYK4t4Y9 ZAaYWz0CoOfrCGcaZi+Q51ZSyO1NAfEwwqCLFNgjVpSd1/7c7vDJFMPO1KIaGkV3i193 1BbUDHSPg7YuCLSNRj1mbWpiyhNAWLO6V9o3+K+L/ffKwUrpYSdkTEiMZG5lxFe//cCm YCSw== X-Gm-Message-State: AOJu0YxZnVDKhbm0fnYRKSv8ZjUxQweQr4wnvFXQF5L+k7ds6akyUioI 6j4/HMujiy9Jii4S56SgJ+QZ+De7qio= X-Google-Smtp-Source: AGHT+IHvUNeOhaQWw6CCx1EWZHXx3iw6PeB+tS0sxfVQwxdwrrwQoELzEKBJOI1pqZU4qVx1RuRODw== X-Received: by 2002:a2e:8891:0:b0:2bc:b54b:c024 with SMTP id k17-20020a2e8891000000b002bcb54bc024mr3792785lji.29.1695581909944; Sun, 24 Sep 2023 11:58:29 -0700 (PDT) Received: from Methadon ([2a02:908:d13:e3e0:6a54:5aff:fe66:a805]) by smtp.gmail.com with ESMTPSA id va1-20020a17090711c100b00992ea405a79sm5279188ejb.166.2023.09.24.11.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 11:58:29 -0700 (PDT) References: <868r8xrxu4.fsf@gmail.com> User-agent: mu4e 1.10.7; emacs 29.0.92 From: Malte Frank Gerdes Date: Sun, 24 Sep 2023 20:48:44 +0200 In-reply-to: Message-ID: <86cyy75rg1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) 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 (-) Saku Laesvuori writes: > [[PGP Signed Part:Undecided]] > On Sat, Sep 23, 2023 at 12:19:10PM +0200, Malte Frank Gerdes wrote: >> I noticed that after connecting via ssh the profile that gets created >> when doing `guix shell' is not sourced, therefore the environment >> variables are not correct. This seems to be because guix home inserts >> "[ -n \"$SSH_CLIENT\" ] && source /etc/profile" into the zshenv file. I >> assume this is meant to ensure that /etc/profile is sourced because ssh >> does not start a login shell? > > That is correct, it was added in > because commands like `ssh host -- cmd` (and commands depending on ssh > such as `git pull/push`) failed. Ah, i didn't think about this use case. >> Anyway, removing that line makes everything work normally. So am i >> doing it wrong or is this actually unnecessary? > > I can reproduce this: > > ``` > $ ssh localhost > $ guix shell gnuplot > $ gnuplot > zsh: command not found: gnuplot > ``` > > However (still within the ssh session) > > ``` > $ guix shell gnuplot -- gnuplot > [gnuplot opens as expected] > ``` > > and weirdly enough > > ``` > $ guix shell --check gnuplot > guix shell: checking the environment variables visible from shell '/gnu/s= tore/i4rj0banq044423if5xwb3df723g14r9-zsh-5.9/bin/zsh'... > guix shell: All is good! The shell gets correct environment variables. > $ gnuplot > zsh: command not found: gnuplot > ``` > > I don't really know what is happening here. Why does it work when > running the command directly and why does `guix shell --check` claim > that everything is correct when clearly something is wrong? If I > understand correctly `.zshenv` should be sourced in all these cases but > for some reason the problems only occur in some of them. > > Any ideas? My guess would be that sourcing /etc/profile should only happen once, but the SSH_CLIENT variable is inherited to the child shell which evaluates zshenv which in turn sources /etc/profile because SSH_CLIENT has non-zero length. So /etc/profile is sourced twice. This is just a wild guess though. mfg=C2=B2 From unknown Fri Jun 13 10:58:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66168: zsh home service breaks guix shell via ssh Resent-From: Saku Laesvuori Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 25 Sep 2023 14:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66168 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Malte Frank Gerdes Cc: 66168@debbugs.gnu.org Received: via spool by 66168-submit@debbugs.gnu.org id=B66168.169565382325274 (code B ref 66168); Mon, 25 Sep 2023 14:58:02 +0000 Received: (at 66168) by debbugs.gnu.org; 25 Sep 2023 14:57:03 +0000 Received: from localhost ([127.0.0.1]:46415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkn1D-0006ZZ-6E for submit@debbugs.gnu.org; Mon, 25 Sep 2023 10:57:03 -0400 Received: from vmi571514.contaboserver.net ([75.119.130.101]:51650 helo=mail.laesvuori.fi) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkn18-0006Z1-93 for 66168@debbugs.gnu.org; Mon, 25 Sep 2023 10:57:01 -0400 Received: from X-kone (88-113-24-127.elisa-laajakaista.fi [88.113.24.127]) by mail.laesvuori.fi (Postfix) with ESMTPSA id D77A034017C; Mon, 25 Sep 2023 16:57:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1695653840; bh=ZTSoCXzBFWYFwmVvqy/FuTqH7NK+hRRUccCM5IwvHaU=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=bg2b7LHGs3SplunTW+g3Qivhq3DIcSu2G1JOmiFpYgSm7wd2KW4W5HfkxIkg86cuk fJzc6qCbIlT9sLFZHBSbhyDj1c+5TMuGymq80DAvnRhOVo7FZPsPHeUDbTkewzLne8 sPSxt0viYEd4Ldh5/UJ5Yheo5bBj530igR76XcQc= Date: Mon, 25 Sep 2023 17:56:34 +0300 From: Saku Laesvuori Message-ID: References: <868r8xrxu4.fsf@gmail.com> <86cyy75rg1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tekwydgt547zzxm5" Content-Disposition: inline In-Reply-To: <86cyy75rg1.fsf@gmail.com> X-Spam-Score: -0.0 (/) 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 (-) --tekwydgt547zzxm5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > ``` > > $ ssh localhost > > $ guix shell gnuplot > > $ gnuplot > > zsh: command not found: gnuplot > > ``` > > > > However (still within the ssh session) > > > > ``` > > $ guix shell gnuplot -- gnuplot > > [gnuplot opens as expected] > > ``` > > > > and weirdly enough > > > > ``` > > $ guix shell --check gnuplot > > guix shell: checking the environment variables visible from shell '/gnu= /store/i4rj0banq044423if5xwb3df723g14r9-zsh-5.9/bin/zsh'... > > guix shell: All is good! The shell gets correct environment variables. > > $ gnuplot > > zsh: command not found: gnuplot > > ``` > > > > I don't really know what is happening here. Why does it work when > > running the command directly and why does `guix shell --check` claim > > that everything is correct when clearly something is wrong? If I > > understand correctly `.zshenv` should be sourced in all these cases but > > for some reason the problems only occur in some of them. > > > > Any ideas? > > My guess would be that sourcing /etc/profile should only happen once, > but the SSH_CLIENT variable is inherited to the child shell which > evaluates zshenv which in turn sources /etc/profile because SSH_CLIENT > has non-zero length. So /etc/profile is sourced twice. >=20 > This is just a wild guess though. Seems to be about right. I had just assumed that guix shell would run the command in a new shell (causing .zshenv to be sourced in all those cases) but apparently it just calls the command directly. I haven't seen any problems with sourcing /etc/profile multiple times because it reloads both system and user profiles, but obviously it doesn't know about guix shell profiles. It seems that the default bash configuration only sources /etc/profile if $SSH_CLIENT is non-empty and bash is used non-interactively. Something similar could probably be done with zsh, but I would expect it to still have this issue in certain situation. For example, I think running a script like this ``` $ ssh host -- guix shell gnuplot <