From 84f7078034d0a6ffcb4f0a82cf9a2d075c317481 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Sat, 15 Oct 2022 23:03:11 +0100 Subject: [PATCH] Use \0 as delimiter for while read loops. Bump version. --- templates/template.SlackBuild | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/templates/template.SlackBuild b/templates/template.SlackBuild index 35e70a5..92062fe 100755 --- a/templates/template.SlackBuild +++ b/templates/template.SlackBuild @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 0.6.12 +# Version: 0.6.14 # Copyright (c) 2005-2022: # Darren 'Tadgy' Austin # Licensed under the terms of the GNU General Public License version 3. @@ -77,12 +77,12 @@ done # Pre-build checks. (( ${BUILD_FORCE:-0} != 1 )) && { - while read -r PKG; do + while read -r -d $'\0' PKG; do check_installed "$PKG" && die "Conflicting package installed: $PKG" - done < <(printf "%s " "${BUILD_CONFLICTS[@]}") - while read -r PKG; do + done < <(printf "%s\\0" "$PKG_NAME" "${BUILD_CONFLICTS[@]}") + while read -r -d $'\0' PKG; do check_installed "$PKG" || die "Required package not installed: $PKG" - done < <(printf "%s " "${BUILD_REQUIRES[@]}") + done < <(printf "%s\\0" "glibc" "${BUILD_REQUIRES[@]}") } # Gather some system information. @@ -163,7 +163,7 @@ rm -rf "$BUILD_ROOT" && mkdir -m 755 "$BUILD_ROOT" || die "Failed to clear build [[ -n "${SRC_DOWNLOADS[*]}" ]] && { WGET="$(command -v wget)" I=0 - while read -r SRC; do + while read -r -d $'\0' SRC; do [[ ! -e "${SRC_FILENAMES[I]}" ]] && { [[ -z "$WGET" ]] && die "wget is required to download sources" "$WGET" -t 3 -c -T 30 -w 5 --retry-connrefused --retry-on-host-error --no-check-certificate --passive-ftp -O "${SRC_FILENAMES[I]}" "$SRC" || \ @@ -171,12 +171,12 @@ rm -rf "$BUILD_ROOT" && mkdir -m 755 "$BUILD_ROOT" || die "Failed to clear build } [[ "$(md5sum "${SRC_FILENAMES[I]}" | cut -d' ' -f1)" != "${SRC_MD5SUMS[I]}" ]] && die "md5sum verification failed: ${SRC_FILENAMES[I]}" (( I++ )) - done < <(printf "%s\\n" "${SRC_DOWNLOADS[@]}") + done < <(printf "%s\\0" "${SRC_DOWNLOADS[@]}") } # Unpack sources. [[ -n "${SRC_FILENAMES[*]}" ]] && { - while read -r SRC; do + while read -r -d $'\0' SRC; do case "$SRC" in *.tar.*|*.t?z) tar -xv -C "$BUILD_WORKDIR" -f "$SRC" || die "Failed to extract source: $SRC" @@ -188,7 +188,7 @@ rm -rf "$BUILD_ROOT" && mkdir -m 755 "$BUILD_ROOT" || die "Failed to clear build die "Un-handled source archive format: ${SRC##*.}" ;; esac - done < <(printf "%s\\n" "${SRC_FILENAMES[@]}") + done < <(printf "%s\\0" "${SRC_FILENAMES[@]}") } # Fix any weird permissions on sources.