-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Assertion and core dump with certain filter and JSON with array #2116
Comments
That definitely shouldn't segfault, and doesn't do so for me on macOS. Our build toolchain for windows uses MinGW, not cygwin, so the executables we provide run natively on windows. Relatedly, this path: All that said, the expected output for your program should actually be:
(This is consistent with the segfault you're seeing- the assertion that failed is in code that tries to print the line number where the error occurred) The issue is that the first object in your input array doesn't have a To get the behavior you want, you could use this jq program instead: .[].propB.results[]? Or, something like: .[].propB.results | select(values)[] |
Thanks for the quick answer. The hint with
was the right one. The filter language of I installed Thanks! |
found another way to trigger this assertion:
outputs:
the json in question is: [{
"code_event": "2358562|265|",
"code_event_system": "STATIC",
"company_id": "3",
"date_event": "2020-03-14 17:20:00.000",
"date_event_real": "0001-01-01 00:00:00.000",
"ecode_class": "265",
"ecode_event": "4804",
"eperiod_event": "",
"etl_date": "2020-05-27"
},{
"code_event": "2358562|265|",
"code_event_system": "STATIC",
"company_id": "3",
"date_event": "2020-03-14 17:20:00.000",
"date_event_real": "0001-01-01 00:00:00.000",
"ecode_class": "265",
"ecode_event": "4804",
"eperiod_event": "",
"etl_date": "2020-05-27"
}
] |
I cannot reproduce the issue, both on macOS and Ubuntu, both on jq-1.6 and latest jq ( |
@itchyny I can still reproduce it on jq 1.6:
and yes there really is a bunch of whitespace THEN the
is
|
@divinity76 Can you test if the master version fixes the issue? |
yeah that's not quite how Cygwin works, that is not a Cygwin-native build, but regardless I compiled the current master revision ( 7c1efd6 ) on Cygwin and can not reproduce it on current master 👍
(not sure why it says dirty, i did 0 code changes) the Cygwin project itself is probably not going to update their bundled jq until 1.6.1 or something is released though 🤔 but it's nice to see that whatever the issue was, it's seemingly no longer in master. |
Thanks, we're working hard for the next release. |
Describe the bug
Using this call to
jq
leads to an error message (assertion) and a core dump:The error message:
To Reproduce
Example JSON data (file
jqtest.json
, see above):This call works:
but this not what I want. I want to go deeper in the JSON, e.g.
Raises the same error.
Expected behavior
An output like this:
or even this:
2,13
Environment
The text was updated successfully, but these errors were encountered: