From e05961458953fdf8d55ddd871663a452ef0e8d43 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 2 Sep 2025 03:22:12 +0100 Subject: get.sh xbget: don't use eval for file/dir checks the actual code works fine, but it's quite hacky. there are times when use of eval is acceptable; this is not one of those times, but i'd used it in this instance when i was being a bit crazy about code size reductions during my audits. Signed-off-by: Leah Rowe --- include/get.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/get.sh') diff --git a/include/get.sh b/include/get.sh index a3328454..7c799411 100644 --- a/include/get.sh +++ b/include/get.sh @@ -77,12 +77,13 @@ xbget() [ "$1" = "curl" ] || [ "$1" = "copy" ] || [ "$1" = "git" ] || \ err "Bad dlop (arg 1): xbget $*" - echk="f" && [ "$1" = "git" ] && echk="d" - for url in "$2" "$3"; do [ -n "$url" ] || err "empty URL given in: xbget $*" try_file "$url" "$@" || continue - eval "[ -$echk \"$4\" ] || continue" + case "$1" in + git) [ -d "$4" ] || continue ;; + *) [ -f "$4" ] || continue ;; + esac return 0 # successful download/copy done err "$1 $2 $3 $4: not downloaded"; : -- cgit v1.2.1