All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] support/check-bin-arch: fix for filenames with spaces
@ 2017-03-21 19:01 Yann E. MORIN
  2017-03-21 21:15 ` Peter Korsgaard
  0 siblings, 1 reply; 2+ messages in thread
From: Yann E. MORIN @ 2017-03-21 19:01 UTC (permalink / raw)
  To: buildroot

Filenames with spaces will break the current for loop.

Fix that by using a while-read loop, fed with the list of files on
stdin, using process substitution.

Reported-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 support/scripts/check-bin-arch | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/support/scripts/check-bin-arch b/support/scripts/check-bin-arch
index 2c619ad..b3e2024 100755
--- a/support/scripts/check-bin-arch
+++ b/support/scripts/check-bin-arch
@@ -18,9 +18,11 @@ fi
 
 exitcode=0
 
-pkg_files=$(sed -r -e "/^${package},(.+)$/!d; s//\1/;" ${pkg_list})
+# Only split on new lines, for filenames-with-spaces
+IFS="
+"
 
-for f in ${pkg_files} ; do
+while read f; do
 	# Skip firmware files, they could be ELF files for other
 	# architectures
 	if [[ "${f}" =~ ^\./(usr/)?lib/firmware/.* ]]; then
@@ -43,10 +45,10 @@ for f in ${pkg_files} ; do
 		continue
 	fi
 
-	printf 'ERROR: architecture for %s is %s, should be %s\n' \
+	printf 'ERROR: architecture for "%s" is "%s", should be "%s"\n' \
 	       "${f}" "${arch}" "${arch_name}"
 
 	exitcode=1
-done
+done < <( sed -r -e "/^${package},\.(.+)$/!d; s//\1/;" ${pkg_list} )
 
 exit ${exitcode}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH] support/check-bin-arch: fix for filenames with spaces
  2017-03-21 19:01 [Buildroot] [PATCH] support/check-bin-arch: fix for filenames with spaces Yann E. MORIN
@ 2017-03-21 21:15 ` Peter Korsgaard
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2017-03-21 21:15 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > Filenames with spaces will break the current for loop.
 > Fix that by using a while-read loop, fed with the list of files on
 > stdin, using process substitution.

 > Reported-by: Peter Korsgaard <peter@korsgaard.com>
 > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
 > Cc: Peter Korsgaard <peter@korsgaard.com>
 > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
 > ---
 >  support/scripts/check-bin-arch | 10 ++++++----
 >  1 file changed, 6 insertions(+), 4 deletions(-)

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-21 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 19:01 [Buildroot] [PATCH] support/check-bin-arch: fix for filenames with spaces Yann E. MORIN
2017-03-21 21:15 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.