Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite command parsing / interface #98

Open
tribut opened this issue Jan 11, 2015 · 1 comment
Open

Rewrite command parsing / interface #98

tribut opened this issue Jan 11, 2015 · 1 comment

Comments

@tribut
Copy link
Collaborator

tribut commented Jan 11, 2015

Just accidently typed "/otr smp respond some secret" (unquoted secret) and received a very unhelpful backtrace:

python: stdout/stderr: Traceback (most recent call last):
python: stdout/stderr:   File "/home/weechat/.weechat/python/autoload/otr.py", line 1344, in command_cb
python: stdout/stderr:     if secret:
python: stdout/stderr: UnboundLocalError: local variable 'secret' referenced before assignment

The simple fix would be to suggest to use quotes in the hint («Respond with: /otr smp respond "<answer>"»?). But we should probably look at all the commands again and see if we can change the interface to avoid those kind of ambiguities. This might also a good opportunity to look at the command parsing code in general. It is still very hard to read and audit.

@mmb
Copy link
Owner

mmb commented Jan 12, 2015

Good find. I wrote some test on a branch to catch these types of issues:

https://github.com/mmb/weechat-otr/tree/arg_parse_fuzz

We can use it to test the fix and any refactors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants