-
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
try-catch + ascii_downcase fails in "catch" condition #3016
Comments
@gursewak1997 |
I don't get what is the point of using |
Nevermind, I can reproduce it now, I was using the wrong binary; sorry! ^^ I am not sure I understand what the intent of that jq 'del(.[] | select(.baz | IN(null, "") | not))'
# alternatively
jq 'del(.[] | select((.baz // "") != ""))'
jq 'map(select(.baz | IN(null, "")))'
jq 'map(select((.baz // "") == ""))' If you want to only remove objects that contain a jq 'del(.[] | select(has("baz")))'
# or, if you want to also keep objects with {"baz":null}
jq 'del(.[] | select(.baz != null))' |
@emanuele6 For posterity, note the example here is just a minimal reproducer. The real world use case it was boiled down from can be seen in coreos/fedora-coreos-config#2797 (where we worked around it). |
I see an error when we run a
jq
statement usingtry-catch
andascii_downcase
. If it has a match, it doesn't error out but when it needs to take the catch path, it errors out.This issue was seen after upgrading the
jq
fromjq 1.6-17.fc39
->jq-1.7.1-1.fc40
OS I am runnning on: Fedora CoreOS-Rawhide.
Steps to Reproduce:
jq -r 'map(select(try .baz catch "" | ascii_downcase == ""))' <<< '[{"foo":"bar"}]'
Actual results:
jq: error (at <stdin>:1): explode input must be a string
Expected results:
The text was updated successfully, but these errors were encountered: