From unknown Sat Aug 16 21:21:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64765] [PATCH] gnu: home: zsh: Also load enviroment in non-login shells Resent-From: Saku Laesvuori Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 21 Jul 2023 10:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64765 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64765@debbugs.gnu.org Cc: Saku Laesvuori X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168993710710680 (code B ref -1); Fri, 21 Jul 2023 10:59:01 +0000 Received: (at submit) by debbugs.gnu.org; 21 Jul 2023 10:58:27 +0000 Received: from localhost ([127.0.0.1]:60678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMnq7-0002mA-9T for submit@debbugs.gnu.org; Fri, 21 Jul 2023 06:58:27 -0400 Received: from lists.gnu.org ([2001:470:142::17]:51782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMnq5-0002lw-2R for submit@debbugs.gnu.org; Fri, 21 Jul 2023 06:58:26 -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 1qMnpz-0002WA-BY for guix-patches@gnu.org; Fri, 21 Jul 2023 06:58:19 -0400 Received: from vmi571514.contaboserver.net ([75.119.130.101] helo=mail.laesvuori.fi) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMnpx-00066u-JH for guix-patches@gnu.org; Fri, 21 Jul 2023 06:58:19 -0400 Received: from X-kone.lan (88-113-24-127.elisa-laajakaista.fi [88.113.24.127]) by mail.laesvuori.fi (Postfix) with ESMTPSA id C051D34013B; Fri, 21 Jul 2023 12:58:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1689937095; bh=nmo0uFQ4QssPEfPBmTTi1R6HnrgOMJN2v81DvmBPdwg=; h=From:To:Cc:Subject:Date; b=vDJK6iO3MApKGq6DOtKSjRzwbgIz/byYYrlttE/Zm+r9MpWDxVztAPzz3XWowKzOI el4u3JI55ZySDWKYb0nKOc68fKKTZ6q7joqADJ2ELXRh3CGZ4u6Wq3Z1Au4t0ag2cS HamOAJkchZvWDMd/odubPKNZc63/3Ce2pMt4yt44= From: Saku Laesvuori Date: Fri, 21 Jul 2023 13:51:19 +0300 Message-ID: <20230721105801.10840-1-saku@laesvuori.fi> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=75.119.130.101; envelope-from=saku@laesvuori.fi; helo=mail.laesvuori.fi 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) 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.1 (/) * gnu/home/services/shells.scm (zsh-file-zshenv): Add snippet to source profiles. (zsh-file-zprofile): Remove profile sourcing snippet. (zsh-get-configuration-files): Always add .zshenv as it is never empty. Check that .zprofile is not empty before adding it. --- The service incorrectly assumed that shells are either login shells or started from another shell. For example, ssh with a command argument starts shells that aren't login shells nor started from another shell. gnu/home/services/shells.scm | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 7960590e7c..93a3b38267 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -182,21 +182,18 @@ (define* (zsh-field-not-empty? config field) (define (zsh-file-zshenv config) (mixed-text-file "zshenv" - (zsh-serialize-field config 'zshenv) - (zsh-serialize-field config 'environment-variables))) - -(define (zsh-file-zprofile config) - (mixed-text-file - "zprofile" "\ # Set up the system, user profile, and related variables. source /etc/profile # Set up the home environment profile. source ~/.profile - -# It's only necessary if zsh is a login shell, otherwise profiles will -# be already sourced by bash " + (zsh-serialize-field config 'zshenv) + (zsh-serialize-field config 'environment-variables))) + +(define (zsh-file-zprofile config) + (mixed-text-file + "zprofile" (zsh-serialize-field config 'zprofile))) (define (zsh-file-by-field config field) @@ -208,10 +205,9 @@ (define (zsh-file-by-field config field) (zsh-serialize-field config field))))) (define (zsh-get-configuration-files config) - `((".zprofile" ,(zsh-file-by-field config 'zprofile)) ;; Always non-empty - ,@(if (or (zsh-field-not-empty? config 'zshenv) - (zsh-field-not-empty? config 'environment-variables)) - `((".zshenv" ,(zsh-file-by-field config 'zshenv))) '()) + `((".zshenv" ,(zsh-file-by-field config 'zshenv)) ;; Always non-empty + ,@(if (zsh-field-not-empty? config 'zprofile) + `((".zprofile" ,(zsh-file-by-field config 'zprofile))) '()) ,@(if (zsh-field-not-empty? config 'zshrc) `((".zshrc" ,(zsh-file-by-field config 'zshrc))) '()) ,@(if (zsh-field-not-empty? config 'zlogin) base-commit: e401eff97706dc6cdaf20b01dd12e291d7d13c2b -- 2.41.0 From unknown Sat Aug 16 21:21:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64765] [PATCH] gnu: home: zsh: Also load enviroment in non-login shells Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 21 Jul 2023 12:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64765 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Saku Laesvuori Cc: 64765@debbugs.gnu.org Received: via spool by 64765-submit@debbugs.gnu.org id=B64765.168994337231522 (code B ref 64765); Fri, 21 Jul 2023 12:43:01 +0000 Received: (at 64765) by debbugs.gnu.org; 21 Jul 2023 12:42:52 +0000 Received: from localhost ([127.0.0.1]:60837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMpTA-0008CM-04 for submit@debbugs.gnu.org; Fri, 21 Jul 2023 08:42:52 -0400 Received: from mail.envs.net ([5.199.136.28]:32968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMpT6-0008C6-3Z for 64765@debbugs.gnu.org; Fri, 21 Jul 2023 08:42:50 -0400 Received: from localhost (mail.envs.net [127.0.0.1]) by mail.envs.net (Postfix) with ESMTP id E27B638A18D6; Fri, 21 Jul 2023 12:42:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa; t=1689943365; bh=f5YskNbFErpUexD/WHB3up3tbgGF/sUhO5QjfrZiJAc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=o0+xGX6Vvj1GqHUb0HVxAdcTs37jELJfAK44QeW35KxWjyQKn3DlI2ZqW+27gkAIm A4zAxmn+ghe/DGg64N3c8kJbbrU9yHL64tVQWpdqdeCOnamJgDk32sn6DfbfTGBQN1 ZHJg4gbbCQaySwZpQ/70Z+wqDbyn512rpOfff5AdEW4hHIbBFpOaEQdz+08j8rdEhc jAJ9lEoTthaaO1NihrdkG4WvifZJfHGpoGVA8juWl/pZbZyamiXVoztq4dDX6bkHzI X5XY8DpIHgL9kuLjHXHBhePDOwJ3kZ+NBKO8ger55Pv+VTSM9KEuj0FTbQ/FPuhlqB /l9j8uHXqcgxB9nedT1PIc1XPuF0DGig6AbEvxXTqj5Pco418JVQG4mqZAr0sOydRI A5yUGilvTbpLWr1ak37GK9Y0G2/CbdVZksb7dQk58SMA2A3rFudllXQOPsMOg92M4K kgOkUpJo6IiMez/1cG8nPh6Fu65FAhG8FxxWe/M+n8rMNhSqPR6OYHn0aT9ufPMAnj T5TLUrprl4c+1wQa4ibHDzAH6gx5TiDVTuaq4yiQ4wyRcdjHSsp9eAmV/DhzmefmMU /wpmsC+b0WEZRiCQEpyQB74+qUDY2sYJt25gdMkNbrLuj/VqCgUfmhADSj8rfjUtdN p781JBBEFO7wp9mrGUnUF66A= X-Virus-Scanned: Debian amavisd-new at mail.envs.net Received: from mail.envs.net ([127.0.0.1]) by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id dSoFI7_5c5jp; Fri, 21 Jul 2023 12:42:42 +0000 (UTC) Received: from localhost (unknown [117.174.235.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.envs.net (Postfix) with ESMTPSA; Fri, 21 Jul 2023 12:42:42 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 8400fc8f; Fri, 21 Jul 2023 12:42:34 +0000 (UTC) From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= References: <20230721105801.10840-1-saku@laesvuori.fi> Date: Fri, 21 Jul 2023 20:42:34 +0800 In-Reply-To: <20230721105801.10840-1-saku@laesvuori.fi> (Saku Laesvuori's message of "Fri, 21 Jul 2023 13:51:19 +0300") Message-ID: <87bkg5h1vp.fsf@envs.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: > * gnu/home/services/shells.scm (zsh-file-zshenv): Add snippet to source > profiles. > (zsh-file-zprofile): Remove profile sourcing snippet. > (zsh-get-configuration-files): Always add .zshenv as it is never empty. > Check that .zprofile is not empty before adding it. > --- > The service incorrectly assumed that shells are either login shells or > started from another shell. For example, ssh with a command argument > starts shells that aren't login shells nor started from another shell. Hello, this looks reasonable to me, only one question: Will ~/.guix-home/profile/etc/profile be sourced multiple times with duplicated search-path entries? (eg: check 'env' in 'zsh' in 'zsh'). From unknown Sat Aug 16 21:21:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64765] [PATCH] gnu: home: zsh: Also load enviroment in non-login shells Resent-From: Saku Laesvuori Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 21 Jul 2023 14:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64765 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Cc: 64765@debbugs.gnu.org Received: via spool by 64765-submit@debbugs.gnu.org id=B64765.168995070714904 (code B ref 64765); Fri, 21 Jul 2023 14:46:02 +0000 Received: (at 64765) by debbugs.gnu.org; 21 Jul 2023 14:45:07 +0000 Received: from localhost ([127.0.0.1]:34384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMrNS-0003sK-JR for submit@debbugs.gnu.org; Fri, 21 Jul 2023 10:45:06 -0400 Received: from vmi571514.contaboserver.net ([75.119.130.101]:53522 helo=mail.laesvuori.fi) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMrNO-0003s2-Ns for 64765@debbugs.gnu.org; Fri, 21 Jul 2023 10:45:05 -0400 Received: from X-kone (88-113-24-127.elisa-laajakaista.fi [88.113.24.127]) by mail.laesvuori.fi (Postfix) with ESMTPSA id 5B00C342FAA; Fri, 21 Jul 2023 16:45:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1689950702; bh=XO9l8s62qtdaLjnZaE+HX+YTyrfXof6+FEazBcW5WNk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=B+alKaVu8zDsMgW9OKZIDSLF68DzXQamq7ZpR87suBi+w2SNms6UXbr9CYFyIlrdB SOGJARMwMCB6zAkbEsZgRb4YunFcsnyYLYSS3Z7RqKxcPB7ArdNmRriCtyu0v2Uqc1 lkyimf+MZqJxD/WopDYqPFHnkSdsUNocaXhjYBBQ= Date: Fri, 21 Jul 2023 17:44:58 +0300 From: Saku Laesvuori Message-ID: <20230721144458.w3we4ve6oqw4m7pn@X-kone> References: <20230721105801.10840-1-saku@laesvuori.fi> <87bkg5h1vp.fsf@envs.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tjqp2wvpopyumren" Content-Disposition: inline In-Reply-To: <87bkg5h1vp.fsf@envs.net> 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 (-) --tjqp2wvpopyumren Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > * gnu/home/services/shells.scm (zsh-file-zshenv): Add snippet to source > > profiles. > > (zsh-file-zprofile): Remove profile sourcing snippet. > > (zsh-get-configuration-files): Always add .zshenv as it is never empty. > > Check that .zprofile is not empty before adding it. > > --- > > The service incorrectly assumed that shells are either login shells or > > started from another shell. For example, ssh with a command argument > > starts shells that aren't login shells nor started from another shell. >=20 > Hello, this looks reasonable to me, only one question: > Will ~/.guix-home/profile/etc/profile be sourced multiple times with > duplicated search-path entries? (eg: check 'env' in 'zsh' in 'zsh'). Yes, but I don't think it causes any problems aside from adding useless data to the environment. This could be prevented by exporting GUIX_PROFILE_SOURCED=3D1 or something similar and only sourcing profiles if it isn't set. --tjqp2wvpopyumren Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoMkZR3NPB29fCOn/JX0oSiodOjIFAmS6meoACgkQJX0oSiod OjJ+XBAAsWpZpl3koXu4/EY0eHILF/UaQNC1dT4vFukPinhQkNQPp6P+Gx5DNBSN L3EE/FteS99MLTywh+JM3H6YqkYDOz08yoqk6DbJV/62N4WWixzme2j4XbVI8hJm ZSDIwQzV0HWtjVh07YD8NbUhiOYXKX2ekYc2NKzy1/7FCiWDbpmGLtki8IMMSp9q ReGFEpjZy1v8qWWG4LZ2gOUTBOVJf42q/qtcULN293p5GRv9SB+K/IYdwHWqsiH9 7b0IsWlkR3TEkOO2vSIZxeEZhR5PcdnmWRCFvgRobvJANfn044kCsTaCVJYNjQqH xn8Nje2u4/fsH6EhdUYeDWgxwWnUYCydnqQYPONEFtvE8ir06JWs0UVwmUFDm5ey 50/gejNAU0EteqqyVOvb5cgQn/yGSDg4ycT1kVV8EvP+HJD9IxRxuN2aLxGegBnt ltSQf8YcIaokKgqisgXpVNyuQQDvfiCX/5Wz7P/0sWUQtaGIpa7boQ83x44wskbC b2zK7w6sU5yEY5v6tqjB4J0gtiUR52BG/wjrGuQ4tbW7ThaFVxTXOs0BvodP23i4 qtKS5D0PeFyzr0Y5pyflTpiUSlVZziROOvsNw5uNEtdeTJomzRbAGpVqCvvKVfzv YkHdO3lDFDxSthfDW2yjLKfjRUcf7SxtWBPfJVvDj80Q5iLTgzQ= =A30l -----END PGP SIGNATURE----- --tjqp2wvpopyumren-- From unknown Sat Aug 16 21:21:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64765] [PATCH] gnu: home: zsh: Also load enviroment in non-login shells Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 16 Aug 2023 20:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64765 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Saku Laesvuori Cc: 64765@debbugs.gnu.org, =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Received: via spool by 64765-submit@debbugs.gnu.org id=B64765.16922189358982 (code B ref 64765); Wed, 16 Aug 2023 20:49:01 +0000 Received: (at 64765) by debbugs.gnu.org; 16 Aug 2023 20:48:55 +0000 Received: from localhost ([127.0.0.1]:42223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWNRn-0002Ko-7v for submit@debbugs.gnu.org; Wed, 16 Aug 2023 16:48:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWNRk-0002Ka-W7 for 64765@debbugs.gnu.org; Wed, 16 Aug 2023 16:48:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWNRf-0001nz-6r; Wed, 16 Aug 2023 16:48:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=UGF/XTCgqetzSpYRfCCRTMYj1mMd5n+YNF+SZsJHszc=; b=OxMjzzaVB9kooCfmgIca LlbLZnAXCxL1avkV3aQw+9u5zoFaLq8W2LOZGC3i+G96+Rnz7dDKk/pd3+bS70tC8MEh4lODzTe+H oRAdQiM/CJqYoLy0lS4KoeCqeMc2DluiYQuuSE3xg3k2hko/l4odB8DCc8tqBjzvVYow0kteH1tQj vaC3mdyH8x8myAJCDGtikiSW8rdiZtAx8dScMWBMf4lyqp7re99jFmaqooINAWjLqObNpJfkWrlrV Xj9s91E9ANFFfEPcMG+lpVa756VXEtASBG/NTkrI3kQfkyabjx6OwmvtG0eJIMqLO1lA5kg67q3f2 37ZCFcKWU6Ypag==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20230721105801.10840-1-saku@laesvuori.fi> <87bkg5h1vp.fsf@envs.net> <20230721144458.w3we4ve6oqw4m7pn@X-kone> Date: Wed, 16 Aug 2023 22:48:44 +0200 In-Reply-To: <20230721144458.w3we4ve6oqw4m7pn@X-kone> (Saku Laesvuori's message of "Fri, 21 Jul 2023 17:44:58 +0300") Message-ID: <87sf8i3e8j.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) 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: -3.3 (---) Hi, Saku Laesvuori skribis: >> > * gnu/home/services/shells.scm (zsh-file-zshenv): Add snippet to source >> > profiles. >> > (zsh-file-zprofile): Remove profile sourcing snippet. >> > (zsh-get-configuration-files): Always add .zshenv as it is never empty. >> > Check that .zprofile is not empty before adding it. >> > --- >> > The service incorrectly assumed that shells are either login shells or >> > started from another shell. For example, ssh with a command argument >> > starts shells that aren't login shells nor started from another shell. >>=20 >> Hello, this looks reasonable to me, only one question: >> Will ~/.guix-home/profile/etc/profile be sourced multiple times with >> duplicated search-path entries? (eg: check 'env' in 'zsh' in 'zsh'). > > Yes, but I don't think it causes any problems aside from adding useless > data to the environment. This could be prevented by exporting > GUIX_PROFILE_SOURCED=3D1 or something similar and only sourcing profiles > if it isn't set. I doesn=E2=80=99t sound great though, and I=E2=80=99m sure it could break o= bscure things, like #include_next in C. Is there a way this could be avoided? (I=E2=80=99m not familiar with Zsh s= o I=E2=80=99m not offering to help; just looking for pending patches to apply. :-)) Thanks, Ludo=E2=80=99. From unknown Sat Aug 16 21:21:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64765] [PATCH] gnu: home: zsh: Also load enviroment in non-login shells Resent-From: Saku Laesvuori Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 17 Aug 2023 07:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64765 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 64765@debbugs.gnu.org, =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Received: via spool by 64765-submit@debbugs.gnu.org id=B64765.169225780621341 (code B ref 64765); Thu, 17 Aug 2023 07:37:01 +0000 Received: (at 64765) by debbugs.gnu.org; 17 Aug 2023 07:36:46 +0000 Received: from localhost ([127.0.0.1]:42698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWXYk-0005Y9-60 for submit@debbugs.gnu.org; Thu, 17 Aug 2023 03:36:46 -0400 Received: from vmi571514.contaboserver.net ([75.119.130.101]:44984 helo=mail.laesvuori.fi) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWXYh-0005Y0-W7 for 64765@debbugs.gnu.org; Thu, 17 Aug 2023 03:36:44 -0400 Received: from X-kone (88-113-24-127.elisa-laajakaista.fi [88.113.24.127]) by mail.laesvuori.fi (Postfix) with ESMTPSA id 92ADB342466; Thu, 17 Aug 2023 09:36:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1692257816; bh=1U0Ol0vHj2JbpGvEn0WFgtkybLdHosqNcyaGQZobG+g=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=HHlVhWkBG3VPtkxW3ajr10BEa9jkYOW5dTNlVW9p8rQ47ceWZW3otaLoSHt5yY2Wr 9KU+WR/CU2/DMu0ZZ2EKjXM+8PMTJaMPVn3NAcweuAFOll5SWQmbEA2M1Kcjd7LL2q IKJOWuMTSfJUr9DXL0Ik8qqvL5UvMPmGyNBMJOd4= Date: Thu, 17 Aug 2023 10:36:40 +0300 From: Saku Laesvuori Message-ID: <20230817073640.kowdgkn7fz3tatho@X-kone> References: <20230721105801.10840-1-saku@laesvuori.fi> <87bkg5h1vp.fsf@envs.net> <20230721144458.w3we4ve6oqw4m7pn@X-kone> <87sf8i3e8j.fsf_-_@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="47yxhyf2kujte4es" Content-Disposition: inline In-Reply-To: <87sf8i3e8j.fsf_-_@gnu.org> 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 (-) --47yxhyf2kujte4es Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > >> Hello, this looks reasonable to me, only one question: > >> Will ~/.guix-home/profile/etc/profile be sourced multiple times with > >> duplicated search-path entries? (eg: check 'env' in 'zsh' in 'zsh'). > > > > Yes, but I don't think it causes any problems aside from adding useless > > data to the environment. This could be prevented by exporting > > GUIX_PROFILE_SOURCED=3D1 or something similar and only sourcing profiles > > if it isn't set. >=20 > I doesn=E2=80=99t sound great though, and I=E2=80=99m sure it could break= obscure > things, like #include_next in C. >=20 > Is there a way this could be avoided? (I=E2=80=99m not familiar with Zsh= so I=E2=80=99m > not offering to help; just looking for pending patches to apply. :-)) It could be avoided properly by making guix-generated profiles ensure that they can't be sourced multiple times (e.g. [ -z "$GUIX_PROFILE_SOURCED" ] || return ; GUIX_PROFILE_SOURCED=3D1). The specific problem I was facing was with running commands with ssh, which the bash service seems to fix by sourcing /etc/profile from bashrc when used via ssh. I'll send a patch for this ssh-specific solution but I'm not sure if it's the best way to fix this. --47yxhyf2kujte4es Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoMkZR3NPB29fCOn/JX0oSiodOjIFAmTdzggACgkQJX0oSiod OjJsYxAAwhWQBEi+GwLPJNpEOnHhiO6HD6ZVNtfFNAYWTR09pzAGd9ZFTynlhJ33 weC2TxldDtQ4b0DjBfi6j1/zLUtzJOUSMBv3vlSvq4EsbOiRBJcnktkfLJPTvKEV 1snMVAftfaNuAD4CsX+M61AiOQIEiNKUiVzudxUgh+keJ1sLkfHX2DAdl8J2WkzM sLYzKvVOT8mtdOT2es4fNjdDHrbMSTM5QrDNae/CLAaA9Le8uoRhUImeN1NvDP8O 2RixZHHqLag1cGI20QnUSvaGxQx8k6rpqvsi1QCy570Ykxj1fHlFZdL/nPnEN0FB 8EriLLJn+lOb3wcRLM1UvPYXzyuornCiTRoTVv8xrVnKjFp2kXFN4e7rCZpZWMPN /o3+XuCKHLlpTDcKkwbV+pZWTUhZ5ws4/vK2UxUt6BaXe5gUPswIsTln1kPw9WqI TLs8thKBIUcMF3XJYgmyIHFmhsB+oXCsjma8+o+C4TTBGlVME2MBqKSTSYx7CKLZ VDHiVILOUEKidX2lhPvi0Ul2smcOAe34jMKE2jQq34D7slCD16oI+9jZjcEzDBt9 bXtKGB5nHiZ93cY9yqq05oqIm9+trKLVU8WDhFaASUzJynDDdwhIRYDqNCKqgEMG dtdXa8pZ+tpXgs+H+7G0BffXlFXbkblEr2SkRAtZunpC5IzdBag= =Akzn -----END PGP SIGNATURE----- --47yxhyf2kujte4es-- From unknown Sat Aug 16 21:21:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64765] [PATCH v2] gnu: home: zsh: Load environment when running via ssh References: <20230721105801.10840-1-saku@laesvuori.fi> In-Reply-To: <20230721105801.10840-1-saku@laesvuori.fi> Resent-From: Saku Laesvuori Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Thu, 17 Aug 2023 07:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64765 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64765@debbugs.gnu.org Cc: Saku Laesvuori , ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 64765-submit@debbugs.gnu.org id=B64765.169225798321608 (code B ref 64765); Thu, 17 Aug 2023 07:40:02 +0000 Received: (at 64765) by debbugs.gnu.org; 17 Aug 2023 07:39:43 +0000 Received: from localhost ([127.0.0.1]:42702 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWXba-0005cR-OQ for submit@debbugs.gnu.org; Thu, 17 Aug 2023 03:39:43 -0400 Received: from vmi571514.contaboserver.net ([75.119.130.101]:40044 helo=mail.laesvuori.fi) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWXbZ-0005cK-Gi for 64765@debbugs.gnu.org; Thu, 17 Aug 2023 03:39:41 -0400 Received: from X-kone.lan (88-113-24-127.elisa-laajakaista.fi [88.113.24.127]) by mail.laesvuori.fi (Postfix) with ESMTPSA id AD79F342466; Thu, 17 Aug 2023 09:39:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1692257995; bh=ayAoTjhIJJytP1n7vrTEwwP+FjwRxP4oUyNRWgpwhS0=; h=From:To:Cc:Subject:Date; b=U4Xgrd5B53P0j0kcGQRtmBph138RAerGE7ctj5JFg7f2fFQUyO6Kupx+XhgirBs1n FVNvlxQJFjFVHjVKqpor3yZGgy2rmXCHk3Ja5FFWxR2HXZj5Y9/Mqy/X/FlVY7DkEF xZWdhr6BO+3XUAjQCIuNykZ+pzKbsuhdBbqmFlrc= From: Saku Laesvuori Date: Thu, 17 Aug 2023 10:38:48 +0300 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (-) * gnu/home/services/shells.scm (zsh-file-zshenv): Add snippet to source /etc/profile when running via ssh. (zsh-get-configuration-files): Always add .zshenv as it is never empty. --- gnu/home/services/shells.scm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 7960590e7c..9dd56f634a 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -183,7 +183,8 @@ (define (zsh-file-zshenv config) (mixed-text-file "zshenv" (zsh-serialize-field config 'zshenv) - (zsh-serialize-field config 'environment-variables))) + (zsh-serialize-field config 'environment-variables) + "[ -n \"$SSH_CLIENT\" ] && source /etc/profile")) (define (zsh-file-zprofile config) (mixed-text-file @@ -209,9 +210,7 @@ (define (zsh-file-by-field config field) (define (zsh-get-configuration-files config) `((".zprofile" ,(zsh-file-by-field config 'zprofile)) ;; Always non-empty - ,@(if (or (zsh-field-not-empty? config 'zshenv) - (zsh-field-not-empty? config 'environment-variables)) - `((".zshenv" ,(zsh-file-by-field config 'zshenv))) '()) + (".zshenv" ,(zsh-file-by-field config 'zshenv)) ;; Always non-empty ,@(if (zsh-field-not-empty? config 'zshrc) `((".zshrc" ,(zsh-file-by-field config 'zshrc))) '()) ,@(if (zsh-field-not-empty? config 'zlogin) base-commit: ad4520b92662e42d7d0b1e648b2068300dbb95c8 -- 2.41.0 From unknown Sat Aug 16 21:21:24 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Saku Laesvuori Subject: bug#64765: closed (Re: bug#64765: [PATCH] gnu: home: zsh: Also load enviroment in non-login shells) Message-ID: References: <87msxlx7w9.fsf_-_@gnu.org> <20230721105801.10840-1-saku@laesvuori.fi> X-Gnu-PR-Message: they-closed 64765 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 64765@debbugs.gnu.org Date: Sun, 17 Sep 2023 13:11:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1694956263-31847-1" This is a multi-part message in MIME format... ------------=_1694956263-31847-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #64765: [PATCH] gnu: home: zsh: Also load enviroment in non-login shells which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 64765@debbugs.gnu.org. --=20 64765: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D64765 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1694956263-31847-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 64765-done) by debbugs.gnu.org; 17 Sep 2023 13:10:51 +0000 Received: from localhost ([127.0.0.1]:49438 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhrY3-0008Gx-5y for submit@debbugs.gnu.org; Sun, 17 Sep 2023 09:10:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhrXy-0008GP-AA for 64765-done@debbugs.gnu.org; Sun, 17 Sep 2023 09:10:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhrXk-0001CF-IV; Sun, 17 Sep 2023 09:10:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=7YULMjBYojDvQ9n7TbUmW36hwQ9T2Hz3zWBnrssANu0=; b=QCkK9irNHMf6kbIddKEb HuPOioqEdflz0mbgWY6WiqsvsSnhPKfeB6d5fxPxIs65qo7yrH7IQeuDWA25KQ5Pg++4HiQQSCoJP lynfhmFm70C07i9ER8iV6VbuLj9iXM6x0JFpL8ct3nynNVysFT9VcCtJmeLh9TmmmcipdjD3O0Q31 s8jigdqyOUBnGTscQSKy+nxyy75tc5jgDX2Oo13Nid14kZpBtvQqw1H7ShzN3bTXDqlYfu00+tjdA zboikVpTSCo8X3vKZk6M67Rqm6OOX71PQctg7afMHJqXFpjD4HtP2WSI+UEZR8KmESkFQvHhBR8Xj djwEB/t4ux1ZnA==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Saku Laesvuori Subject: Re: bug#64765: [PATCH] gnu: home: zsh: Also load enviroment in non-login shells References: <20230721105801.10840-1-saku@laesvuori.fi> Date: Sun, 17 Sep 2023 15:10:30 +0200 In-Reply-To: (Saku Laesvuori's message of "Thu, 17 Aug 2023 10:38:48 +0300") Message-ID: <87msxlx7w9.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64765-done Cc: paren@disroot.org, 64765-done@debbugs.gnu.org, Andrew Tropin 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: -3.3 (---) Hi, Saku Laesvuori skribis: > * gnu/home/services/shells.scm (zsh-file-zshenv): Add snippet to source > /etc/profile when running via ssh. > (zsh-get-configuration-files): Always add .zshenv as it is never empty. Applied, thanks! Ludo=E2=80=99. ------------=_1694956263-31847-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 21 Jul 2023 10:58:27 +0000 Received: from localhost ([127.0.0.1]:60678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMnq7-0002mA-9T for submit@debbugs.gnu.org; Fri, 21 Jul 2023 06:58:27 -0400 Received: from lists.gnu.org ([2001:470:142::17]:51782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMnq5-0002lw-2R for submit@debbugs.gnu.org; Fri, 21 Jul 2023 06:58:26 -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 1qMnpz-0002WA-BY for guix-patches@gnu.org; Fri, 21 Jul 2023 06:58:19 -0400 Received: from vmi571514.contaboserver.net ([75.119.130.101] helo=mail.laesvuori.fi) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMnpx-00066u-JH for guix-patches@gnu.org; Fri, 21 Jul 2023 06:58:19 -0400 Received: from X-kone.lan (88-113-24-127.elisa-laajakaista.fi [88.113.24.127]) by mail.laesvuori.fi (Postfix) with ESMTPSA id C051D34013B; Fri, 21 Jul 2023 12:58:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1689937095; bh=nmo0uFQ4QssPEfPBmTTi1R6HnrgOMJN2v81DvmBPdwg=; h=From:To:Cc:Subject:Date; b=vDJK6iO3MApKGq6DOtKSjRzwbgIz/byYYrlttE/Zm+r9MpWDxVztAPzz3XWowKzOI el4u3JI55ZySDWKYb0nKOc68fKKTZ6q7joqADJ2ELXRh3CGZ4u6Wq3Z1Au4t0ag2cS HamOAJkchZvWDMd/odubPKNZc63/3Ce2pMt4yt44= From: Saku Laesvuori To: guix-patches@gnu.org Subject: [PATCH] gnu: home: zsh: Also load enviroment in non-login shells Date: Fri, 21 Jul 2023 13:51:19 +0300 Message-ID: <20230721105801.10840-1-saku@laesvuori.fi> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=75.119.130.101; envelope-from=saku@laesvuori.fi; helo=mail.laesvuori.fi 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit Cc: Saku Laesvuori 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.1 (/) * gnu/home/services/shells.scm (zsh-file-zshenv): Add snippet to source profiles. (zsh-file-zprofile): Remove profile sourcing snippet. (zsh-get-configuration-files): Always add .zshenv as it is never empty. Check that .zprofile is not empty before adding it. --- The service incorrectly assumed that shells are either login shells or started from another shell. For example, ssh with a command argument starts shells that aren't login shells nor started from another shell. gnu/home/services/shells.scm | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 7960590e7c..93a3b38267 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -182,21 +182,18 @@ (define* (zsh-field-not-empty? config field) (define (zsh-file-zshenv config) (mixed-text-file "zshenv" - (zsh-serialize-field config 'zshenv) - (zsh-serialize-field config 'environment-variables))) - -(define (zsh-file-zprofile config) - (mixed-text-file - "zprofile" "\ # Set up the system, user profile, and related variables. source /etc/profile # Set up the home environment profile. source ~/.profile - -# It's only necessary if zsh is a login shell, otherwise profiles will -# be already sourced by bash " + (zsh-serialize-field config 'zshenv) + (zsh-serialize-field config 'environment-variables))) + +(define (zsh-file-zprofile config) + (mixed-text-file + "zprofile" (zsh-serialize-field config 'zprofile))) (define (zsh-file-by-field config field) @@ -208,10 +205,9 @@ (define (zsh-file-by-field config field) (zsh-serialize-field config field))))) (define (zsh-get-configuration-files config) - `((".zprofile" ,(zsh-file-by-field config 'zprofile)) ;; Always non-empty - ,@(if (or (zsh-field-not-empty? config 'zshenv) - (zsh-field-not-empty? config 'environment-variables)) - `((".zshenv" ,(zsh-file-by-field config 'zshenv))) '()) + `((".zshenv" ,(zsh-file-by-field config 'zshenv)) ;; Always non-empty + ,@(if (zsh-field-not-empty? config 'zprofile) + `((".zprofile" ,(zsh-file-by-field config 'zprofile))) '()) ,@(if (zsh-field-not-empty? config 'zshrc) `((".zshrc" ,(zsh-file-by-field config 'zshrc))) '()) ,@(if (zsh-field-not-empty? config 'zlogin) base-commit: e401eff97706dc6cdaf20b01dd12e291d7d13c2b -- 2.41.0 ------------=_1694956263-31847-1--