Fix iteration problem for non decimal string

Resolves: rhbz#2049594
This commit is contained in:
Tomas Halman 2022-10-21 15:24:57 +02:00
parent d88867bb86
commit 456553773a
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,25 @@
diff -up jq-1.6/src/jv.c.iteration jq-1.6/src/jv.c
--- jq-1.6/src/jv.c.iteration 2022-10-21 14:17:26.977551386 +0200
+++ jq-1.6/src/jv.c 2022-10-21 14:18:43.562430867 +0200
@@ -308,6 +308,7 @@ static jv jvp_literal_number_new(const c
n->refcnt = JV_REFCNT_INIT;
n->literal_data = NULL;
decContext *ctx = DEC_CONTEXT();
+ decContextClearStatus(ctx, DEC_Conversion_syntax);
decNumberFromString(&n->num_decimal, literal, ctx);
n->num_double = NAN;
diff -up jq-1.6/tests/optional.test.iteration jq-1.6/tests/optional.test
--- jq-1.6/tests/optional.test.iteration 2022-10-21 14:22:04.191734821 +0200
+++ jq-1.6/tests/optional.test 2022-10-21 14:23:45.820901911 +0200
@@ -17,4 +17,9 @@ strftime("%A, %B %e, %Y")
1435677542.822351
"Tuesday, June 30, 2015"
-
+# iteration must continue after hello
+.[]|tonumber?
+["1", "hello", "3", 4]
+1
+3
+4

View File

@ -1,6 +1,6 @@
Name: jq
Version: 1.6
Release: 12%{?dist}
Release: 13%{?dist}
Summary: Command-line JSON processor
License: MIT and ASL 2.0 and CC-BY and GPLv3
@ -8,6 +8,7 @@ URL: http://stedolan.github.io/jq/
Source0: https://github.com/stedolan/jq/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz
# Backport of PR#1752 for RHBZ#2008979
Patch0: jq-decimal-literal-number.patch
Patch1: 0001-iterration-problem-for-non-decimal-string.patch
BuildRequires: gcc
BuildRequires: flex
@ -98,6 +99,10 @@ make check
%changelog
* Fri Oct 21 2022 Tomas Halman <thalman@redhat.com> - 1.6-13
- jq try/catch stops iteration over items
Resolves: rhbz#2049594
* Mon Nov 15 2021 Tomas Halman <thalman@redhat.com>
- Strip rpath from jq binary
Related: rhbz#2008983