summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2019-01-11 17:40:55 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2019-01-12 17:39:36 +0100
commit5da92f6d66925c818afcf74a76a9ff0215b7738d (patch)
tree044e90e91f84de60500ec327b1c28b354b6dac48 /scripts
parent2eecd7b73e73670ebbdcb6782312a9c756572e52 (diff)
downloadptxdist-5da92f6d66925c818afcf74a76a9ff0215b7738d.tar.gz
ptxdist-5da92f6d66925c818afcf74a76a9ff0215b7738d.tar.xz
ptxd_install_glob: fix glob argument splitting
The shell is used to split the strings into multiple array elements. However, this means that other expansions are performed as well. E.g. path expansion (with workspace as current directory). So files that match a pattern break the build. Disable pathname and brace expansion temporarily to fix this. Use an array afterwards to ensure that the patterns can be quoted correctly afterwards. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/ptxd_make_xpkg_pkg.sh22
1 files changed, 14 insertions, 8 deletions
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
index 07000ba3e..94e8e2422 100644
--- a/scripts/lib/ptxd_make_xpkg_pkg.sh
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -677,7 +677,7 @@ ptxd_install_find() {
local mod_nfs mod_rw
local gdb_src
if [ -z "${glob}" ]; then
- local glob="-o -print"
+ local -a glob=( "-o" "-print" )
fi
ptxd_install_setup_src &&
@@ -691,7 +691,7 @@ ptxd_install_find() {
find "${src}" ! -path "${src}" -a \( \
-path "*/.svn" -prune -o -path "*/.git" -prune -o \
-path "*/.pc" -prune -o -path "*/CVS" -prune \
- ${glob} \) | while read file; do
+ "${glob[@]}" \) | while read file; do
local dst_file="${dst}${file#${src}}"
ptxd_install_generic "${file}" "${dst_file}" "${usr}" "${grp}" "${strip}" || return
done
@@ -713,19 +713,25 @@ ptxd_install_glob() {
local cmd="file"
local src="${1}"
local dst="${2}"
+ set +B -f
local yglob=( ${3} )
local nglob=( ${4} )
- local glob
+ set -B +f
+ local -a glob
if [ -n "${3}" ]; then
- yglob=( "${yglob[@]/#/-o -path }" )
- glob="${yglob[*]/%/ -print }"
+ local pattern
+ for pattern in "${yglob[@]}"; do
+ glob=( "${glob[@]}" "-o" "-path" "${pattern}" "-print" )
+ done
else
- glob="-o -print"
+ glob=( "-o" "-print" )
fi
if [ -n "${4}" ]; then
- nglob=( "${nglob[@]/#/-o -path }" )
- glob="${nglob[*]/%/ -prune } ${glob}"
+ local pattern
+ for pattern in "${nglob[@]}"; do
+ glob=( "-o" "-path" "${pattern}" "-prune" "${glob[@]}" )
+ done
fi
shift 4