Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#10004 closed defect (wontfix)

obfs-flash-client doesn't allow intermixed positional and optional arguments

Reported by: dcf Owned by: infinity0
Priority: Medium Milestone:
Component: Circumvention/Pluggable transport Version:
Severity: Keywords: flashproxy, fog
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

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:

If you agree that this is worth changing, a potential workaround is

optparse works the way I expect, but it is deprecated.

Child Tickets

Change History (3)

comment:1 Changed 5 years ago by asn

Keywords: pt-combiner added

comment:2 Changed 5 years ago by infinity0

Keywords: fog added; pt-combiner removed
Resolution: wontfix
Status: newclosed

comment:3 Changed 5 years ago by infinity0

I think the benefit is not worth the additional complexity of using argparse in a non-standard way. FWIW, it looks there is a slow half-hearted effort to fix this on the python side.

Please re-open if it causes real problems in the meantime though.

Note: See TracTickets for help on using tickets.