ecompress: beware of -k in PORTAGE_COMPRESS_FLAGS
authorZac Medico <zmedico@gentoo.org>
Thu, 30 Jun 2011 08:03:44 +0000 (01:03 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 30 Jun 2011 08:03:44 +0000 (01:03 -0700)
This will fix bug #372183.

bin/ebuild-helpers/ecompress

index de81b4484ec7d65c64428283c7a029ef0268c2d2..9ff1c563fca629e2dc034ddd4a5872523f1524a9 100755 (executable)
@@ -80,7 +80,10 @@ case $1 in
                        # if it cannot actually compress the file
                        echo {0..1000} > compressme
                        ${PORTAGE_COMPRESS} ${PORTAGE_COMPRESS_FLAGS} compressme > /dev/null
-                       suffix=$(ls compressme*)
+                       # If PORTAGE_COMPRESS_FLAGS contains -k then we need to avoid
+                       # having our glob match the uncompressed file here.
+                       suffix=$(echo compressme.*)
+                       [[ -z $suffix ]] && suffix=$(echo compressme*)
                        suffix=${suffix#compressme}
                        cd /
                        rm -rf "${tmpdir}"