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

Ted Hess thess at kitschensync.net
Mon Jun 15 11:14:12 EDT 2015

This gets more curious... You are certainly correct that the strings passed to 
procd are marshaled correctly. It turns out that the shells I have tried to pass 
the numeric-colon-separated list as an option value gets the list split apart as 
I noted earlier. Barring any quick solution to this issue I may develop a patch 
to the application source to accept a different delimiter. Go figure

Thanks,    /ted

-----Original Message----- 
From: Yousong Zhou
Sent: Sunday, June 14, 2015 10:10 PM
To: Ted Hess
Cc: OpenWrt developers
Subject: Re: [OpenWrt-Devel] procd/libubox mangles command-line arguments

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