Sorry for the delay, everything you wrote yesterday wound up in gmail's spam
filter again.

On 10/17/2018 04:51 PM, enh wrote:
> i wanted to check that the Android scheduler policy output wasn't
> broken by recent changes, but i can't remember what the -O option is
> called...
> 
> # ps -A -O
> ps: Missing argument to -O (see "ps --help")

And "ps --help" says:

  Which FIELDs to show. (-o HELP for list, default = -o PID,TTY,TIME,CMD)

I.E. "ps -O help". (All the fields are case insensitive, "help" is just a
special field.)

The global "--help" has only ever been recognized as the first option. Should I
change that?

The problem is it would ignore all other options, meaning "rm -rf file file file
file file --help file file" would prevent those files from getting deleted,
which seems like a security issue waiting to happen.

> fair enough. (though maybe we should have a special case for things
> that take an option and just assume that you need to know what the
> options are?)
> 
> # ps -A -O --help
> ps: bad -O '--help'
>              ^

I take it you'd like -O to also accept "ps -O --help" as the field name?

> okay, fair enough. that one seems unavoidable.
> 
> # ps -A --help
> ps: Unknown option help (see "ps --help")
> 
> that's pretty annoying though...

That's "--help only works as the first argument" again.

If you're ok with the security hole I could make it check all the arguments. I'd
have to duplicate to -- check to stop early, it's not lib/args doing this
because lots of standalone commands build without lib/args and it saves several
kilobytes in each of those. That's this blob in main.c dropping it out:

https://github.com/landley/toybox/blob/master/main.c#L60

Rob
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to