From 78a39da8b230ee01771b8edd1e4826fdc018ca59 Mon Sep 17 00:00:00 2001 From: Matthias Ruester Date: Fri, 8 Feb 2013 11:02:59 +0100 Subject: [PATCH] bee-query: fix reading the CONTENT file and the filename handling there were problems if a filename contains spaces replacing the for loops and always quoting arguments fixes this issue --- src/bee-query.sh.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bee-query.sh.in b/src/bee-query.sh.in index fbcec0f..c7b0df4 100644 --- a/src/bee-query.sh.in +++ b/src/bee-query.sh.in @@ -57,7 +57,7 @@ query() { eval $(${BEE_BINDIR}/beeversion $base) get_files "${PKGALLPKG}" else - get_pkgs ${f} + get_pkgs "${f}" fi done } @@ -68,10 +68,10 @@ get_files() { for s in "" "${BEE_METADIR}" ; do ff="${s}/${pkg}/CONTENT" if [ -e "${ff}" ] ; then - for line in $(cat ${ff}) ; do - eval $(${BEESEP} ${line}) + while read line ; do + eval $(${BEESEP} "${line}") echo ${file} - done + done < "${ff}" fi done } @@ -81,12 +81,12 @@ get_pkgs() { for pkg in $(${BEE_LIBEXECDIR}/bee/bee.d/bee-list --installed) ; do - if egrep -q "file=.*${f}" ${BEE_METADIR}/${pkg}/CONTENT ; then + if egrep -q "file=.*${f}" "${BEE_METADIR}/${pkg}/CONTENT" ; then echo ${pkg} - for line in $(egrep "file=.*${f}" ${BEE_METADIR}/${pkg}/CONTENT) ; do - eval $(${BEESEP} ${line}) + while read line ; do + eval $(${BEESEP} "${line}") echo " ${file}" - done + done < <(egrep "file=.*${f}" "${BEE_METADIR}/${pkg}/CONTENT") fi done }