Description of problem: An error raised and caught during an iteration appears to interrupt the iteration. In the example below the intent is to convert all "strings" into "numbers" when they can be and to ignore all other values. Version-Release number of selected component (if applicable): jq-1.6-10.fc34.x86_64 How reproducible: every time Steps to Reproduce: 1. `jq '.[]| tonumber? ' <<< '["1", "2", "a", "3"]'` Actual results: ``` 1 2 ``` Expected results: ``` 1 2 3 ``` Additional info: Problem seems to have appeared with 1.6-10
This issue has been introduced in commit https://github.com/stedolan/jq/commit/cf4b48c7ba30cb30e116b523cff036ea481459f It is not fixed upstream yet.
In fact `jq` does not stop iterrating, it just stops converting and printing strings jq '.[]| tonumber? ' <<< '["1", "a", "2", 3]' will print 1 and 3 because 3 is not converted from string. Here is the PR to discuss and find the fix: https://github.com/stedolan/jq/pull/2400 Tom
The issue can be also avoided by providing `--disable-decnum` configure option HTH T.
I've put up https://src.fedoraproject.org/rpms/jq/pull-request/5 to address this.
FEDORA-2022-4e51f14539 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-4e51f14539
FEDORA-2022-4e51f14539 has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report.