From 36ec0ea4176c680a84bfac9284dc0fd207078563 Mon Sep 17 00:00:00 2001 From: merakor Date: Mon, 8 Nov 2021 18:16:20 +0000 Subject: cpt-lib: fix shellcheck errors FossilOrigin-Name: 9cf7ecf5739797be76b834a1f1e054e35b9cbcef419269799a0945159204081b --- src/cpt-lib.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cpt-lib.in b/src/cpt-lib.in index 41b0a14..96471c0 100644 --- a/src/cpt-lib.in +++ b/src/cpt-lib.in @@ -100,7 +100,7 @@ sepchar() ( str_tmp=${str_tmp%?} done set -- "$@" "$str_tmp" - str=${str#$str_tmp} + str=${str#"$str_tmp"} done printf '%s\n' "$@" ) @@ -801,7 +801,7 @@ pkg_extract() { # VCS Repository git+*|hg+*|fossil+*) backend=${src%%+*} - url=${src##${backend}+} com=${url##*[@#]} com=${com#${url%[@#]*}} + url=${src##"${backend}"+} com=${url##*[@#]} com=${com#"${url%[@#]*}"} log "$1" "Cloning ${url%[#@]*}" "pkg_vcs_clone_$backend" "${url%[#@]*}" "$com" @@ -1340,7 +1340,7 @@ pkg_conflicts() { # Combine the dirname and file values, and print them into the # temporary manifest to be parsed. - printf '%s/%s\n' "${dirname#$CPT_ROOT}" "${file##*/}" + printf '%s/%s\n' "${dirname#"$CPT_ROOT"}" "${file##*/}" done < "$tar_dir/$1/$pkg_db/$1/manifest" > "$CPT_TMPDIR/$pid/manifest" @@ -1462,7 +1462,7 @@ pkg_swap() { # its manifest file to reflect this. We then resort this file # so no issues arise when removing packages. cp -Pf "$CPT_ROOT/$2" "$pkg_owns>${alt#*>}" - sed "s#^$(regesc "$2")\$#${PWD#$CPT_ROOT}/$pkg_owns>${alt#*>}#" \ + sed "s#^$(regesc "$2")\$#${PWD#"$CPT_ROOT"}/$pkg_owns>${alt#*>}#" \ "../installed/$pkg_owns/manifest" | sort -r -o "../installed/$pkg_owns/manifest" else @@ -1477,7 +1477,7 @@ pkg_swap() { # Convert the desired alternative to a real file and rewrite # the manifest file to reflect this. The reverse of above. mv -f "$alt" "$CPT_ROOT/$2" - sed "s#^${PWD#$CPT_ROOT}/$(regesc "$alt")\$#$2#" "../installed/$1/manifest" | + sed "s#^${PWD#"$CPT_ROOT"}/$(regesc "$alt")\$#$2#" "../installed/$1/manifest" | sort -r -o "../installed/$1/manifest" } @@ -1721,7 +1721,7 @@ pkg_repository_update() { # Function to update the given package repository. cd "$1" repo_type=$(pkg_vcs_info) - repo_root=${repo_type#$PWD:} + repo_root=${repo_type#"$PWD":} repo_type=${repo_type##*:} repo_root=${repo_root%:*} contains "$repos" "$repo_root" || { repos="$repos $repo_root " -- cgit v1.2.3