[OpenWrt-Devel] procd/libubox mangles command-line arguments

Yousong Zhou yszhou4tech at gmail.com
Sun Jun 14 22:10:04 EDT 2015

Hi, Ted,

On 15 June 2015 at 04:57, Ted Hess <thess at kitschensync.net> wrote:
> Somewhere in the processing of "procd_set_param command ..." certain
> command-line parameters which have colons (":") get treated as argument
> delimiters. Example:
> procd_set_param command "foo -a 200:4:16:0 -o hw:0,0"

The correct usage should be something like the following.

  procd_set_param command "foo" "-a" "200:4:16:0" "-o" "hw:0,0"

> gets the command-line string "-a 200 4 16 0 -o hw:0,0" actually passed to
> the program. This is not what I wanted. Is there special handling for colon
> delimited numbers?? The 2nd parameter does not get this treatment - why?

AFAIK, procd will not try any shell-like command line parsing.  I
tried the following script

  . /lib/functions/procd.sh
  service_triggers() { true; }
  procd_open_service foo foo
  procd_open_instance bar
  procd_set_param command 'baz -a 200:4:16:0 -o hw:0,0'

  ubus call service list  | jsonfilter -e '$["foo"]'

And the result seems expected.

  root at OpenWrt:/# ubus call service list  | jsonfilter -e '$["foo"]'
  { "instances": { "bar": { "running": false, "command": [ "baz -a
200:4:16:0 -o hw:0,0" ] } } }

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list