commit:     1fc311ce0afeef9f982213e43220d079a4ffec26
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 26 22:29:30 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Sep 26 22:39:31 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1fc311ce

ecompress-file: de-duplicate filtered_args (bug 667072)

Use an associated array to de-duplicate filtered_args, in order to
ensure that compressor arguments are unique when a file is installed
in both compressed and uncompressed forms.

Bug: https://bugs.gentoo.org/667072
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/ecompress-file | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/ecompress-file b/bin/ecompress-file
index 18269c91b..e65b21ee4 100755
--- a/bin/ecompress-file
+++ b/bin/ecompress-file
@@ -13,7 +13,7 @@ compress_file() {
        done
        set +f
        mask_ext_re="^(${mask_ext_re:1})\$"
-       local filtered_args=()
+       local -A filtered_args
        local had_precompressed=
        for x in "$@" ; do
                [[ ${x##*.} =~ $mask_ext_re ]] && continue
@@ -35,10 +35,10 @@ compress_file() {
                                had_precompressed=1;;
                esac
 
-               filtered_args+=( "$x" )
+               filtered_args[${x}]=
        done
        [[ ${#filtered_args[@]} -eq 0 ]] && return 0
-       set -- "${filtered_args[@]}"
+       set -- "${!filtered_args[@]}"
 
        if [[ ${had_precompressed} ]]; then
                eqawarn "One or more compressed files were found in 
docompress-ed directories."

Reply via email to