-
Notifications
You must be signed in to change notification settings - Fork 160
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
Quit GAP with non-zero exit code if processing init files fails and --quitonbreak
is being used
#5179
Conversation
Related issue: #4994 Personally I'd really prefer the behavior in this PR -- but of course it'd change a long standing behavior, and as such might disrupt the workflows of some users... Then again, the reason I'd prefer this to abort GAP is that I have more than once been in a situation where I missed the warning and then wasted time searching for a problem in the wrong place -- i.e., the behavior in this PR would have saved me time. I can't think of any good reason for the current behavior. So here's my two cents: if e.g. @ThomasBreuer @frankluebeck @ChrisJefferson can think of actual or at least somewhat realistic scenarios where the current behavior is desirable and not easy to replicate by other means, we won't merge this... Otherwise I'd say let's go with it for GAP 4.13.0, and wait for any negative feedback -- we can always revert it in 4.13.1 |
I'm happy with this change, as you say I can't imagine why anyone would want the current behaviour, and it makes it easy to miss bugs. |
Thanks for pointing to #4994. Because of the inconsistency described there, something has to be fixed, and the question is how. From the viewpoint of the documentation, I think it would be the easiest solution if files read via the command line behave as if one would call |
I agree with @ThomasBreuer : The documentation of GAPs command line options says that filenames on the command line are read with |
Simply using |
I'd be very happy with that behavior. However, for me it doesn't work like you describe: If I replace |
Nevermind, changing So, updating the PR with that would be great :-) |
e6f4a7a
to
b0584c1
Compare
I have updated the PR to use
|
|
Nevermind, I still got an error because I accidentally left it at Anyway, of course we could add another |
(And I guess |
31ecc7d
to
b29b062
Compare
Next iteration:
|
Argh, this affects the test system which (as I could have expected) also uses |
I would really strongly urge a conservative approach here: don't mess with a central and essential function like Instead, perhaps just keep |
b6546da
to
e75ee60
Compare
Then there would be a difference between I.e., this PR now simply uses |
f2bb231
to
696a0a9
Compare
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.
Looks good to me, thanks a lot, I think it's a nice improvement.
What you say about using Read
to be faithful to the documentation makes perfect sense to me!
Perhaps we could also improve the documentation, though? It still has this in it: It used to have this in it
If a file cannot be opened GAP will print an error message and will abort.
I guess strictly speaking this is fully accurate, but perhaps not helpful, and could just be removed (UPDATE: which this PR does, and that's fine). But instead I propose we improve it, to tell the user a bit more about what to expect... How about this:
If a file cannot be opened or if executing the code in it raises an error, then the usual error handling for
Read
respectivelyTest
kicks in. If this enters a break loop, then exiting that break loop also exits GAP.
Hmmm... This looks good:
But if I don't disable break loops, we still get exit code zero:
Now, I agree this is still useful for 99% of scripts involving GAP, as they all should use I'll wait a bit (tomorrow at least) so see if @zickgraf or @ChrisJefferson have further comments, then will merge (possibly after adjusting the headline a bit to make it clear that the non-zero exit code only appears when disabling break loops) |
Oops, noticed my comment on the docs was not quite correct, updated it. But again, I already approved the PR and won't block it over this, just soliciting more thoughts on this, can change it myself in a different PR later on, too (or not, dunno, need to sleep about it) |
Ah, so there still is a difference between As a possible solution I have pushed commit 3619192 which handles "READ_GAP_ROOT" as an "outer loop" in the sense of the message "you can 'quit;' to quit to outer loop" (the code change is analogous to Lines 341 to 342 in 6f3f907
quit , i.e. it will match the second case. Then not having a non-zero exit code in this case is also expected, because we "handled" the error ourselves by exiting the break loop. However, I expect that this change will be too fundamental to be acceptable :D
The proper fix would be to let So in the case the change to READ_GAP_ROOT is too fundamental, I would simply update the documentation in the way you have suggested and say we have to live with it :D |
Yes, and tbh I am happy with that difference :-). so yeah just change the docs |
This matches the documentation and allows to quit GAP with a non-zero exit code if a file given on the command line does not exist.
3619192
to
3f40eb4
Compare
Done :-) |
--quitonbreak
is being used
Currently, GAP prints a warning when a nonexistent file is specified on the command line but otherwise continues unharmed:
In particular, it exits with exit code 0 if no other error occurs. In CI tests I would like exit GAP with a non-zero exit code in this case to catch typos, problems in the setup, etc.
I expect that this PR will not be accepted as-is. If this expectation is correct, I would like to use it as a starting point for a discussion how this could be achieved. For example, I could imagine tying this to the options
--quitonbreak
or--norepl
because those are often used in automation where the warning "Could not read file" would possibly go unnoticed.Text for release notes
TBD
Resolves #4994