commit:     533dab6377904964d29f80b13d0709aaae43a9f4
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 11 00:26:14 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun  7 22:54:10 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=533dab63

ecompress: appropriately quote the expansions of path, D and ED

Quote the expansion of the 'path' variable, preventing it from being
treated as an extended glob within a conditional command (SC2053).

Quote the expansions of 'D' and 'ED', preventing them from being treated
as patterns within string-replacing parameter expansions (SC2295).

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/ecompress | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/ecompress b/bin/ecompress
index a1f7ea9216..8a844c3b6e 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -21,7 +21,7 @@ do_ignore() {
        if (( ${#skip_dirs[@]} )); then
                while IFS= read -rd '' skip; do
                        skip=${skip%.ecompress}
-                       printf '%s\n' "${skip#${D%/}}" >> 
"${T}/.ecompress_skip_files" || die
+                       printf '%s\n' "${skip#"${D%/}"}" >> 
"${T}/.ecompress_skip_files" || die
                done < <(find "${skip_dirs[@]}" -name '*.ecompress' -print0 
-delete || die)
        fi
 
@@ -62,7 +62,7 @@ do_queue() {
                                *.Z|*.gz|*.bz2|*.lzma|.lz|.lzo|.lz4|*.xz|*.zst)
                                        vpath=${path%.*}
                                        for comp in '' .Z .gz .bz2 .lzma .lz 
.lzo .lz4 .xz .zst; do
-                                               if [[ ${vpath}${comp} != 
${path} && \
+                                               if [[ ${vpath}${comp} != 
"${path}" && \
                                                                -e 
${vpath}${comp} ]]; then
                                                        collisions[${path}]=1
                                                        collisions[${vpath}]=1
@@ -70,7 +70,7 @@ do_queue() {
                                                        continue 2
                                                fi
                                        done
-                                       printf '%s\n' "${path#${D%/}}" >> 
"${T}"/.ecompress_had_precompressed || die
+                                       printf '%s\n' "${path#"${D%/}"}" >> 
"${T}"/.ecompress_had_precompressed || die
                                        ;;
                        esac
 
@@ -151,7 +151,7 @@ fix_symlinks() {
                elif (( ++i >= 100 )); then
                        # Protect against possibility of a bug triggering an 
endless loop.
                        eerror "ecompress: too many levels of indirection for" \
-                               "'${something_changed#${ED%/}}'"
+                               "'${something_changed#"${ED%/}"}'"
                        break
                fi
        done

Reply via email to