Re: [PATCH] cmdline: allow parameters with escaped spaces

2017-09-08 Thread miha . plesko . xlab
Dne torek, 22. avgust 2017 17.42.46 UTC+2 je oseba Gregor Berginc napisala: > > > > On Tuesday, 22 August 2017 17:27:36 UTC+2, Justin Cinkelj wrote: >> >> I will assume that std:: and boost:: cannot be used in early in >> loader.cc. >> >> with stresep, arguments with spaces cannot be quoted, bu

Re: [PATCH] cmdline: allow parameters with escaped spaces

2017-08-22 Thread Gregor Berginc
On Tuesday, 22 August 2017 17:27:36 UTC+2, Justin Cinkelj wrote: > > I will assume that std:: and boost:: cannot be used in early in loader.cc. > > with stresep, arguments with spaces cannot be quoted, but the spaces can > be escaped. So > --env=AAA="aa bb" > cannot be used, but instead we ca

Re: [PATCH] cmdline: allow parameters with escaped spaces

2017-08-22 Thread Justin Cinkelj
I will assume that std:: and boost:: cannot be used in early in loader.cc. with stresep, arguments with spaces cannot be quoted, but the spaces can be escaped. So --env=AAA="aa bb" cannot be used, but instead we can use --env=AAA=aa\ bb The commands.cc can than directly receive unparsed/origin

Re: [PATCH] cmdline: allow parameters with escaped spaces

2017-08-22 Thread Justin Cinkelj
On 08/22/2017 02:28 PM, Nadav Har'El wrote: On Tue, Aug 22, 2017 at 2:48 PM, Justin Cinkelj mailto:justin.cink...@xlab.si>> wrote: > What does it not fix? The $892 mentions environ varibales with spaces or empty one. And command line parsing is done in loader.cc to get loader op

Re: [PATCH] cmdline: allow parameters with escaped spaces

2017-08-22 Thread Nadav Har'El
On Tue, Aug 22, 2017 at 2:48 PM, Justin Cinkelj wrote: > > What does it not fix? > The $892 mentions environ varibales with spaces or empty one. And command > line parsing is done in loader.cc to get loader options, and in > commands.cc, to get argv/argc for app, and to implement runscript. This

Re: [PATCH] cmdline: allow parameters with escaped spaces

2017-08-22 Thread Justin Cinkelj
> What does it not fix? The $892 mentions environ varibales with spaces or empty one. And command line parsing is done in loader.cc to get loader options, and in commands.cc, to get argv/argc for app, and to implement runscript. This one only touched loader.cc options, and ensured that commands

Re: [PATCH] cmdline: allow parameters with escaped spaces

2017-08-22 Thread Nadav Har'El
On Mon, Aug 21, 2017 at 7:01 PM, Justin Cinkelj wrote: > The strtok_r doesn't allow escaping the input parameters, which means > each space is considered a separator. The boost::tokenizer supports > escaping. This commit replaces strtok_r with boost::tokenizer. The > final __argv is still continu

Re: [PATCH] cmdline: allow parameters with escaped spaces

2017-08-21 Thread Justin Cinkelj
justin_cinkelj@jcpc:~/devel/mikelangelo/osv-fc25/osv$ ./scripts/run.py -e '/tests/misc-execve.so 1 /tests/misc-execve-payload.so aa bb \"cc dd\" \"ee \\\"ff gg\\\" hh\" ' OSv v0.24-432-g8388445 DBG av[0] = '/tests/misc-execve.so' DBG av[1] = '1' DBG av[2] = '/tests/misc-execve-payload.so' DBG av

Re: [PATCH] cmdline: allow parameters with escaped spaces

2017-08-21 Thread Justin Cinkelj
Example debug output: ./scripts/run.py -e "blah aa bb \"asdf tt\" 'a \\\"b c\\\" d' " OSv v0.24-431-g67ecd81 DBG av[0] = 'blah' DBG av[1] = 'aa' DBG av[2] = 'bb' DBG av[3] = 'asdf tt' DBG av[4] = 'a "b c" d' DBG av[5] = '' eth0: 192.168.122.15 Failed to load object: blah. Powering off. I forgot t

[PATCH] cmdline: allow parameters with escaped spaces

2017-08-21 Thread Justin Cinkelj
The strtok_r doesn't allow escaping the input parameters, which means each space is considered a separator. The boost::tokenizer supports escaping. This commit replaces strtok_r with boost::tokenizer. The final __argv is still continus in memory, as expected by some programs. Spaces can be quoted