Bug#1140677: med-fichier: FTBFS against HDF5 2.1.0

Tobias Frost <[email protected]>
Newsgroups gmane.linux.debian.devel.bugs.rc
Message-ID <c667a89ad1d576e5ab66cfe66e71834e98f73f68.camel__31268.156522286$1787478558$gmane$org@debian.org>
Control: tags -1 patch

Hi Gilles,

I was looking into this yesterday/today
I've tracked down the failures and prepared three
patches:

  * fix the Python bindings for current SWIG/Python versions to avoid an
    early FTBFS
  * relax the HDF5 version compatibility check, this will fix some
  * explicitly close the MED file in Test_MEDnStructElement, avoiding the
    HDF5 library shutdown error with HDF5 2.1.0 (manifesting as the
    infinite loop you've described below. (a quick $searchengine check
    seems that this might be a bug in HDF5.)

With these patches applied, the test suite completes successfully.

I've uploaded the packages for a testbuild to
https://debusine.debian.net/debian/developers/work-request/1090706
(ignore the FreeCAD autopkgtest failure, that's a bad newly added test)

I've also locally updated the package to upstream version 4.1.1, which is
available and can be provided as part of the update.

As the package is currently under RFA, how would you like me to proceed?
I can certainly add my name to Uploaders to share the load, but I have
no experience with HDF5 ecosystem...

I'm attaching the (three) patches as a diff to the current pacakge in
the archives.

-- 
Cheers,
tobi

On Wed, 24 Jun 2026 15:02:55 +0200 Gilles Filippini <[email protected]>
wrote:
> Source: med-fichier
> Version: 4.1.0+repack-10
> Severity: important
> Tags: ftbfs
> X-Debbugs-Cc: [email protected]
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> Hi,
> 
> During a test rebuild of HDF5's reverse dependcies against HDF5 2.1.0
> currently in experimental, med-fichier FTBFS with 2 failing tests.
> 
> Patching src/ci/MEDfileCompatibility.c to relax the HDF5 version
check
> works, but then another test fails more badly in tests/unittests/c:
> 
> FAIL: Test_MEDnStructElement_Rd.sh
> 
> The output from this failing test is:
> 
> ../../../../tests/unittests/c/Test_MEDnStructElement.c [48] :
_nstructelement = 2
> HDF5: infinite loop closing library
>      
L,T_top,F,P,P,FD,VL,VL,E,SL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,F
L,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,
FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL
,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,FL,F
L,FL,FL,FL,FL,FL,FL,FL
> Aborted
> 
> Best,
> _g.
> 
> - -- System Information:
> Debian Release: 12.0
> Architecture: amd64 (x86_64)
> 
> Kernel: Linux 6.1.0-44-amd64 (SMP w/12 CPU threads; PREEMPT)
> Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
> Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8),
LANGUAGE not set
> Shell: /bin/sh linked to /usr/bin/dash
> Init: systemd (via /run/systemd/system)
> LSM: AppArmor: enabled
> 
> -----BEGIN PGP SIGNATURE-----
> 
> iQEzBAEBCgAdFiEEoJObzArDE05WtIyR7+hsbH/+z4MFAmo71XYACgkQ7+hsbH/+
> z4OaTAgArv4QEy7D2MxZOAZnZ5hhYCFv3OdeHCHURnY9yKcqQdb5ZlYcnVwqdDgO
> bsgfRetSrgV2xxdLP4yyicJZcJRuAQ9/L/FlKfAO1IDt2h6IjrVoB/AhlWhLYyj6
> zYqO1gq4lUvTh6YSzs20gfnl8FR7ggiiuXXXjNPzlPeSLeFRu5rQbZ8slanTAIqm
> WAal3dNZI08ih/Gyi/+Z7gJakcfHDyRhy99wBVeYr3ZoSb8ogITz+Rn0tAinRqmc
> hb+pEkOLFBPrZl2tHb2DzTliQAjhCLFetBTmyWSj7mqBPC7sylQhF6ztcvaPfutY
> 3WS23Qd+rfq7OFkChXCWupseh6ih+Q==
> =SRrH
> -----END PGP SIGNATURE-----
> 
>
med-fichier.patch (text/x-diff, 3.8 KB)
diff --git a/debian/patches/fix-ftbfs-python.patch b/debian/patches/fix-ftbfs-python.patch
new file mode 100644
index 00000000..a7910d07
--- /dev/null
+++ b/debian/patches/fix-ftbfs-python.patch
@@ -0,0 +1,22 @@
+Description: Replace obsolete Python 2 API calls in SWIG bindings
+Replace PyString_FromString() and PyInt_FromLong() with the corresponding
+ Python 3 API functions PyUnicode_FromString() and PyLong_FromLong().
+ This is required to build the Python bindings with current Python versions.
+Author: Tobias Frost <[email protected]>
+Last-Update: 2026-08-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/python/med_common.i
++++ b/python/med_common.i
+@@ -13,8 +13,8 @@
+       /* fprintf(stderr,"Code erreur MED : %2d\n",result); */
+       /* SWIG_exception(SWIG_RuntimeError,"Error returned from MEDfichier API (funcname)."); */
+       PyObject* exobj = PyTuple_New(2);
+-      PyTuple_SetItem(exobj,0,PyString_FromString("Error returned from MEDfichier API (funcname)."));
+-      PyTuple_SetItem(exobj,1,PyInt_FromLong((long) result));
++      PyTuple_SetItem(exobj,0,PyUnicode_FromString("Error returned from MEDfichier API (funcname)."));
++      PyTuple_SetItem(exobj,1,PyLong_FromLong((long) result));
+       SWIG_Python_SetErrorObj(PyExc_RuntimeError,exobj);
+       /* PyErr_SetString(PyExc_Exception, str(result));  */
+       return NULL;
+
diff --git a/debian/patches/fix-tests.patch b/debian/patches/fix-tests.patch
new file mode 100644
index 00000000..824e57d0
--- /dev/null
+++ b/debian/patches/fix-tests.patch
@@ -0,0 +1,22 @@
+Description: Close MED file in Test_MEDnStructElement
+ Explicitly close the MED file opened by Test_MEDnStructElement before
+ exiting the test. This prevents HDF5 from encountering the still-open
+ file handle during library shutdown.
+ This fixes the infinite loop experienced during the test suite.
+Author: Tobias Frost <[email protected]>
+Last-Update: 2026-08-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/tests/unittests/c/Test_MEDnStructElement.c
++++ b/tests/unittests/c/Test_MEDnStructElement.c
+@@ -47,6 +47,10 @@
+ 
+   ISCRUTE(_nstructelement);
+ 
++  if (MEDfileClose(_fid) < 0)
++    _ret = -1;
++
++
+   return _ret;
+ 
+ }
diff --git a/debian/patches/relax-hdf5-version-check.patch b/debian/patches/relax-hdf5-version-check.patch
new file mode 100644
index 00000000..75b2680f
--- /dev/null
+++ b/debian/patches/relax-hdf5-version-check.patch
@@ -0,0 +1,22 @@
+Description: Relax HDF5 version compatibility check
+ The HDF5 compatibility check incorrectly rejects HDF5 library versions
+ whose minor version is newer than the minimum reference version, even
+ when the complete HDF5 version is at or above the required version.
+ Compare the complete HDF5 version number instead of checking the minor
+ version separately.
+Author: Tobias Frost <[email protected]>
+Last-Update: 2026-08-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/src/ci/MEDfileCompatibility.c
++++ b/src/ci/MEDfileCompatibility.c
+@@ -70,7 +70,7 @@
+   _hversionMMR=10000*_hmajeur+100*_hmineur+_hrelease;
+   /* ISCRUTE(_hversionMMR); */
+   /* ISCRUTE(HDF_VERSION_NUM_REF); */
+-  if ( (_hversionMMR >= HDF_VERSION_NUM_REF) && (_hmineur >= HDF_VERSION_MINOR_REF) ) *hdfok = MED_TRUE;
++  if ( _hversionMMR >= HDF_VERSION_NUM_REF ) *hdfok = MED_TRUE;
+ 
+   /* TODO : Vérifier si la version mineure HDF du fichier est supérieure
+      à la version mineure de la bibliothèque HDF utilisée :
+
diff --git a/debian/patches/series b/debian/patches/series
index e891316e..51b0f0d4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,6 @@ hdf5-1.14.patch
 fix-swig-deprecated-python.patch
 swig-4.3.patch
 incompatible-pointer-types.patch
+fix-ftbfs-python.patch
+fix-tests.patch
+relax-hdf5-version-check.patch
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEE/d0M/zhkJ3YwohhskWT6HRe9XTYFAmqKwZkACgkQkWT6HRe9
XTYJ/Q//awv9T2pWxMWM6ZVl30LwUIAy/EdElGMmwwY4HrheV1Nl7Dqlhwr2eHr/
1bZ5PQjWp7zXkDFbVQYrtRXGpwOWMAQhlg9kgTZSWuuVsm14nw4cKk22EE5K3Epi
UrwFcuRLfGv2EWPvyfSrnU6cTZjS1XcTaR3Tao4mFuaziG1telfKt201FpJMIOYH
LffsNkUR0bmhUTji2E9Gy3xGdMgy0A81HzVX+TMjm41vWrCWWz/Kk2eWb7tRc3vW
vIpNcPMMcye+D8YCFoR4bcMj2QU2Y7eWNTgyOClMMzkr8AflljOcjLGo84dajsDt
Tz2xXFhP8gvr2KLWOR/gXZ6fnBZXNpW8G9BKWu9WZw2LL4jX7rPRPq1Zj6UmnnUt
Vm7bBhKZcYSVmEjbvVv7wvIP7cnZE0SRRVrlTFDDh5ZvHi6ypS7llzUhIdSt2GMP
8RLixo1v26fUFkzZbd5EQGd0MQ3lDGyH2EF3jgSC/74fmBTLtMBXfBlNZnlRmDnb
qrd7SE/7aWEOAbl70CVGgZTfl3v/dnnlxUDmvbRf8O/D5f9KrOasOMKKcp474Lev
C3ciwj0/aAzKokF/BsW69aMCls35LNxjYPGWGRtKzFtCc3aQV/eg3kMuJau9Z/14
083fR8O298gKRokE5/8NzycL4YPTXW/YMjxjBY/g04A1poJXeXA=
=4tR2
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.