You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are no guarantees about errno when there is no error. I ran into a situation where errno==ENOMEM on our system (for unknown reasons, unfortunately) which definately didn't come from strtol().
It triggered the "your scan number is not an integer" error and percolator quit. This patch fixes the error handling for strtol() and we're not experiencing any problems with it anymore, however, I remain puzzled how errno was set to ENOMEM 🤷♂️
Thanks for the pull request! This is indeed a corner case that we are currently not handling well.
We need to add errno=0 to the other reader.readX() functions as well. Furthermore, I think that the reason why we did not do this previously, was to make sure that even when a subsequent strtox() function worked fine, we would still raise an error the next time we check reader.error(). In this way, we can do multiple reader.readX() calls, but only have to check reader.error() once at the end.
To preserve this behavior we should only set err = errno if errno != 0. Unfortunately, this might sometimes give an error message that is not actually applicable to the actual problem (as you have experienced), but it will at least show us the approximate part of the code that causes the error.
We need to add errno=0 to the other reader.readX() functions as well.
Indeed! I added it for strtod() and removed errno handling from the strchr() call since it doesn't even set errno.
Furthermore, I think that the reason why we did not do this previously, was to make sure that even when a subsequent strtox() function worked fine, we would still raise an error the next time we check reader.error(). In this way, we can do multiple reader.readX() calls, but only have to check reader.error() once at the end. To preserve this behavior we should only set err = errno if errno != 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are no guarantees about
errnowhen there is no error. I ran into a situation whereerrno==ENOMEMon our system (for unknown reasons, unfortunately) which definately didn't come fromstrtol().It triggered the "your scan number is not an integer" error and percolator quit. This patch fixes the error handling for
strtol()and we're not experiencing any problems with it anymore, however, I remain puzzled howerrnowas set toENOMEM🤷♂️