[Pkg-xen-devel] [PATCH 05/19] d/shuffle-binaries: Switch loop from for to while
Elliott Mitchell
ehem+debian at m5p.com
Wed Dec 2 19:49:48 GMT 2020
A for loop forces the shell to allocate memory for every filename the
script runs on. While not yet a concern, in a theoretical future where
hundreds or thousands of files are being worked with, this would become
a concern. Additionally using "$t"/usr/*bin is compatible with shells
besides Bash, and will work in a future where /usr/xbin exists.
Signed-off-by: Elliott Mitchell <ehem+debian at m5p.com>
---
debian/shuffle-binaries | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/debian/shuffle-binaries b/debian/shuffle-binaries
index 8a823da10b..37176d26e7 100755
--- a/debian/shuffle-binaries
+++ b/debian/shuffle-binaries
@@ -22,7 +22,8 @@ cd=/usr/lib/xen-common/bin
mkdir -p "$t/$vd"
-for binary in `find $t/usr/{bin,sbin} -type f`; do
+find "$t"/usr/*bin -type f | while read binary; do
+
reason=''
{ ldd "$binary" ||: ; } | { fgrep '=>' ||: ; } \
| (
--
--
(\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/)
\BS ( | ehem+sigmsg at m5p.com PGP 87145445 | ) /
\_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
More information about the Pkg-xen-devel
mailing list