From: Jo-Philipp Wich Date: Thu, 19 Sep 2019 05:16:49 +0000 (+0200) Subject: procd: fix invalid JSON filter expression in procd_running() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9cae5a8289737784343c0e6ed17569bc690fd2a5;p=openwrt%2Fstaging%2Fblocktrron.git procd: fix invalid JSON filter expression in procd_running() Since service and instance names may contain characters which are not allowed in JSON path labels, such as dashes or spaces, change the filter expression to array square bracket notation to properly match these cases as well. Fixes: 2c3dd70741 ("procd: add procd_running() helper for checking running state") Signed-off-by: Jo-Philipp Wich (cherry picked from commit c933b6d22478c1113629ef549beea6337f978d62) --- diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 07deda58e9..1018bc65e6 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=procd -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git diff --git a/package/system/procd/files/procd.sh b/package/system/procd/files/procd.sh index 8d6d406012..529ded1795 100644 --- a/package/system/procd/files/procd.sh +++ b/package/system/procd/files/procd.sh @@ -412,7 +412,7 @@ procd_running() { json_init json_add_string name "$service" - running=$(_procd_ubus_call list | jsonfilter -e "@.$service.instances.${instance}.running") + running=$(_procd_ubus_call list | jsonfilter -e "@['$service'].instances['$instance'].running") [ "$running" = "true" ] }