Bug #193486 - Use xargs to avoid 'bash: /bin/rm: Argument list too long'
authorZac Medico <zmedico@gentoo.org>
Thu, 27 Sep 2007 15:41:53 +0000 (15:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 27 Sep 2007 15:41:53 +0000 (15:41 -0000)
errors. This patch uses a weird tr '\001' '\000' workaround since bash
doesn't echo null bytes like one might expect. (trunk r7848)

svn path=/main/branches/2.1.2/; revision=7849

bin/ecompress

index 6eb1d5df79a9b346c9f79ca9c6102a498ee5edb5..d2d6553a31168d728789deab497f7dafcbf57e0a 100755 (executable)
@@ -48,7 +48,8 @@ case $1 in
                # delete it so that the compressor doesn't whine (bzip2 will
                # complain and skip, gzip will prompt for input)
                suffix=$(ecompress --suffix)
-               [[ -n ${suffix} ]] && rm -f "${@/%/${suffix}}"
+               [[ -n ${suffix} ]] && echo ${@/%/${suffix}$'\001'} | \
+                       tr '\001' '\000' | ${XARGS} -0 rm -f
                # Finally, let's actually do some real work
                exec "${PORTAGE_COMPRESS}" ${PORTAGE_COMPRESS_FLAGS} "$@"
                ;;