Entering command :0 causes bombadillo to exit #20

Closed
opened 2019-05-26 10:36:44 +00:00 by asdf · 3 comments
Collaborator

On any page, entering :0 causes bombadillo to exit with no error messages and a return code of 0.

This isn't documented as a way to quit the program and I would have expected a similar error to entering a bad command. Maybe you have another idea on this?

BTW: I did try :-1 as well just in case it was a weird number thing, and it behaved appropriately and returned the message "dial tcp: lookup -1: Temporary failure in name resolution". Also, :000000000000001 goes to link 1, which is technically correct.

On any page, entering `:0` causes bombadillo to exit with no error messages and a return code of 0. This isn't documented as a way to quit the program and I would have expected a similar error to entering a bad command. Maybe you have another idea on this? BTW: I did try `:-1` as well just in case it was a weird number thing, and it behaved appropriately and returned the message "dial tcp: lookup -1: Temporary failure in name resolution". Also, `:000000000000001` goes to link 1, which is technically correct.
sloum added the
bug
help wanted
labels 2019-05-26 15:48:35 +00:00
Owner

Wow, that is a good bug find! My guess is that somewhere that is getting evaluated as false rather than 0. I'll have to do some digging. I had never noticed that, but it is real weird.

Thanks for the issue submission!

Wow, that is a good bug find! My guess is that somewhere that is getting evaluated as false rather than 0. I'll have to do some digging. I had never noticed that, but it is real weird. Thanks for the issue submission!
Owner

I solved the problem. I was not doing a check for the link number being greater than zero. Since the link number represents a array/slice position and it gets a -1 applied to it, a zero would make it try to access the -1 array element... which throws a panic and exits the program. I had not expected a user to enter a negative number, so that was treated as a string, which sent it to go to url instead of go to link and just came back as a bad url.

So, given the above, I have added the ability to detect a negative number as well as a decimal (+ or -) and handle that as part of goToLink (a decimal or a negative just throws a regular error that is reported as an invalid link ID).

I probably should have had the parser detect these sorts of numbers rather than deal with it in the main package, but it will suffice for now and I'd rather not modify the parser much at this point.

I'll have a PR in shortly for this fix.

I solved the problem. I was not doing a check for the link number being greater than zero. Since the link number represents a array/slice position and it gets a -1 applied to it, a zero would make it try to access the -1 array element... which throws a panic and exits the program. I had not expected a user to enter a negative number, so that was treated as a string, which sent it to go to url instead of go to link and just came back as a bad url. So, given the above, I have added the ability to detect a negative number as well as a decimal (+ or -) and handle that as part of `goToLink` (a decimal or a negative just throws a regular error that is reported as an invalid link ID). I probably should have had the parser detect these sorts of numbers rather than deal with it in the main package, but it will suffice for now and I'd rather not modify the parser much at this point. I'll have a PR in shortly for this fix.
Owner

Closed by #22

This issue has been resolved. Now, rather than crashing, the program returns proper error messaging.

Closed by https://tildegit.org/sloum/bombadillo/pulls/22 This issue has been resolved. Now, rather than crashing, the program returns proper error messaging.
sloum closed this issue 2019-05-26 17:53:36 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sloum/bombadillo#20
No description provided.