[openwrt/openwrt] base-files: functions.sh: replace [^...] with [!...] in case

LEDE Commits lede-commits at lists.infradead.org
Wed Nov 25 12:53:18 EST 2020


adrian pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/b9246bbdc9a97041c5573845a7858ef3b1c54ff2

commit b9246bbdc9a97041c5573845a7858ef3b1c54ff2
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Wed Oct 14 22:58:26 2020 -0700

    base-files: functions.sh: replace [^...] with [!...] in case
    
    Strictly speaking, ash does not support it.
    
    From https://wiki.ubuntu.com/DashAsBinSh#A.5B.5E.5D
    
    Not to be confused by sed's and other program's regular expression
    syntax. Uses of [^...] in case (parameter/word expansion in general) need
    to be replaced with [!...].
    
    Found with shellcheck: https://github.com/koalaman/shellcheck/wiki/SC2169
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    [minor commit title/message adjustments]
    Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 package/base-files/files/lib/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 7da0c872fa..ee4ad1af83 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -108,7 +108,7 @@ config_unset() {
 # config_get <section> <option>
 config_get() {
 	case "$2${3:-$1}" in
-		*[^A-Za-z0-9_]*) : ;;
+		*[!A-Za-z0-9_]*) : ;;
 		*)
 			case "$3" in
 				"") eval echo "\"\${CONFIG_${1}_${2}:-\${4}}\"";;



More information about the lede-commits mailing list