summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2020-01-10 14:09:39 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2020-01-23 17:08:35 +0100
commitb9cfa011b12b1397a93b09e870ffd64d949941bb (patch)
treefe8bd4af28eb324a42fb1a6df6ddd34d769706b9 /scripts
parent026d5cf6adac0201bbfb977a0d23b00a27c35425 (diff)
downloadptxdist-b9cfa011b12b1397a93b09e870ffd64d949941bb.tar.gz
ptxdist-b9cfa011b12b1397a93b09e870ffd64d949941bb.tar.xz
ptxd_get_path: don't use 'eval'
It breaks paths with '\', whitespace, etc. bacause the quoting is gone when 'ls' is called. This means that no globing is expanded for the arguments. That should not be a problem, because that should happen when ptxd_get_path is called. Now IFS must be a newline because arguments can contain white-spaces now. This ensures that the array is setup correctly. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/libptxdist.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index df123980c..dc67bc17b 100644
--- a/scripts/libptxdist.sh
+++ b/scripts/libptxdist.sh
@@ -397,7 +397,11 @@ export -f ptxd_get_alternative
ptxd_get_path() {
[ -n "${1}" ] || return
- ptxd_reply=( $(eval command ls -f -d "${@}" 2>/dev/null) )
+ local orig_IFS="${IFS}"
+ IFS="
+"
+ ptxd_reply=( $(command ls -f -d "${@}" 2>/dev/null) )
+ IFS="${orig_IFS}"
[ ${#ptxd_reply[@]} -ne 0 ]
}