commit: 3c24f8c4ab1bc34cc208c343f4152d8f0818d0bb
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 10 23:41:06 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 7 22:54:09 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3c24f8c4
ecompress: ensure IFS= is in effect for read invocations
Where read is given at least one name to assign to, word splitting
mechanics apply. Given the default value of IFS, records will
effectively be trimmed of any surrounding <blank> characters. It is
categorically incorrect to permit this in the course of processing
pathnames. Address the issue by ensuring that the value of IFS is the
null string on each occasion that read is invoked.
Signed-off-for: 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 f7efec24ed..389af4be7d 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -19,7 +19,7 @@ do_ignore() {
done
if (( ${#skip_dirs[@]} )); then
- while read -r -d '' skip; do
+ while IFS= read -rd '' skip; do
skip=${skip%.ecompress}
printf '%s\n' "${skip#${D%/}}" >>
"${T}/.ecompress_skip_files" || die
done < <(find "${skip_dirs[@]}" -name '*.ecompress' -print0
-delete || die)
@@ -51,7 +51,7 @@ do_queue() {
[[ -n ${PORTAGE_DOCOMPRESS_SIZE_LIMIT} ]] &&
find_args+=( -size "+${PORTAGE_DOCOMPRESS_SIZE_LIMIT}c"
)
- while IFS= read -d '' -r path; do
+ while IFS= read -rd '' path; do
# detect the horrible posibility of the ebuild
installing
# colliding compressed and/or uncompressed variants
# and fail hard (bug #667072)
@@ -122,7 +122,7 @@ fix_symlinks() {
# levels of indirection (see bug #470916).
while true ; do
something_changed=0
- while read -r -d $'\0' brokenlink ; do
+ while IFS= read -rd '' brokenlink; do
[[ -e ${brokenlink} ]] && continue
olddest=$(readlink -- "${brokenlink}")
@@ -219,7 +219,7 @@ if [[ -s ${T}/.ecompress_had_precompressed ]]; then
eqawarn "(manpages, documentation) when automatic compression is used:"
eqawarn
n=0
- while read -r f; do
+ while IFS= read -r f; do
eqawarn " ${f}"
if (( ++n == 10 )); then
eqawarn " ..."