Skip to content

Commit

Permalink
bee-query: fix reading the CONTENT file and the filename handling
Browse files Browse the repository at this point in the history
there were problems if a filename contains spaces

replacing the for loops and always quoting arguments fixes this issue
  • Loading branch information
Matthias Ruester committed Feb 24, 2013
1 parent 2d2a0c3 commit 78a39da
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/bee-query.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ query() {
eval $(${BEE_BINDIR}/beeversion $base)
get_files "${PKGALLPKG}"
else
get_pkgs ${f}
get_pkgs "${f}"
fi
done
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit 78a39da

Please sign in to comment.