When building the OpenWRT image for my EKH01-03 via WSL on Windows 10, the build fails with the error:
find: The relative path 'Files/PuTTY/' is included in the PATH environment variable, which is insecure in combination with the -execdir action of find. Please remove that entry from $PATH
This happens because of spaces in the Windows-mounted path variables like “Program Files”. I resolved it by removing the problematic variables with:
Not really, one of the approaches we use internally is to put this make script in our PATH, mutating spaces in the PATH before calling the intended /usr/bin/make. A bit more of a “set and forget” approach.
#!/usr/bin/env bash
set -euo pipefail
# set -x
# A script to use on WSL that removes space containing elements from the path when you make.
sep=:
any_changes=0
new_path=()
while read -rd "$sep" i; do
if [[ "$i" = *" "* ]]; then
any_changes=1
continue
fi
new_path+=("$i")
done < <(printf '%s%s' "$PATH" "$sep")
if [ "$any_changes" -eq 1 ]; then
echo "Warning, you had spaces in your PATH, removed by the script." 1>&2
fi
PATH=$(IFS=$sep; echo "${new_path[*]}")
/usr/bin/make "$@"