Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/packages/resdata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ versions:
gpl-sources:
filename: gpl-sources.tar
description: elfutils
- version: 6.3.4
- version: 6.3.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Sat, 17 Oct 2026 00:00:00 +0000
Subject: [PATCH] Fix infinite loops at EOF where char is unsigned

Upstream-Status: Backport [https://github.com/equinor/resdata/commit/ce341a3666855c57839466d9daa876252b54c8c0]

fgetc() returns EOF (-1) as an int. Three loops store it in a plain
char and then test c == EOF; where char is unsigned (riscv64, aarch64)
c becomes 255, the test is always false (GCC: "comparison is always
false due to limited range of data type"), and the loop spins forever
once fgetc() keeps returning EOF:

- rd_kw_qskip(): any formatted file without a quote character, e.g.
tests/rd_tests/test_rd_file.py::test_broken_file, which hangs the
test suite at that test on riscv64;
- util_fskip_lines(): fixed upstream by the commit above;
- fscanf_grdecl_data(): a trailing "--" comment without a newline.

Upstream fixed the first as part of the rd::KW rewrite (d9eacc14e,
skip_space_until_quote()) and removed the third file in c05264026;
all three fixes are in 7.0.0b3 and in none of the 6.3.x releases.

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
lib/resdata/rd_kw.cpp | 2 +-
lib/resdata/rd_kw_grdecl.cpp | 2 +-
lib/util/util.cpp | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/resdata/rd_kw.cpp b/lib/resdata/rd_kw.cpp
index 17e08f4e7..f3c2475d1 100644
--- a/lib/resdata/rd_kw.cpp
+++ b/lib/resdata/rd_kw.cpp
@@ -1043,7 +1043,7 @@ static bool rd_kw_qskip(FILE *stream) {
const char newline = '\n';
const char tab = '\t';
bool OK = true;
- char c;
+ int c;
bool cont = true;
while (cont) {
c = fgetc(stream);
diff --git a/lib/resdata/rd_kw_grdecl.cpp b/lib/resdata/rd_kw_grdecl.cpp
index 55785de1f..34262a88b 100644
--- a/lib/resdata/rd_kw_grdecl.cpp
+++ b/lib/resdata/rd_kw_grdecl.cpp
@@ -232,7 +232,7 @@ fscanf_grdecl_data(const char *header, bool strict, int &kw_size,
if (fscanf(stream, "%32s", buffer.get()) == 1) {
if (strcmp(buffer.get(), RD_COMMENT_STRING) == 0) {
// We have read a comment marker - just read up to the end of line.
- char c;
+ int c;
while (true) {
c = fgetc(stream);
if (c == newline)
diff --git a/lib/util/util.cpp b/lib/util/util.cpp
index 4014b594b..ad2485779 100644
--- a/lib/util/util.cpp
+++ b/lib/util/util.cpp
@@ -807,7 +807,7 @@ void util_fskip_lines(FILE *stream, int lines) {
int line_nr = 0;
do {
bool at_eof = false;
- char c;
+ int c;
do {
c = fgetc(stream);
if (c == EOF)
--
2.47.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Sat, 17 Oct 2026 00:00:00 +0000
Subject: [PATCH] Raise test_performance_with_many_keys timeout for slower
hosts

Upstream-Status: Inappropriate [the 10s ceiling is sized for upstream's x86 CI; the riscv64 runners finish the same bounded work in about 12s]

The test builds a 5000-key summary case and lets pytest-benchmark run
summary.x over it. A call that takes longer than max_time (1s) makes
pytest-benchmark do exactly 2 calibration calls plus min_rounds (5),
so the work is a fixed 7 calls. On x86_64 one call takes about 0.1s
and the whole test about 1.2s, well inside its 10s marker. On the
riscv64 runners one call takes about 1.4s: the timeout fired after
the sixth call had printed its table, during the seventh and last.

The profile is linear in the number of keys (one SummaryKeyType
lookup per key); nothing loops. Raise the ceiling to 60s so it still
catches a real regression (a quadratic key lookup blows far past it)
without failing on a slower host.

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
tests/test_view_summary.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/test_view_summary.py b/tests/test_view_summary.py
index 91ae42c..dca1053 100644
--- a/tests/test_view_summary.py
+++ b/tests/test_view_summary.py
@@ -855,7 +855,7 @@ def test_that_restart_and_base_times_are_concated(capsys):


@pytest.mark.usefixtures("use_tmpdir")
-@pytest.mark.timeout(10)
+@pytest.mark.timeout(60)
def test_performance_with_many_keys(monkeypatch, benchmark):
subdir = Path("subdir")
subdir.mkdir()
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Sat, 17 Oct 2026 00:00:00 +0000
Subject: [PATCH] Fix infinite loops at EOF where char is unsigned

Upstream-Status: Backport [https://github.com/equinor/resdata/commit/ce341a3666855c57839466d9daa876252b54c8c0]

fgetc() returns EOF (-1) as an int. Three loops store it in a plain
char and then test c == EOF; where char is unsigned (riscv64, aarch64)
c becomes 255, the test is always false (GCC: "comparison is always
false due to limited range of data type"), and the loop spins forever
once fgetc() keeps returning EOF:

- rd_kw_qskip(): any formatted file without a quote character, e.g.
tests/rd_tests/test_rd_file.py::test_broken_file, which hangs the
test suite at that test on riscv64;
- util_fskip_lines(): fixed upstream by the commit above;
- fscanf_grdecl_data(): a trailing "--" comment without a newline.

Upstream fixed the first as part of the rd::KW rewrite (d9eacc14e,
skip_space_until_quote()) and removed the third file in c05264026;
all three fixes are in 7.0.0b3 and in none of the 6.3.x releases.

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
lib/resdata/rd_kw.cpp | 2 +-
lib/resdata/rd_kw_grdecl.cpp | 2 +-
lib/util/util.cpp | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/resdata/rd_kw.cpp b/lib/resdata/rd_kw.cpp
index 17e08f4e7..f3c2475d1 100644
--- a/lib/resdata/rd_kw.cpp
+++ b/lib/resdata/rd_kw.cpp
@@ -1043,7 +1043,7 @@ static bool rd_kw_qskip(FILE *stream) {
const char newline = '\n';
const char tab = '\t';
bool OK = true;
- char c;
+ int c;
bool cont = true;
while (cont) {
c = fgetc(stream);
diff --git a/lib/resdata/rd_kw_grdecl.cpp b/lib/resdata/rd_kw_grdecl.cpp
index 55785de1f..34262a88b 100644
--- a/lib/resdata/rd_kw_grdecl.cpp
+++ b/lib/resdata/rd_kw_grdecl.cpp
@@ -232,7 +232,7 @@ fscanf_grdecl_data(const char *header, bool strict, int &kw_size,
if (fscanf(stream, "%32s", buffer.get()) == 1) {
if (strcmp(buffer.get(), RD_COMMENT_STRING) == 0) {
// We have read a comment marker - just read up to the end of line.
- char c;
+ int c;
while (true) {
c = fgetc(stream);
if (c == newline)
diff --git a/lib/util/util.cpp b/lib/util/util.cpp
index 4014b594b..ad2485779 100644
--- a/lib/util/util.cpp
+++ b/lib/util/util.cpp
@@ -807,7 +807,7 @@ void util_fskip_lines(FILE *stream, int lines) {
int line_nr = 0;
do {
bool at_eof = false;
- char c;
+ int c;
do {
c = fgetc(stream);
if (c == EOF)
--
2.47.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Sat, 17 Oct 2026 00:00:00 +0000
Subject: [PATCH] Raise test_performance_with_many_keys timeout for slower
hosts

Upstream-Status: Inappropriate [the 10s ceiling is sized for upstream's x86 CI; the riscv64 runners finish the same bounded work in about 12s]

The test builds a 5000-key summary case and lets pytest-benchmark run
summary.x over it. A call that takes longer than max_time (1s) makes
pytest-benchmark do exactly 2 calibration calls plus min_rounds (5),
so the work is a fixed 7 calls. On x86_64 one call takes about 0.1s
and the whole test about 1.2s, well inside its 10s marker. On the
riscv64 runners one call takes about 1.4s: the timeout fired after
the sixth call had printed its table, during the seventh and last.

The profile is linear in the number of keys (one SummaryKeyType
lookup per key); nothing loops. Raise the ceiling to 60s so it still
catches a real regression (a quadratic key lookup blows far past it)
without failing on a slower host.

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
tests/test_view_summary.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/test_view_summary.py b/tests/test_view_summary.py
index 91ae42c..dca1053 100644
--- a/tests/test_view_summary.py
+++ b/tests/test_view_summary.py
@@ -855,7 +855,7 @@ def test_that_restart_and_base_times_are_concated(capsys):


@pytest.mark.usefixtures("use_tmpdir")
-@pytest.mark.timeout(10)
+@pytest.mark.timeout(60)
def test_performance_with_many_keys(monkeypatch, benchmark):
subdir = Path("subdir")
subdir.mkdir()
Loading