Ver Fonte

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 <[email protected]>
Jo-Philipp Wich há 6 anos atrás
pai
commit
c933b6d224
2 ficheiros alterados com 2 adições e 2 exclusões
  1. 1 1
      package/system/procd/Makefile
  2. 1 1
      package/system/procd/files/procd.sh

+ 1 - 1
package/system/procd/Makefile

@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=procd
 PKG_NAME:=procd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git

+ 1 - 1
package/system/procd/files/procd.sh

@@ -412,7 +412,7 @@ procd_running() {
 
 
 	json_init
 	json_init
 	json_add_string name "$service"
 	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" ]
 	[ "$running" = "true" ]
 }
 }