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

Properly check the command arguments in tail place. #652

Merged
merged 1 commit into from Mar 4, 2017

Conversation

Projects
None yet
2 participants
@LemonBoy
Copy link
Member

commented Feb 15, 2017

A command requiring an argument and given in tail position would not
raise an error but silently set the value to the empty string ''.

Spotted by trying to figure out what #651 is about.

Properly check the command arguments in tail place.
A command requiring an argument and given in tail position would not
raise an error but silently set the value to the empty string ''.
@ailin-nemui

This comment has been minimized.

Copy link
Contributor

commented Feb 27, 2017

mind boggling... good job but I still need to understand it

@LemonBoy

This comment has been minimized.

Copy link
Member Author

commented Feb 27, 2017

The code is a bit hairy but it boils down to this: say we've got -foo bar -baz where foo and bar require an argument, the code checks whether an argument has been provided every time it parses a command (every time it encounters a -) so when it reaches -bar it knows that the previous command has an argument and keeps parsing the string, eventually reaching the \0. You now see the problem: since there are no more - after -baz the code won't check the argument for the last command.

This can be noticed from the perl side of the moon as you'd get no error and spurious entries in the resulting hash.

@ailin-nemui ailin-nemui added the 1.0.1 label Mar 3, 2017

@ailin-nemui ailin-nemui merged commit 5a92a39 into irssi:master Mar 4, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

ailin-nemui added a commit that referenced this pull request Mar 11, 2017

Merge pull request #652 from LemonBoy/trailing-arg
Properly check the command arguments in tail place.

commit 5a92a39
Merge: 647ef19 e4601b4
Rebased: e4601b4 dc99f8d

ailin-nemui added a commit to ailin-nemui/irssi that referenced this pull request Dec 7, 2017

Merge pull request irssi#652 from LemonBoy/trailing-arg
Properly check the command arguments in tail place.

@ailin-nemui ailin-nemui added this to the 1.0.2 milestone Jan 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.