Add upstream patch to fix hashmap issue

This commit is contained in:
Orion Poplawski 2016-07-07 08:02:45 -06:00
parent e29d7e7aad
commit a37c838d19
2 changed files with 80 additions and 1 deletions

72
netcdf-hashmap.patch Normal file
View File

@ -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);

View File

@ -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 <orion@cora.nwra.com> - 4.4.1-2
- Add upstream patch to fix hashmap issue
* Wed Jun 29 2016 Orion Poplawski <orion@cora.nwra.com> - 4.4.1-1
- Update to 4.4.1