[jhalfs] 04/06: quote use of VERSION

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]> Sat, 25 Apr 2026 16:46:50 +0000
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1777135622-2167-26076
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch trunk
in repository jhalfs.

commit b266f167255dbd177eefc0bad1e05ab826587ee9
Author: Pierre Labastie <[email protected]>
AuthorDate: Sat Apr 25 15:12:48 2026 +0200

    quote use of VERSION
    
    At least the book version may contain special characters (space,
    hash sign), but why not other package versions? So quote all
    uses of $VERSION (and associated variables). This may be
    more than needed, but better bash scripting anyway...
---
 LFS/lfs.xsl                    |  6 +++---
 LFS/master.sh                  |  6 +++---
 common/create-sbu_du-report.sh | 26 +++++++++++++-------------
 common/libs/func_install_blfs  |  5 ++---
 common/libs/func_wrt_Makefile  | 36 ++++++++++++++++++------------------
 common/makefile-functions      | 28 ++++++++++++++--------------
 6 files changed, 53 insertions(+), 54 deletions(-)

diff --git a/LFS/lfs.xsl b/LFS/lfs.xsl
index e45fc4f..a9364f8 100644
--- a/LFS/lfs.xsl
+++ b/LFS/lfs.xsl
@@ -1261,9 +1261,9 @@ SCRIPT_ROOT=</xsl:text>
       <xsl:text>
 SRC_DIR=${ROOT}sources
 <!-- Set variables, for use by the Makefile and package manager -->
-VERSION=</xsl:text><!-- needed for Makefile, and may be used in PackInstall-->
+VERSION="</xsl:text><!-- needed for Makefile, and may be used in PackInstall-->
       <xsl:copy-of select=".//sect1info/productnumber/text()"/>
-      <xsl:text>
+      <xsl:text>"
 PKG_DEST=${SRC_DIR}/</xsl:text>
       <xsl:copy-of select="$order"/>
       <xsl:text>-</xsl:text>
@@ -1302,7 +1302,7 @@ if [ -d "${PKGDIR%-*}-build" ]; then  rm -rf ${PKGDIR%-*}-build; fi
 </xsl:text>
       <xsl:if test="$test-mismatch='y'">
         <xsl:text>
-if [ "${PKGDIR%$VERSION}" = "$PKGDIR" ]; then
+if [ "${PKGDIR%"$VERSION"}" = "$PKGDIR" ]; then
     echo Mismatch between version and directory name ! Exiting...
     exit 2
 fi
diff --git a/LFS/master.sh b/LFS/master.sh
index bbf5061..61d0c3a 100644
--- a/LFS/master.sh
+++ b/LFS/master.sh
@@ -76,7 +76,7 @@ chapter_targets() {       #
     # If it doesn't exist, we skip it in iterations rebuilds (except stripping
     # and revisedchroot, where .a and .la files are removed).
     pkg_tarball=$(sed -n 's/tar -xf \(.*\)/\1/p' $file)
-    pkg_version=$(sed -n 's/VERSION=\(.*\)/\1/p' $file)
+    pkg_version=$(sed -n 's/VERSION="\([^"]*\)"/\1/p' $file)
 
     if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
       case "${this_script}" in
@@ -490,8 +490,8 @@ CUSTOM_TOOLS: $custom_list
 create-sbu_du-report:  mk_BOOT
 	@\$(call echo_message, Building)
 	@if [ "\$(ADD_REPORT)" = "y" ]; then \\
-	  sudo ./create-sbu_du-report.sh logs $VERSION $(date --iso-8601); \\
-	  \$(call echo_report,$VERSION-SBU_DU-$(date --iso-8601).report); \\
+	  sudo ./create-sbu_du-report.sh logs "$VERSION" $(date --iso-8601); \\
+	  \$(call echo_report,"$VERSION-SBU_DU-$(date --iso-8601).report"); \\
 	fi
 	@touch  \$@
 
diff --git a/common/create-sbu_du-report.sh b/common/create-sbu_du-report.sh
index a1371cb..99649dc 100755
--- a/common/create-sbu_du-report.sh
+++ b/common/create-sbu_du-report.sh
@@ -3,7 +3,7 @@
 set -e
 
 LOGSDIR=$1
-VERSION=$2
+VERSION="$2"
 DATE=$3
 
 LINE="================================================================================"
@@ -32,7 +32,7 @@ LINE="==========================================================================
 # Set the report file
 REPORT="$VERSION"-SBU_DU-"$DATE".report
 
-[ -f "$REPORT" ] && : >$REPORT
+[ -f "$REPORT" ] && : >"$REPORT"
 
 # Dump generation time stamp and book version
 echo -e "\n`date`\n" > "$REPORT"
@@ -110,7 +110,7 @@ for log in $BUILDLOGS ; do
   if [ "$log" != "$FIRSTLOG" ] ; then
     INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';`
     INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';`
-    echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> $REPORT
+    echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> "$REPORT"
     # Append install values for grand total
     INSTALL2=`perl -e 'printf "%.3f" , ('$INSTALL2' + '$INSTALL')';`
     INSTALLMB2=`perl -e 'printf "%.3f" , ('$INSTALLMB2' + '$INSTALLMB')';`
@@ -121,13 +121,13 @@ for log in $BUILDLOGS ; do
   DU1MBPREV=$DU1MB
 
 # Dump time and disk usage values
-  echo -e "$LINE\n\t\t\t\t[$PACKAGE]\n" >> $REPORT
-  echo -e "Build time is:\t\t\t\t\t\t$MINUTES minutes and $SECS seconds" >> $REPORT
-  echo -e "Build time in seconds is:\t\t\t\t$TIME" >> $REPORT
-  echo -e "Approximate SBU time is:\t\t\t\t$SBU" >> $REPORT
-  echo -e "Disk usage before unpacking the package:\t\t$DU1 KB or $DU1MB MB" >> $REPORT
-  echo -e "Disk usage before deleting the source and build dirs:\t$DU2 KB or $DU2MB MB" >> $REPORT
-  echo -e "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB" >> $REPORT
+  echo -e "$LINE\n\t\t\t\t[$PACKAGE]\n" >> "$REPORT"
+  echo -e "Build time is:\t\t\t\t\t\t$MINUTES minutes and $SECS seconds" >> "$REPORT"
+  echo -e "Build time in seconds is:\t\t\t\t$TIME" >> "$REPORT"
+  echo -e "Approximate SBU time is:\t\t\t\t$SBU" >> "$REPORT"
+  echo -e "Disk usage before unpacking the package:\t\t$DU1 KB or $DU1MB MB" >> "$REPORT"
+  echo -e "Disk usage before deleting the source and build dirs:\t$DU2 KB or $DU2MB MB" >> "$REPORT"
+  echo -e "Required space to build the package:\t\t\t$REQUIRED1 KB or $REQUIRED2 MB" >> "$REPORT"
 
 done
 
@@ -138,12 +138,12 @@ DU1=`du -skx --exclude=jhalfs --exclude=lost+found --exclude var/lib $LOGSDIR/..
 DU1MB=`perl -e 'printf "%.3f" , ('$DU1' / '1024')';`
 INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';`
 INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';`
-echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> $REPORT
+echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> "$REPORT"
 # Append install values for grand total
 INSTALL2=`perl -e 'printf "%.3f" , ('$INSTALL2' + '$INSTALL')';`
 INSTALLMB2=`perl -e 'printf "%.3f" , ('$INSTALLMB2' + '$INSTALLMB')';`
 
 # Dump grand totals
-echo -e "\n$LINE\n\nTotal time required to build the system:\t\t$SBU2  SBU" >> $REPORT
+echo -e "\n$LINE\n\nTotal time required to build the system:\t\t$SBU2  SBU" >> "$REPORT"
 # Total disk usage: including /tools but not /sources.
-echo -e "Total Installed files disk usage:\t\t\t$INSTALL2 KB or $INSTALLMB2 MB" >> $REPORT
+echo -e "Total Installed files disk usage:\t\t\t$INSTALL2 KB or $INSTALLMB2 MB" >> "$REPORT"
diff --git a/common/libs/func_install_blfs b/common/libs/func_install_blfs
index be615a7..13d08e5 100644
--- a/common/libs/func_install_blfs
+++ b/common/libs/func_install_blfs
@@ -253,11 +253,10 @@ update: all
 	    xmllint --format --postvalid track.tmp > \$(TRACKING_FILE); \\
 	    rm track.tmp; \\
 	done; \\
-	VERSION=\$\$(grep 'echo.*lfs-release' ../$LFS_XML/tmp/lfs-full.xml | \\
-	             sed 's/.*echo[ ]*\([^ ]*\).*/\1/'); \\
+	VERSION="$VERSION"; \\
 	xsltproc --stringparam packages ../packages.xml \\
 	    --stringparam package LFS-Release \\
-	    --stringparam version \$\$VERSION \\
+	    --stringparam version "\$\$VERSION" \\
 	    -o track.tmp \\
 	    ../xsl/bump.xsl \$(TRACKING_FILE); \\
 	sed -i 's@PACKDESC@$BLFS_ROOT/packdesc.dtd@' track.tmp; \\
diff --git a/common/libs/func_wrt_Makefile b/common/libs/func_wrt_Makefile
index c694e76..e616bc1 100644
--- a/common/libs/func_wrt_Makefile
+++ b/common/libs/func_wrt_Makefile
@@ -67,7 +67,7 @@ LUSER_wrt_target() {               # Create target and initialize log file
   local PREV=$2
   local version
   if [ "$3" != "" ]; then
-    version=-$3
+    version=-"$3"
   fi
 (
 cat << EOF
@@ -75,7 +75,7 @@ cat << EOF
 $i:  $PREV
 	@\$(call echo_message, Building)
 ${NO_PROGRESS}	@export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
-	@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version
+	@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@"$version"
 	@ : > envars
 EOF
 ) >> $MKFILE.tmp
@@ -88,7 +88,7 @@ CHROOT_wrt_target() {              # Create target and initialize log file
   local PREV=$2
   local version
   if [ "$3" != "" ]; then
-    version=-$3
+    version=-"$3"
   fi
 (
 cat << EOF
@@ -96,7 +96,7 @@ cat << EOF
 $i:  $PREV
 	@\$(call echo_message, Building)
 ${NO_PROGRESS}	@export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
-	@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version
+	@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@"$version"
 	@ : > envars
 EOF
 ) >> $MKFILE.tmp
@@ -127,7 +127,7 @@ EOF
 
 (
 cat << EOF
-	@\$(PRT_DU) >>logs/\$@$version
+	@\$(PRT_DU) >>logs/\$@"$version"
 	@\$(call unpack,$FILE)
 	@\$(call get_pkg_root_LUSER)
 EOF
@@ -154,7 +154,7 @@ EOF
 
 (
 cat << EOF
-	@\$(PRT_DU_CR) >>logs/\$@$version
+	@\$(PRT_DU_CR) >>logs/\$@"$version"
 	@\$(call unpack2,$FILE)
 	@\$(call get_pkg_root2)
 EOF
@@ -171,13 +171,13 @@ LUSER_wrt_test_log() {             # Initialize testsuite log file
 #----------------------------------#
   local version
   if [ "$2" != "" ]; then
-    version=-$2
+    version=-"$2"
   fi
-  local TESTLOGFILE=$1$version
+  local TESTLOGFILE="$1$version"
 (
 cat  << EOF
 	@echo "export  TEST_LOG=\$(TESTLOGDIR)/$TESTLOGFILE" >> envars && \\
-	echo "\$(nl_)\`date\`\$(nl_)" >\$(TESTLOGDIR)/$TESTLOGFILE
+	echo "\$(nl_)\`date\`\$(nl_)" >\$(TESTLOGDIR)/"$TESTLOGFILE"
 EOF
 ) >> $MKFILE.tmp
 }
@@ -187,13 +187,13 @@ CHROOT_wrt_test_log() {            #
 #----------------------------------#
   local version
   if [ "$2" != "" ]; then
-    version=-$2
+    version=-"$2"
   fi
-  local TESTLOGFILE=$1$version
+  local TESTLOGFILE="$1$version"
 (
 cat  << EOF
 	@echo "export TEST_LOG=\$(crTESTLOGDIR)/$TESTLOGFILE" >> envars && \\
-	echo "\$(nl_)\`date\`\$(nl_)" >\$(crTESTLOGDIR)/$TESTLOGFILE
+	echo "\$(nl_)\`date\`\$(nl_)" >\$(crTESTLOGDIR)/"$TESTLOGFILE"
 EOF
 ) >> $MKFILE.tmp
 }
@@ -209,14 +209,14 @@ wrt_RunAsRoot() {                  # Some scripts must be run as root..
   local MOUNT_ENV
   local version
   if [ "$2" != "" ]; then
-    version=-$2
+    version=-"$2"
   fi
   local file=$1
 
 (
 cat << EOF
 	@export LFS=\$(MOUNT_PT) && \\
-	$COMMANDS/`dirname $file`/\$@ >>logs/\$@$version 2>&1
+	$COMMANDS/`dirname $file`/\$@ >>logs/\$@"$version" 2>&1
 EOF
 ) >> $MKFILE.tmp
 }
@@ -227,13 +227,13 @@ LUSER_wrt_RunAsUser() {            # Calculate time with perl, footer to log fil
   local file=$1
   local version
   if [ "$2" != "" ]; then
-    version=-$2
+    version=-"$2"
   fi
 
 (
 cat << EOF
 	@source ~/.bashrc && \\
-	\$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@$version 2>&1
+	\$(CMDSDIR)/`dirname $file`/\$@ >> \$(LOGDIR)/\$@"$version" 2>&1
 EOF
 ) >> $MKFILE.tmp
 }
@@ -244,12 +244,12 @@ CHROOT_wrt_RunAsRoot() {           #
   local file=$1
   local version
   if [ "$2" != "" ]; then
-    version=-$2
+    version=-"$2"
   fi
 (
 cat << EOF
 	@source envars && \\
-	\$(crCMDSDIR)/`dirname $file`/\$@ >>\$(crLOGDIR)/\$@$version 2>&1
+	\$(crCMDSDIR)/`dirname $file`/\$@ >>\$(crLOGDIR)/\$@"$version" 2>&1
 EOF
 ) >> $MKFILE.tmp
 
diff --git a/common/makefile-functions b/common/makefile-functions
index 4e4b4c6..0b08c39 100644
--- a/common/makefile-functions
+++ b/common/makefile-functions
@@ -16,14 +16,14 @@ nl_     = ""
 
 define echo_PHASE
   @echo $(BOLD)--------------------------------------------------------------------------------
-  @echo  $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts
+  @echo  $(tab_)$(tab_)Executing $(BLUE)"$(1)"$(WHITE) scripts
   @echo $(BOLD)--------------------------------------------------------------------------------
   @echo $(WHITE)
 endef
 
 define sh_echo_PHASE
   echo $(BOLD)--------------------------------------------------------------------------------;\
-  echo  $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \
+  echo  $(tab_)$(tab_)Executing $(BLUE)"$(1)"$(WHITE) scripts; \
   echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
 endef
 
@@ -50,7 +50,7 @@ endef
 
 define echo_message
   @echo $(BOLD)--------------------------------------------------------------------------------
-  @echo $(BOLD)$(1) target $(BLUE)$@$(BOLD)$(WHITE)
+  @echo $(BOLD)"$(1)" target $(BLUE)$@$(BOLD)$(WHITE)
 endef
 
 #=======================
@@ -59,7 +59,7 @@ endef
 #=== BUILD FUNCTIONS ===
 
 define remove_existing_dirs
-  @PKG_PATH=`ls -t $(SRCSDIR)/$(1) | head -n1` && \
+  @PKG_PATH=`ls -t $(SRCSDIR)/"$(1)" | head -n1` && \
   ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
   [ -n "$$ROOT" ] && \
   if [ -d $(SRCSDIR)/$$ROOT ]; then \
@@ -69,7 +69,7 @@ define remove_existing_dirs
 endef
 
 define remove_existing_dirs2
-  @PKG_PATH=`ls -t $(SRC)/$(1) | head -n1` && \
+  @PKG_PATH=`ls -t $(SRC)/"$(1)" | head -n1` && \
   ROOT=`tar -tf $$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'` && \
   [ -n "$$ROOT" ] && \
   if [ -d $(SRC)/$$ROOT ]; then \
@@ -85,12 +85,12 @@ endef
 
 define unpack
   @cd $(SRCSDIR) && \
-  tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
+  tar -xvf `ls -t "$(1)" | head -n1` > $(PKG_LST)
 endef
 
 define unpack2
   @cd $(SRC) && \
-  tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
+  tar -xvf `ls -t "$(1)" | head -n1` > $(PKG_LST)
 endef
 
 #==#
@@ -136,13 +136,13 @@ endef
 define log_new_files
   @find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/tmp/*" ! -path "$(SRC)/*" \
   -newer $(SRC)/timestamp-marker -not -type d \
-  -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/$(1)
+  -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(crFILELOGDIR)/"$(1)"
 endef
 
 define log_new_files_LUSER
   @find $(BASEDIR) -xdev ! -path "$(BASEDIR)/$(SCRIPT_ROOT)/*" ! -path "$(BASEDIR)/tmp/*" ! -path "$(SRCSDIR)/*" \
   -newer $(SRCSDIR)/timestamp-marker -not -type d \
-  -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/$(1)
+  -printf "%p\t%s\t%u:%g\t%m\t%l\n" | sort > $(BASEDIR)$(crFILELOGDIR)/"$(1)"
 endef
 
 #==@
@@ -150,13 +150,13 @@ endef
 define remove_build_dirs
   @ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
   rm -rf $(SRCSDIR)/$$ROOT && \
-  rm -rf $(SRCSDIR)/$(1)-build
+  rm -rf $(SRCSDIR)/"$(1)"-build
 endef
 
 define remove_build_dirs2
   @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
   rm -rf $(SRC)/$$ROOT && \
-  rm -rf $(SRC)/$(1)-build
+  rm -rf $(SRC)/"$(1)"-build
 endef
 
 #==#
@@ -179,7 +179,7 @@ endef
 
 define echo_report
   echo ; \
-  echo $(BOLD) The report file $(BLUE)$(1)$(BOLD) has been created ; \
+  echo $(BOLD) The report file $(BLUE)"$(1)"$(BOLD) has been created ; \
   echo ; \
   echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
 endef
@@ -187,7 +187,7 @@ endef
 define echo_finished
   @echo $(BOLD)
   @echo --------------------------------------------------------------------------------
-  @echo $(BOLD) Finished the build of $(BLUE)$(1)$(BOLD)
+  @echo $(BOLD) Finished the build of $(BLUE)"$(1)"$(BOLD)
   @echo --------------------------------------------------------------------------------
   @echo  $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
   @echo --------------------------------------------------------------------------------
@@ -227,7 +227,7 @@ endef
 define echo_boot_finished
   @echo $(BOLD)
   @echo --------------------------------------------------------------------------------
-  @echo        $(BOLD) Finished building a minimal boot system for $(BLUE)$(1)$(BOLD)
+  @echo        $(BOLD) Finished building a minimal boot system for $(BLUE)"$(1)"$(BOLD)
   @echo --------------------------------------------------------------------------------
   @echo  $(tab_)$(tab_)$(RED)W A R N I N G$(BOLD)
   @echo --------------------------------------------------------------------------------

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

------------=_1777135622-2167-26076
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page
------------=_1777135622-2167-26076--