GNU bug report logs - #77524
[PATCH v4 4/6] system & home: profile: Address issues reported by ‘shellcheck’.

Previous Next

Package: guix-patches;

Reported by: Hilton Chain <hako <at> ultrarare.space>

Date: Fri, 4 Apr 2025 03:24:04 UTC

Severity: normal

Tags: patch

Merged with 77035, 77522, 77523, 77525, 77526, 77527, 77528

To reply to this bug, email your comments to 77524 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to andrew <at> trop.in, hako <at> ultrarare.space, janneke <at> gnu.org, ludo <at> gnu.org, tanguy <at> bioneland.org, guix-patches <at> gnu.org:
bug#77524; Package guix-patches. (Fri, 04 Apr 2025 03:24:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hilton Chain <hako <at> ultrarare.space>:
New bug report received and forwarded. Copy sent to andrew <at> trop.in, hako <at> ultrarare.space, janneke <at> gnu.org, ludo <at> gnu.org, tanguy <at> bioneland.org, guix-patches <at> gnu.org. (Fri, 04 Apr 2025 03:24:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: guix-patches <at> gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH v4 4/6] system & home: profile: Address issues reported by ‘shellcheck’.
Date: Fri,  4 Apr 2025 11:23:01 +0800
* gnu/system.scm (operating-system-etc-service)[profile]: Address issues
reported by ‘shellcheck’.
* gnu/home/services.scm (environment-variables->setup-environment-script):
Likewise.
* gnu/home/services/shells.scm (add-shell-profile-file): Likewise.

Change-Id: I4e230fd239b8a8450da6ee0c2e58746c9cc38785
---
 gnu/home/services.scm        | 16 ++++++++++------
 gnu/home/services/shells.scm |  4 ++--
 gnu/system.scm               | 10 +++++-----
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/gnu/home/services.scm b/gnu/home/services.scm
index 6be1a49a90..769bc1c033 100644
--- a/gnu/home/services.scm
+++ b/gnu/home/services.scm
@@ -287,27 +287,31 @@ (define (environment-variables->setup-environment-script vars)
 
 case $GUIX_LOCPATH in
   *$GUIX_PROFILE/lib/locale*) ;;
-  *) export GUIX_LOCPATH=$GUIX_PROFILE/lib/locale:$GUIX_LOCPATH ;;
+  *) export GUIX_LOCPATH=\"$GUIX_PROFILE/lib/locale${GUIX_LOCPATH:+:}$GUIX_LOCPATH\" ;;
 esac
 case $XDG_DATA_DIRS in
   *$GUIX_PROFILE/share*) ;;
-  *) export XDG_DATA_DIRS=$GUIX_PROFILE/share:$XDG_DATA_DIRS ;;
+  *) export XDG_DATA_DIRS=\"$GUIX_PROFILE/share${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS\" ;;
 esac
+# When MANPATH is unset, add a trailing colon so the system default search path
+# is used.
 case $MANPATH in
   *$GUIX_PROFILE/share/man*) ;;
-  *) export MANPATH=$GUIX_PROFILE/share/man:$MANPATH
+  *) export MANPATH=\"$GUIX_PROFILE/share/man:$MANPATH\" ;;
 esac
+# When INFOPATH is unset, add a trailing colon so Emacs searches
+# 'Info-default-directory-list'.
 case $INFOPATH in
   *$GUIX_PROFILE/share/info*) ;;
-  *) export INFOPATH=$GUIX_PROFILE/share/info:$INFOPATH ;;
+  *) export INFOPATH=\"$GUIX_PROFILE/share/info:$INFOPATH\" ;;
 esac
 case $XDG_CONFIG_DIRS in
   *$GUIX_PROFILE/etc/xdg*) ;;
-  *) export XDG_CONFIG_DIRS=$GUIX_PROFILE/etc/xdg:$XDG_CONFIG_DIRS ;;
+  *) export XDG_CONFIG_DIRS=\"$GUIX_PROFILE/etc/xdg${XDG_CONFIG_DIRS:+:}$XDG_CONFIG_DIRS\" ;;
 esac
 case $XCURSOR_PATH in
   *$GUIX_PROFILE/share/icons*) ;;
-  *) export XCURSOR_PATH=$GUIX_PROFILE/share/icons:$XCURSOR_PATH ;;
+  *) export XCURSOR_PATH=\"$GUIX_PROFILE/share/icons${XCURSOR_PATH:+:}$XCURSOR_PATH\" ;;
 esac
 
 # Keep the shell environment clean.
diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index 35c0c52a8e..97c9331e18 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -87,13 +87,13 @@ (define (add-shell-profile-file config)
      ,(mixed-text-file
        "shell-profile"
        "\
-HOME_ENVIRONMENT=$HOME/.guix-home
+HOME_ENVIRONMENT=\"$HOME/.guix-home\"
 # Skip if already sourced.
 case $INFOPATH in
   *$HOME_ENVIRONMENT/profile/share/info*) ;;
   *) . \"$HOME_ENVIRONMENT/setup-environment\" ;;
 esac
-$HOME_ENVIRONMENT/on-first-login
+\"$HOME_ENVIRONMENT/on-first-login\"
 unset HOME_ENVIRONMENT\n"
        (serialize-configuration
         config
diff --git a/gnu/system.scm b/gnu/system.scm
index b67d26b648..cf93ea0fcb 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1071,11 +1071,11 @@ (define* (operating-system-etc-service os)
 # loaded when someone logs in via SSH.  See <http://bugs.gnu.org/22175>.
 # We need 'PATH' to be defined here, for 'cat' and 'cut'.  Do this before
 # reading the user's 'etc/profile' to allow variables to be overridden.
-if [ -f /etc/environment -a -n \"$SSH_CLIENT\" \\
-     -a -z \"$LINUX_MODULE_DIRECTORY\" ]
+if [ -f /etc/environment ] && [ -n \"$SSH_CLIENT\" ] &&
+     [ -z \"$LINUX_MODULE_DIRECTORY\" ]
 then
   . /etc/environment
-  export `/run/current-system/profile/bin/cut -d= -f1 < /etc/environment`
+  export \"$(/run/current-system/profile/bin/cut -d= -f1 < /etc/environment)\"
 fi
 
 # Set up environment for all default profiles.
@@ -1154,10 +1154,10 @@ (define* (operating-system-etc-service os)
 unset HOME_ENVIRONMENT
 
 # Prepend search paths not in a profile.
-export PATH=/run/privileged/bin:$PATH
+export PATH=\"/run/privileged/bin:$PATH\"
 export XCURSOR_PATH=\"$HOME/.icons:$XCURSOR_PATH\"
 
-if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ]
+if [ -n \"$BASH_VERSION\" ] && [ -f /etc/bashrc ]
 then
   # Load Bash-specific initialization code.
   . /etc/bashrc
-- 
2.49.0





Merged 77035 77522 77523 77524 77525 77526 77527 77528. Request was from Hilton Chain <hako <at> ultrarare.space> to control <at> debbugs.gnu.org. (Fri, 04 Apr 2025 03:28:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#77524; Package guix-patches. (Sat, 19 Apr 2025 01:38:05 GMT) Full text and rfc822 format available.

Message #10 received at 77524 <at> debbugs.gnu.org (full text, mbox):

From: 宋文武 <iyzsong <at> envs.net>
To: Hilton Chain <hako <at> ultrarare.space>
Cc: 77524 <at> debbugs.gnu.org, Janneke Nieuwenhuizen <janneke <at> gnu.org>,
 Tanguy Le Carrour <tanguy <at> bioneland.org>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Andrew Tropin <andrew <at> trop.in>
Subject: Re: [bug#77524] [PATCH v4 4/6] system & home: profile: Address
 issues reported by ‘shellcheck’.
Date: Sat, 19 Apr 2025 09:41:56 +0800
Hilton Chain <hako <at> ultrarare.space> writes:

> * gnu/system.scm (operating-system-etc-service)[profile]: Address issues
> reported by ‘shellcheck’.
> * gnu/home/services.scm (environment-variables->setup-environment-script):
> Likewise.
> * gnu/home/services/shells.scm (add-shell-profile-file): Likewise.

LGTM, Reviewed-by: 宋文武 <iyzsong <at> envs.net>




This bug report was last modified 55 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.