From a37c838d1936aa41e928b783f09c0f2890461724 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Thu, 7 Jul 2016 08:02:45 -0600 Subject: [PATCH] Add upstream patch to fix hashmap issue --- netcdf-hashmap.patch | 72 ++++++++++++++++++++++++++++++++++++++++++++ netcdf.spec | 9 +++++- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 netcdf-hashmap.patch diff --git a/netcdf-hashmap.patch b/netcdf-hashmap.patch new file mode 100644 index 0000000..d5dd066 --- /dev/null +++ b/netcdf-hashmap.patch @@ -0,0 +1,72 @@ +diff -up netcdf-c-4.4.1/libsrc/dim.c.hashmap netcdf-c-4.4.1/libsrc/dim.c +--- netcdf-c-4.4.1/libsrc/dim.c.hashmap 2016-07-07 07:56:11.162288945 -0600 ++++ netcdf-c-4.4.1/libsrc/dim.c 2016-07-07 08:00:16.655658910 -0600 +@@ -475,10 +475,12 @@ NC3_rename_dim( int ncid, int dimid, con + free(newname); + if(newStr == NULL) + return NC_ENOMEM; +- dimp->name = newStr; + + /* Remove old name from hashmap; add new... */ + NC_hashmapRemoveDim(&ncp->dims, old->cp); ++ ++ dimp->name = newStr; ++ + NC_hashmapAddDim(&ncp->dims, dimid, newStr->cp); + free_NC_string(old); + +@@ -487,13 +489,14 @@ NC3_rename_dim( int ncid, int dimid, con + + /* else, not in define mode */ + ++ /* Remove old name from hashmap; add new... */ ++ NC_hashmapRemoveDim(&ncp->dims, old->cp); ++ + status = set_NC_string(dimp->name, newname); + free(newname); + if(status != NC_NOERR) + return status; + +- /* Remove old name from hashmap; add new... */ +- NC_hashmapRemoveDim(&ncp->dims, old->cp); + NC_hashmapAddDim(&ncp->dims, dimid, dimp->name->cp); + + set_NC_hdirty(ncp); +diff -up netcdf-c-4.4.1/libsrc/var.c.hashmap netcdf-c-4.4.1/libsrc/var.c +--- netcdf-c-4.4.1/libsrc/var.c.hashmap 2016-07-07 07:56:11.162288945 -0600 ++++ netcdf-c-4.4.1/libsrc/var.c 2016-07-07 07:58:52.282847833 -0600 +@@ -740,14 +740,15 @@ NC3_rename_var(int ncid, int varid, cons + return NC_ENOMEM; + if(NC_indef(ncp)) + { ++ /* Remove old name from hashmap; add new... */ ++ NC_hashmapRemoveVar(&ncp->vars, old->cp); ++ + newStr = new_NC_string(strlen(newname),newname); + free(newname); + if(newStr == NULL) + return(-1); + varp->name = newStr; + +- /* Remove old name from hashmap; add new... */ +- NC_hashmapRemoveVar(&ncp->vars, old->cp); + NC_hashmapAddVar(&ncp->vars, varid, newStr->cp); + free_NC_string(old); + +@@ -755,13 +756,14 @@ NC3_rename_var(int ncid, int varid, cons + } + + /* else, not in define mode */ ++ /* Remove old name from hashmap; add new... */ ++ NC_hashmapRemoveVar(&ncp->vars, old->cp); ++ + status = set_NC_string(varp->name, newname); + free(newname); + if(status != NC_NOERR) + return status; + +- /* Remove old name from hashmap; add new... */ +- NC_hashmapRemoveVar(&ncp->vars, old->cp); + NC_hashmapAddVar(&ncp->vars, varid, varp->name->cp); + + set_NC_hdirty(ncp); diff --git a/netcdf.spec b/netcdf.spec index 0d4a80c..b869815 100644 --- a/netcdf.spec +++ b/netcdf.spec @@ -1,12 +1,15 @@ Name: netcdf Version: 4.4.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Libraries for the Unidata network Common Data Form Group: Applications/Engineering License: NetCDF URL: http://www.unidata.ucar.edu/software/netcdf/ Source0: https://github.com/Unidata/netcdf-c/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +# Upstream patch to fix hashmap issue +# https://github.com/Unidata/netcdf-c/issues/282 +Patch0: netcdf-hashmap.patch BuildRequires: chrpath BuildRequires: doxygen @@ -175,6 +178,7 @@ NetCDF parallel openmpi static libraries %prep %setup -q -n %{name}-c-%{version} +%patch0 -p1 -b .hashmap m4 libsrc/ncx.m4 > libsrc/ncx.c @@ -330,6 +334,9 @@ done %changelog +* Thu Jul 7 2016 Orion Poplawski - 4.4.1-2 +- Add upstream patch to fix hashmap issue + * Wed Jun 29 2016 Orion Poplawski - 4.4.1-1 - Update to 4.4.1