-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
halt_error/1 crashes when called more than once #2358
Comments
I cannot reproduce the issue on macOS 13.4.1. |
On my Linux 6.1.35-lts, I get no crash for jq master:
But I get a crash for jq 1.6: (note, also the
So it must have been fixed. But I think there is still a behaviour problem, because I think I don't think it should be possible to "call halt_error more than once"
|
This patch would fix that: diff --git a/src/main.c b/src/main.c
index 1cc6542..462c62a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -681,6 +681,8 @@ int main(int argc, char* argv[]) {
ret = process(jq, value, jq_flags, dumpopts);
if (ret <= 0 && ret != JQ_OK_NO_OUTPUT)
last_result = (ret != JQ_OK_NULL_KIND);
+ if (jq_halted(jq))
+ break;
continue;
}
Or maybe it's just the man page that is worded incorrectly:
From the man page, it sounds like the program should stop as it does with my patch, and that is how i always expected it work.
bash-5.1$ <<< '{} {}' fq ...
I think the correct behaviour is that the entire program stops like the documentation says, and that requiring users to do EDIT: |
The reported bug seems to be fixed by cf4b48c. Not sure where in the patch is related, but I double checked that @emanuele6 Good find. I agree the behavior is confusing, but I think this is an intended behavior. And already reported by #2368. |
The bash script output below shows the jq version numbers and the crash report:
Output:
Environment: Mac OS
The text was updated successfully, but these errors were encountered: