It does word splitting and glob expansion, which is undesirable.

https://github.com/koalaman/shellcheck/wiki/SC2045

Signed-off-by: Rosen Penev <ros...@gmail.com>
---
 package/base-files/files/lib/functions.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/functions.sh 
b/package/base-files/files/lib/functions.sh
index 82a2169260..048bfd2b2a 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -283,7 +283,8 @@ default_postinst() {
 include() {
        local file
 
-       for file in $(ls $1/*.sh 2>/dev/null); do
+       for file in "$1"/*.sh; do
+               [ -e "$file" ] || break
                . $file
        done
 }
-- 
2.24.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to