From patchwork Fri Jul 21 10:51:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saku Laesvuori X-Patchwork-Id: 51890 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D5C3827BBE9; Fri, 21 Jul 2023 11:59:19 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id BC81027BBE2 for ; Fri, 21 Jul 2023 11:59:17 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMnqh-0002Xd-VY; Fri, 21 Jul 2023 06:59:03 -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 1qMnqg-0002XV-JD for guix-patches@gnu.org; Fri, 21 Jul 2023 06:59:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMnqg-0006I5-BA for guix-patches@gnu.org; Fri, 21 Jul 2023 06:59:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qMnqg-0002nD-6Z for guix-patches@gnu.org; Fri, 21 Jul 2023 06:59:02 -0400 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= 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 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Saku Laesvuori X-ACL-Warn: , Saku Laesvuori via Guix-patches X-Patchwork-Original-From: Saku Laesvuori via Guix-patches via From: Saku Laesvuori Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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(-) base-commit: e401eff97706dc6cdaf20b01dd12e291d7d13c2b 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)