Bug#1095478: vtk9: FTBFS with NetCDF 4.9.3
Sebastiaan Couwenberg
sebastic at xs4all.nl
Sat Feb 8 17:14:26 GMT 2025
Control: tags -1 patch
The attached patch fixes the issue by using NC_FillValue instead.
Kind Regards,
Bas
--
GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146 50D1 6750 F10A E88D 4AF1
-------------- next part --------------
diff -Nru vtk9-9.3.0+dfsg1/debian/patches/netcdf-4.9.3.patch vtk9-9.3.0+dfsg1/debian/patches/netcdf-4.9.3.patch
--- vtk9-9.3.0+dfsg1/debian/patches/netcdf-4.9.3.patch 1970-01-01 01:00:00.000000000 +0100
+++ vtk9-9.3.0+dfsg1/debian/patches/netcdf-4.9.3.patch 2025-02-08 12:09:49.000000000 +0100
@@ -0,0 +1,172 @@
+Description: Replace _FillValue by NC_FillValue for NetCDF 4.9.3.
+Author: Bas Couwenberg <sebastic at debian.org>
+
+--- a/IO/MINC/vtkMINC.h
++++ b/IO/MINC/vtkMINC.h
+@@ -178,7 +178,7 @@ use it.
+ #define MIvalid_range "valid_range"
+ #define MIvalid_max "valid_max"
+ #define MIvalid_min "valid_min"
+-#define MI_FillValue "_FillValue"
++#define MI_FillValue "NC_FillValue"
+ #define MItitle "title"
+ #define MIhistory "history"
+
+--- a/IO/NetCDF/vtkNetCDFCFWriter.cxx
++++ b/IO/NetCDF/vtkNetCDFCFWriter.cxx
+@@ -442,7 +442,7 @@ public:
+ status = NC_NOERR;
+ if (std::string(arrayName).rfind("vtk", 0) > 0)
+ {
+- // for an array that starts with vtk we don't specify _FillValue
++ // for an array that starts with vtk we don't specify NC_FillValue
+ switch (vtkType)
+ {
+ case VTK_CHAR:
+@@ -451,34 +451,34 @@ public:
+ if (fillValue != NC_FILL_INT)
+ {
+ unsigned char fillByte = fillValue;
+- status = nc_put_att(ncid, attributeid, "_FillValue", NC_BYTE, 1, &fillByte);
++ status = nc_put_att(ncid, attributeid, "NC_FillValue", NC_BYTE, 1, &fillByte);
+ }
+ break;
+ case VTK_SHORT:
+ if (fillValue != NC_FILL_SHORT)
+ {
+ short fillShort = fillValue;
+- status = nc_put_att_short(ncid, attributeid, "_FillValue", NC_SHORT, 1, &fillShort);
++ status = nc_put_att_short(ncid, attributeid, "NC_FillValue", NC_SHORT, 1, &fillShort);
+ }
+ break;
+ case VTK_INT:
+ if (fillValue != NC_FILL_INT)
+ {
+- status = nc_put_att_int(ncid, attributeid, "_FillValue", NC_INT, 1, &fillValue);
++ status = nc_put_att_int(ncid, attributeid, "NC_FillValue", NC_INT, 1, &fillValue);
+ }
+ break;
+ case VTK_FLOAT:
+ if (fillValue != NC_FILL_INT)
+ {
+ float fillFloat = fillValue;
+- status = nc_put_att_float(ncid, attributeid, "_FillValue", NC_FLOAT, 1, &fillFloat);
++ status = nc_put_att_float(ncid, attributeid, "NC_FillValue", NC_FLOAT, 1, &fillFloat);
+ }
+ break;
+ case VTK_DOUBLE:
+ if (fillValue != NC_FILL_INT)
+ {
+ double fillDouble = fillValue;
+- status = nc_put_att_double(ncid, attributeid, "_FillValue", NC_DOUBLE, 1, &fillDouble);
++ status = nc_put_att_double(ncid, attributeid, "NC_FillValue", NC_DOUBLE, 1, &fillDouble);
+ }
+ break;
+ default:
+@@ -489,7 +489,7 @@ public:
+ if (status)
+ {
+ std::ostringstream ostr;
+- ostr << "Error nc_put_att_xxx " << arrayName << ":_FillValue: " << nc_strerror(status);
++ ostr << "Error nc_put_att_xxx " << arrayName << ":NC_FillValue: " << nc_strerror(status);
+ throw std::runtime_error(ostr.str());
+ }
+ }
+--- a/IO/NetCDF/vtkNetCDFReader.cxx
++++ b/IO/NetCDF/vtkNetCDFReader.cxx
+@@ -867,7 +867,7 @@ int vtkNetCDFReader::LoadVariable(int nc
+
+ // Check for a fill value.
+ size_t attribLength;
+- if ((nc_inq_attlen(ncFD, varId, "_FillValue", &attribLength) == NC_NOERR) && (attribLength == 1))
++ if ((nc_inq_attlen(ncFD, varId, "NC_FillValue", &attribLength) == NC_NOERR) && (attribLength == 1))
+ {
+ if (this->ReplaceFillValueWithNan)
+ {
+@@ -875,7 +875,7 @@ int vtkNetCDFReader::LoadVariable(int nc
+ if (dataArray->GetDataType() == VTK_FLOAT)
+ {
+ float fillValue;
+- nc_get_att_float(ncFD, varId, "_FillValue", &fillValue);
++ nc_get_att_float(ncFD, varId, "NC_FillValue", &fillValue);
+ std::replace(reinterpret_cast<float*>(dataArray->GetVoidPointer(0)),
+ reinterpret_cast<float*>(dataArray->GetVoidPointer(dataArray->GetNumberOfTuples())),
+ fillValue, static_cast<float>(vtkMath::Nan()));
+@@ -883,7 +883,7 @@ int vtkNetCDFReader::LoadVariable(int nc
+ else if (dataArray->GetDataType() == VTK_DOUBLE)
+ {
+ double fillValue;
+- nc_get_att_double(ncFD, varId, "_FillValue", &fillValue);
++ nc_get_att_double(ncFD, varId, "NC_FillValue", &fillValue);
+ std::replace(reinterpret_cast<double*>(dataArray->GetVoidPointer(0)),
+ reinterpret_cast<double*>(dataArray->GetVoidPointer(dataArray->GetNumberOfTuples())),
+ fillValue, vtkMath::Nan());
+--- a/IO/NetCDF/vtkNetCDFReader.h
++++ b/IO/NetCDF/vtkNetCDFReader.h
+@@ -107,7 +107,7 @@ public:
+
+ ///@{
+ /**
+- * If on, any float or double variable read that has a _FillValue attribute
++ * If on, any float or double variable read that has a NC_FillValue attribute
+ * will have that fill value replaced with a not-a-number (NaN) value. The
+ * advantage of setting these to NaN values is that, if implemented properly
+ * by the system and careful math operations are used, they can implicitly be
+--- a/IO/NetCDF/vtkNetCDFUGRIDReader.cxx
++++ b/IO/NetCDF/vtkNetCDFUGRIDReader.cxx
+@@ -508,10 +508,10 @@ bool vtkNetCDFUGRIDReader::ParseHeader()
+ if (this->NodesPerFace > 3) // may be mixed mesh
+ {
+ if (!this->CheckError(
+- nc_get_att(this->NcId, this->FaceVarId, "_FillValue", &this->FaceFillValue)))
++ nc_get_att(this->NcId, this->FaceVarId, "NC_FillValue", &this->FaceFillValue)))
+ {
+- vtkErrorMacro("_FillValue attribute missing - The connectivity variable has to specify a "
+- "_FillValue attribute because it has more than 3 nodes per face");
++ vtkErrorMacro("NC_FillValue attribute missing - The connectivity variable has to specify a "
++ "NC_FillValue attribute because it has more than 3 nodes per face");
+ return false;
+ }
+ }
+@@ -859,7 +859,7 @@ struct DataArrayExtractor
+ if (replaceFill && (std::is_same<T, float>::value || std::is_same<T, double>::value))
+ {
+ T fillValue{};
+- if (nc_get_att(NcId, var, "_FillValue", &fillValue) != NC_NOERR)
++ if (nc_get_att(NcId, var, "NC_FillValue", &fillValue) != NC_NOERR)
+ {
+ vtkDebugWithObjectMacro(output, "No fill value defined");
+ return;
+--- a/IO/NetCDF/vtkNetCDFUGRIDReader.h
++++ b/IO/NetCDF/vtkNetCDFUGRIDReader.h
+@@ -76,7 +76,7 @@ public:
+
+ ///@{
+ /**
+- * If on, any float or double variable read that has a _FillValue attribute
++ * If on, any float or double variable read that has a NC_FillValue attribute
+ * will have that fill value replaced with a not-a-number (NaN) value. The
+ * advantage of setting these to NaN values is that, if implemented properly
+ * by the system and careful math operations are used, they can implicitly be
+--- a/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop.c
++++ b/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop.c
+@@ -243,7 +243,7 @@ int ex_put_prop(int exoid, ex_entity_typ
+ vals[0] = 0; /* fill value */
+ /* create attribute to cause variable to fill with zeros per routine spec
+ */
+- if ((status = nc_put_att_longlong(exoid, propid, _FillValue, int_type, 1, vals)) != NC_NOERR) {
++ if ((status = nc_put_att_longlong(exoid, propid, NC_FillValue, int_type, 1, vals)) != NC_NOERR) {
+ snprintf(errmsg, MAX_ERR_LENGTH,
+ "ERROR: failed to create property name fill attribute in file id %d", exoid);
+ ex_err_fn(exoid, __func__, errmsg, status);
+--- a/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop_names.c
++++ b/ThirdParty/exodusII/vtkexodusII/src/ex_put_prop_names.c
+@@ -172,7 +172,7 @@ int ex_put_prop_names(int exoid, ex_enti
+
+ /* create attribute to cause variable to fill with zeros per routine spec
+ */
+- if ((status = nc_put_att_longlong(exoid, propid, _FillValue, int_type, 1, vals)) != NC_NOERR) {
++ if ((status = nc_put_att_longlong(exoid, propid, NC_FillValue, int_type, 1, vals)) != NC_NOERR) {
+ snprintf(errmsg, MAX_ERR_LENGTH,
+ "ERROR: failed to create property name fill attribute in file id %d", exoid);
+ ex_err_fn(exoid, __func__, errmsg, status);
diff -Nru vtk9-9.3.0+dfsg1/debian/patches/series vtk9-9.3.0+dfsg1/debian/patches/series
--- vtk9-9.3.0+dfsg1/debian/patches/series 2025-01-28 21:37:13.000000000 +0100
+++ vtk9-9.3.0+dfsg1/debian/patches/series 2025-02-08 12:09:49.000000000 +0100
@@ -13,3 +13,4 @@
100_add_missing_gl_header.patch
121_add_support_for_loong64.patch
130_fix_python_3.13.patch
+netcdf-4.9.3.patch
More information about the debian-science-maintainers
mailing list