commit: 3aa3a908d1034ca3151b7873b7a8f8114005c9c4
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 7 17:56:05 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 30 07:30:34 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3aa3a908
estrip: eliminate a defective echo/comsub/globbing trifecta
Clearly, $(shopt -s nullglob; echo *) was intended as a method of
'scoping' the nullglob option. It is a dreadful approach, exhibiting at
least three potential defects in addition to being memory-inefficient.
Instead, iterate over the glob directly with for.
Given that estrip is an executable, setting nullglob would likely have
been fine. Still, rather than fret over whether nullglob might
subsequently need to be toggled off, let's obivate the need for it by
using test -e for now.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/estrip | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bin/estrip b/bin/estrip
index 640645be63..592aee24f7 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -511,7 +511,8 @@ done < <(find "${ED}" -name '*.estrip' -delete -print0)
fi
# Now we look for unstripped binaries.
-for inode_link in $(shopt -s nullglob; echo *) ; do
+for inode_link in *; do
+test -e "${inode_link}" || continue
while read -r x
do