-
Notifications
You must be signed in to change notification settings - Fork 208
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
fix error handling and exit code #2330
fix error handling and exit code #2330
Conversation
First, the exit code produced by waitpid contains the exit code of the process in bits 8-15. Second, exit(x) drops all but the least-significant 8 bits. If the exit status from waitpid() is passed to exit(), then any error status of the original process is dropped. This commit fixes that and returns EXIT_FAILURE if a signal or anything else happened.
This is affects both the interpreter and the synthesizer.
Hi, thanks for this pull request. |
Souffle already exits with an error code if the Datalog file has a syntax error or is otherwise unreadable. I would expect it to behave the same way if other input files (CSV, SQLite, etc.) are malformed or otherwise unreadable, so that I could tell programmatically that something had gone wrong. |
I don't know, but if you cannot read the CSV file due a CSV syntax error (e.g. mismatched quotes), that seems like an error condition to me that users (e.g. other programs) should be told about. Test case for load3 actually contains this line in the stderr file: So, it is obviously treated as an error. It should be a warning if this isn't an actual error condition, IMO. |
I get your point, I do agree Souffle should not even run the analysis and must eventually end with an error code. I am however challenging the "exit immediately and not showing every input file that cannot be read" as in tests/semantic/load10/load10.err. But fair enough, it's only a nice to have. |
Sorry, I was a bit unclear what you meant. I do also agree that it would be nice to delay exit and accumulate errors so as to provide a better user experience. I suppose I could add another commit to implement a delayed exit, but it might be better to do that as a separate MR. |
Build errors on MacOS seems to be related to a change in Github runners from XCode 13 to XCode 14. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2330 +/- ##
=======================================
Coverage 77.42% 77.43%
=======================================
Files 468 468
Lines 29177 29178 +1
=======================================
+ Hits 22591 22594 +3
+ Misses 6586 6584 -2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes!
We're happy to contribute as this helps us as well. I will try to get an update in so we can accumulate errors. |
We noticed that when our program invoked souffle via exec with incorrect data (actually CSV with newlines), souffle did not exit with an error status. I traced this down to two problems: