[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #10004 [Pluggable transport]: obfs-flash-client doesn't allow intermixed positional and optional arguments
#10004: obfs-flash-client doesn't allow intermixed positional and optional
arguments
---------------------------------+---------------------------
Reporter: dcf | Owner: infinity0
Type: defect | Status: new
Priority: normal | Milestone:
Component: Pluggable transport | Version:
Keywords: flashproxy | Actual Points:
Parent ID: | Points:
---------------------------------+---------------------------
I was playing with a `torrc` for obfs-flash and I found that obfs-flash-
client doesn't allow options to come between positional arguments:
{{{
works: obfs-flash-client 2334 :9000
works: obfs-flash-client 2334 :9000 --fp-arg=-4
works: obfs-flash-client --fp-arg=-4 2334 :9000
doesn't work: obfs-flash-client 2334 --fp-arg=-4 :9000
}}}
The "doesn't work" error is
{{{
$ ./obfs-flash-client 2334 --fp-arg=-4 :9000
usage: obfs-flash-client [-h] [--fp-arg ARG] PORT [REMOTE:PORT]
obfs-flash-client: error: unrecognized arguments: :9000
}}}
I expected intervening options not to affect non-option arguments, like
other commands I'm used to. It seems like the behavior is inherent to
argparse:
* [http://bugs.python.org/issue14191 Issue 14191: argparse doesn't allow
optionals within positionals]
* [http://stackoverflow.com/questions/18622798 Python argparse: Combine
optional parameters with nargs=argparse.REMAINDER]
If you agree that this is worth changing, a potential workaround is
* http://bugs.python.org/issue14191#msg155185 (and maybe other messages
in that bug)
[http://docs.python.org/2/library/optparse.html optparse] works the way I
expect, but it is deprecated.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/10004>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs