[netcdf] 01/04: Imported Upstream version 4.4.0~rc5

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Thu Nov 12 10:29:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository netcdf.

commit 2fec2b9df60bfb2dbf83224fb981a19b562775e6
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Nov 12 11:14:37 2015 +0100

    Imported Upstream version 4.4.0~rc5
---
 .gitignore                                    |  4 ++
 CMakeLists.txt                                |  2 +-
 RELEASE_NOTES.md                              |  4 ++
 configure                                     | 28 +++++-----
 configure.ac                                  |  4 +-
 Doxyfile.developer => docs/Doxyfile.developer |  2 +-
 docs/windows-binaries.md                      | 26 +++++-----
 libsrc4/nc4attr.c                             | 36 ++++++++-----
 nc_test4/CMakeLists.txt                       |  2 +-
 nc_test4/Makefile.am                          |  7 +--
 nc_test4/Makefile.in                          | 75 ++++++++++++++++-----------
 nc_test4/tst_atts_string_rewrite.c            | 47 +++++++++++++++++
 12 files changed, 160 insertions(+), 77 deletions(-)

diff --git a/.gitignore b/.gitignore
index 791625a..08ae84b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,7 @@
+#####
+# End ignored generated files.
+#####
+
 ### 'Normal' gitignore files.
 autom4te.cache
 ctest.c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 273d3e4..2e80546 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,7 @@ set(PACKAGE "netCDF" CACHE STRING "")
 SET(NC_VERSION_MAJOR 4)
 SET(NC_VERSION_MINOR 4)
 SET(NC_VERSION_PATCH 0)
-SET(NC_VERSION_NOTE "-rc4")
+SET(NC_VERSION_NOTE "-rc5")
 SET(netCDF_VERSION ${NC_VERSION_MAJOR}.${NC_VERSION_MINOR}.${NC_VERSION_PATCH}${NC_VERSION_NOTE})
 SET(VERSION ${netCDF_VERSION})
 SET(NC_VERSION ${netCDF_VERSION})
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 0f4bb1d..fd3a823 100755
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -7,6 +7,10 @@ This file contains a high-level description of this package's evolution. Release
 
 ## 4.4.0 Released TBD
 
+### 4.4.0-RC5 Released - November 11, 2015
+
+* Added a fix for https://github.com/Unidata/netcdf-c/issues/149, which was reported several times in quick succession within an hour of the RC4 release.
+
 ### 4.4.0-RC4 Released - November 10, 2015
 
 * Added CDM-5 support via new mode flag called NC_64BIT_DATA (alias NC_CDF5).
diff --git a/configure b/configure
index c67399e..ff488ee 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 # From configure.ac Id: configure.ac,v 1.450 2010/05/28 19:42:47 dmh Exp .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for netCDF 4.4.0-rc4.
+# Generated by GNU Autoconf 2.69 for netCDF 4.4.0-development.
 #
 # Report bugs to <support-netcdf at unidata.ucar.edu>.
 #
@@ -591,8 +591,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='netCDF'
 PACKAGE_TARNAME='netcdf'
-PACKAGE_VERSION='4.4.0-rc4'
-PACKAGE_STRING='netCDF 4.4.0-rc4'
+PACKAGE_VERSION='4.4.0-development'
+PACKAGE_STRING='netCDF 4.4.0-development'
 PACKAGE_BUGREPORT='support-netcdf at unidata.ucar.edu'
 PACKAGE_URL=''
 
@@ -1496,7 +1496,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures netCDF 4.4.0-rc4 to adapt to many kinds of systems.
+\`configure' configures netCDF 4.4.0-development to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1567,7 +1567,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of netCDF 4.4.0-rc4:";;
+     short | recursive ) echo "Configuration of netCDF 4.4.0-development:";;
    esac
   cat <<\_ACEOF
 
@@ -1784,7 +1784,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-netCDF configure 4.4.0-rc4
+netCDF configure 4.4.0-development
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2493,7 +2493,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by netCDF $as_me 4.4.0-rc4, which was
+It was created by netCDF $as_me 4.4.0-development, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2848,7 +2848,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
  NC_VERSION_MAJOR=4
  NC_VERSION_MINOR=4
  NC_VERSION_PATCH=0
- NC_VERSION_NOTE="-rc4"
+ NC_VERSION_NOTE="-rc5"
 
 #####
 # Set some variables used to generate a libnetcdf.settings file,
@@ -2857,11 +2857,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 # Create the VERSION file, which contains the package version from
 # AC_INIT.
-echo 4.4.0-rc4>VERSION
+echo 4.4.0-development>VERSION
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.4.0-rc4" >&5
-$as_echo "$as_me: netCDF 4.4.0-rc4" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: netCDF 4.4.0-development" >&5
+$as_echo "$as_me: netCDF 4.4.0-development" >&6;}
 
 # Keep libtool macros in an m4 directory.
 
@@ -3502,7 +3502,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='netcdf'
- VERSION='4.4.0-rc4'
+ VERSION='4.4.0-development'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -19687,7 +19687,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by netCDF $as_me 4.4.0-rc4, which was
+This file was extended by netCDF $as_me 4.4.0-development, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -19753,7 +19753,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-netCDF config.status 4.4.0-rc4
+netCDF config.status 4.4.0-development
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index ede1552..cf714d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,12 +15,12 @@ AC_REVISION([$Id: configure.ac,v 1.450 2010/05/28 19:42:47 dmh Exp $])
 AC_PREREQ([2.59])
 
 # Initialize with name, version, and support email address.
-AC_INIT([netCDF], [4.4.0-rc4], [support-netcdf at unidata.ucar.edu])
+AC_INIT([netCDF], [4.4.0-development], [support-netcdf at unidata.ucar.edu])
 
 AC_SUBST([NC_VERSION_MAJOR]) NC_VERSION_MAJOR=4
 AC_SUBST([NC_VERSION_MINOR]) NC_VERSION_MINOR=4
 AC_SUBST([NC_VERSION_PATCH]) NC_VERSION_PATCH=0
-AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE="-rc4"
+AC_SUBST([NC_VERSION_NOTE]) NC_VERSION_NOTE="-rc5"
 
 #####
 # Set some variables used to generate a libnetcdf.settings file,
diff --git a/Doxyfile.developer b/docs/Doxyfile.developer
similarity index 99%
rename from Doxyfile.developer
rename to docs/Doxyfile.developer
index b49d91d..a743dc4 100755
--- a/Doxyfile.developer
+++ b/docs/Doxyfile.developer
@@ -38,7 +38,7 @@ PROJECT_NAME           = netCDF-C
 # could be handy for archiving the generated documentation or if some version
 # control system is used.
 
-PROJECT_NUMBER         = 4.4.0-rc4
+PROJECT_NUMBER         = 4.4.0-RC5
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer a
diff --git a/docs/windows-binaries.md b/docs/windows-binaries.md
index 5f37f95..2cf7062 100644
--- a/docs/windows-binaries.md
+++ b/docs/windows-binaries.md
@@ -32,14 +32,14 @@ The included dependencies and versions are as follows:
 * `libcurl`: 7.35.0
 * `zlib`:    1.2.8
 
-## Latest Release (netCDF-C 4.4.0-rc4) {#msvc-latest-release}
+## Latest Release (netCDF-C 4.4.0-rc5) {#msvc-latest-release}
 
 Configuration		| 32-bit 						| 64-bit |
 :-------------------|:--------							|:-------|
-netCDF 3		| [netCDF4.4.0-rc4-NC3-32.exe][r1]		| [netCDF4.4.0-rc4-NC3-64.exe][r6]
-netCDF3+DAP		| [netCDF4.4.0-rc4-NC3-DAP-32.exe][r2]	| [netCDF4.4.0-rc4-NC3-DAP-64.exe][r6]
-netCDF4			| [netCDF4.4.0-rc4-NC4-32.exe][r3]		| [netCDF4.4.0-rc4-NC4-64.exe][r7]
-netCDF4+DAP		| [netCDF4.4.0-rc4-NC4-DAP-32.exe][r4]	| [netCDF4.4.0-rc4-NC4-DAP-64.exe][r8]
+netCDF 3		| [netCDF4.4.0-rc5-NC3-32.exe][r1]		| [netCDF4.4.0-rc5-NC3-64.exe][r6]
+netCDF3+DAP		| [netCDF4.4.0-rc5-NC3-DAP-32.exe][r2]	| [netCDF4.4.0-rc5-NC3-DAP-64.exe][r6]
+netCDF4			| [netCDF4.4.0-rc5-NC4-32.exe][r3]		| [netCDF4.4.0-rc5-NC4-64.exe][r7]
+netCDF4+DAP		| [netCDF4.4.0-rc5-NC4-DAP-32.exe][r4]	| [netCDF4.4.0-rc5-NC4-DAP-64.exe][r8]
 
 # Using the netCDF-C Libraries with Visual Studio {#msvc-using}
 
@@ -60,11 +60,11 @@ When installed, the netCDF libraries are placed in the specified locations, alon
 1. When building the netCDF-C libraries with netCDF4 support, using the `Debug` libraries may cause extraneous warnings. These warnings are related to cross-dll memory management, and appear to be harmless. You can safely ignore them by using the `Release` libraries. [NCF-220]
 
 
-[r1]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc4-NC3-32.exe
-[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc4-NC3-DAP-32.exe
-[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc4-NC4-32.exe
-[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc4-NC4-DAP-32.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc4-NC3-64.exe
-[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc4-NC3-DAP-64.exe
-[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc4-NC4-64.exe
-[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc4-NC4-DAP-64.exe
+[r1]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc5-NC3-32.exe
+[r2]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc5-NC3-DAP-32.exe
+[r3]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc5-NC4-32.exe
+[r4]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc5-NC4-DAP-32.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc5-NC3-64.exe
+[r6]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc5-NC3-DAP-64.exe
+[r7]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc5-NC4-64.exe
+[r8]: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netCDF4.4.0-rc5-NC4-DAP-64.exe
diff --git a/libsrc4/nc4attr.c b/libsrc4/nc4attr.c
index 570c31b..c1d038a 100644
--- a/libsrc4/nc4attr.c
+++ b/libsrc4/nc4attr.c
@@ -410,7 +410,7 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name,
       }
       else
 	 memcpy(var->fill_value, data, type_size);
-      
+
       /* Indicate that the fill value was changed, if the variable has already
        * been created in the file, so the dataset gets deleted and re-created. */
       if (var->created)
@@ -455,19 +455,29 @@ nc4_put_att(int ncid, NC *nc, int varid, const char *name,
       }
       else if (type_class == NC_STRING)
       {
-         LOG((4, "copying array of NC_STRING"));
-         if (!(att->stdata = malloc(sizeof(char *) * att->len)))
-            BAIL(NC_ENOMEM);
-         for (i = 0; i < att->len; i++)
-         {
+        LOG((4, "copying array of NC_STRING"));
+        if (!(att->stdata = malloc(sizeof(char *) * att->len))) {
+          BAIL(NC_ENOMEM);
+        }
+
+        /* If we are overwriting an existing attribute,
+           specifically an NC_CHAR, we need to clean up
+           the pre-existing att->data. */
+        if (!new_att && att->data) {
+          free(att->data);
+          att->data = NULL;
+        }
+
+        for (i = 0; i < att->len; i++)
+          {
             if(NULL != ((char **)data)[i]) {
-               LOG((5, "copying string %d of size %d", i, strlen(((char **)data)[i]) + 1));
-               if (!(att->stdata[i] = strdup(((char **)data)[i])))
-                  BAIL(NC_ENOMEM);
-           }
-           else
-               att->stdata[i] = ((char **)data)[i];
-         }
+              LOG((5, "copying string %d of size %d", i, strlen(((char **)data)[i]) + 1));
+              if (!(att->stdata[i] = strdup(((char **)data)[i])))
+                BAIL(NC_ENOMEM);
+            }
+            else
+              att->stdata[i] = ((char **)data)[i];
+          }
       }
       else
       {
diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt
index 475289a..2f727f8 100644
--- a/nc_test4/CMakeLists.txt
+++ b/nc_test4/CMakeLists.txt
@@ -8,7 +8,7 @@ SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars
   tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts
   t_type cdm_sea_soundings tst_vl tst_atts1 tst_atts2
   tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs
-  tst_h_scalar tst_rename tst_h5_endians)
+  tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite)
 
 # Note, renamegroup needs to be compiled before run_grp_rename
 build_bin_test(renamegroup)
diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am
index 3c68014..4aa27da 100644
--- a/nc_test4/Makefile.am
+++ b/nc_test4/Makefile.am
@@ -21,7 +21,7 @@ tst_chunks tst_chunks2 tst_utf8 tst_fills tst_fills2 tst_fillbug	\
 tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts	\
 t_type cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2		\
 tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs        \
-tst_h_scalar tst_rename tst_h5_endians
+tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite
 
 check_PROGRAMS = $(NC4_TESTS) renamegroup
 
@@ -122,7 +122,7 @@ ref_tst_xplatform2_1.nc ref_tst_xplatform2_2.nc ref_tst_dims.nc		\
 ref_tst_interops4.nc run_get_knmi_files.sh CMakeLists.txt               \
 run_grp_rename.sh tst_formatx_hdf4.sh                                   \
 run_chunk_hdf4.sh contiguous.hdf4 chunked.hdf4 \
-tst_h5_endians.c tst_h4_lendian.c
+tst_h5_endians.c tst_h4_lendian.c tst_atts_string_rewrite.c
 
 CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc	\
 bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt			\
@@ -132,7 +132,8 @@ tst_*.nc tst_floats2_*.cdl tst_ints2_*.cdl tst_shorts2_*.cdl		\
 tst_elena_*.cdl tst_simple*.cdl tst_chunks.cdl pr_A1.* tauu_A1.*	\
 usi_01.* thetau_01.* tst_*.nc tst_*.h5                                  \
 tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \
-foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc
+foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
+tst_atts_string_rewrite.nc
 
 if USE_HDF4_FILE_TESTS
 DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf	\
diff --git a/nc_test4/Makefile.in b/nc_test4/Makefile.in
index 8e71d86..f3add0a 100644
--- a/nc_test4/Makefile.in
+++ b/nc_test4/Makefile.in
@@ -195,7 +195,7 @@ am__EXEEXT_1 = tst_dims$(EXEEXT) tst_dims2$(EXEEXT) tst_dims3$(EXEEXT) \
 	tst_files5$(EXEEXT) tst_files6$(EXEEXT) tst_sync$(EXEEXT) \
 	tst_h_strbug$(EXEEXT) tst_h_refs$(EXEEXT) \
 	tst_h_scalar$(EXEEXT) tst_rename$(EXEEXT) \
-	tst_h5_endians$(EXEEXT)
+	tst_h5_endians$(EXEEXT) tst_atts_string_rewrite$(EXEEXT)
 @LARGE_FILE_TESTS_TRUE at am__EXEEXT_2 = tst_large$(EXEEXT) \
 @LARGE_FILE_TESTS_TRUE@	tst_large2$(EXEEXT)
 @BUILD_V2_TRUE at am__EXEEXT_3 = tst_v2$(EXEEXT)
@@ -282,6 +282,9 @@ tst_atts1_LDADD = $(LDADD)
 tst_atts2_SOURCES = tst_atts2.c
 tst_atts2_OBJECTS = tst_atts2.$(OBJEXT)
 tst_atts2_LDADD = $(LDADD)
+tst_atts_string_rewrite_SOURCES = tst_atts_string_rewrite.c
+tst_atts_string_rewrite_OBJECTS = tst_atts_string_rewrite.$(OBJEXT)
+tst_atts_string_rewrite_LDADD = $(LDADD)
 tst_camrun_SOURCES = tst_camrun.c
 tst_camrun_OBJECTS = tst_camrun.$(OBJEXT)
 tst_camrun_LDADD = $(LDADD)
@@ -534,37 +537,38 @@ SOURCES = $(bm_file_SOURCES) $(bm_many_atts_SOURCES) \
 	$(bm_many_objs_SOURCES) $(bm_netcdf4_recs_SOURCES) \
 	cdm_sea_soundings.c renamegroup.c t_type.c $(tst_ar4_SOURCES) \
 	$(tst_ar4_3d_SOURCES) $(tst_ar4_4d_SOURCES) tst_ar5.c \
-	tst_atts.c tst_atts1.c tst_atts2.c tst_camrun.c \
-	tst_chunk_hdf4.c tst_chunks.c tst_chunks2.c tst_chunks3.c \
-	tst_compounds.c tst_compounds2.c tst_compounds3.c \
-	tst_converts.c tst_converts2.c tst_coords.c tst_coords2.c \
-	tst_coords3.c tst_create_files.c tst_dims.c tst_dims2.c \
-	tst_dims3.c tst_endian_fill.c tst_enums.c tst_files.c \
-	$(tst_files2_SOURCES) tst_files3.c tst_files4.c tst_files5.c \
-	tst_files6.c tst_fillbug.c tst_fills.c tst_fills2.c tst_grps.c \
-	tst_grps2.c tst_h4_lendian.c tst_h5_endians.c tst_h_atts2.c \
-	tst_h_files3.c $(tst_h_many_atts_SOURCES) tst_h_refs.c \
-	tst_h_scalar.c tst_h_strbug.c tst_interops.c tst_interops2.c \
-	tst_interops3.c tst_interops4.c tst_interops5.c \
-	tst_interops6.c $(tst_knmi_SOURCES) tst_large.c tst_large2.c \
-	tst_mem.c tst_mpi_parallel.c tst_nc4perf.c tst_opaques.c \
-	tst_parallel.c tst_parallel3.c tst_parallel4.c tst_rename.c \
-	tst_strings.c tst_strings2.c tst_sync.c tst_unlim_vars.c \
-	tst_utf8.c tst_v2.c tst_varms.c tst_vars.c tst_vars2.c \
-	tst_vars3.c tst_vars4.c tst_vl.c tst_xplatform.c \
-	tst_xplatform2.c
+	tst_atts.c tst_atts1.c tst_atts2.c tst_atts_string_rewrite.c \
+	tst_camrun.c tst_chunk_hdf4.c tst_chunks.c tst_chunks2.c \
+	tst_chunks3.c tst_compounds.c tst_compounds2.c \
+	tst_compounds3.c tst_converts.c tst_converts2.c tst_coords.c \
+	tst_coords2.c tst_coords3.c tst_create_files.c tst_dims.c \
+	tst_dims2.c tst_dims3.c tst_endian_fill.c tst_enums.c \
+	tst_files.c $(tst_files2_SOURCES) tst_files3.c tst_files4.c \
+	tst_files5.c tst_files6.c tst_fillbug.c tst_fills.c \
+	tst_fills2.c tst_grps.c tst_grps2.c tst_h4_lendian.c \
+	tst_h5_endians.c tst_h_atts2.c tst_h_files3.c \
+	$(tst_h_many_atts_SOURCES) tst_h_refs.c tst_h_scalar.c \
+	tst_h_strbug.c tst_interops.c tst_interops2.c tst_interops3.c \
+	tst_interops4.c tst_interops5.c tst_interops6.c \
+	$(tst_knmi_SOURCES) tst_large.c tst_large2.c tst_mem.c \
+	tst_mpi_parallel.c tst_nc4perf.c tst_opaques.c tst_parallel.c \
+	tst_parallel3.c tst_parallel4.c tst_rename.c tst_strings.c \
+	tst_strings2.c tst_sync.c tst_unlim_vars.c tst_utf8.c tst_v2.c \
+	tst_varms.c tst_vars.c tst_vars2.c tst_vars3.c tst_vars4.c \
+	tst_vl.c tst_xplatform.c tst_xplatform2.c
 DIST_SOURCES = $(am__bm_file_SOURCES_DIST) \
 	$(am__bm_many_atts_SOURCES_DIST) \
 	$(am__bm_many_objs_SOURCES_DIST) \
 	$(am__bm_netcdf4_recs_SOURCES_DIST) cdm_sea_soundings.c \
 	renamegroup.c t_type.c $(am__tst_ar4_SOURCES_DIST) \
 	$(am__tst_ar4_3d_SOURCES_DIST) $(am__tst_ar4_4d_SOURCES_DIST) \
-	tst_ar5.c tst_atts.c tst_atts1.c tst_atts2.c tst_camrun.c \
-	tst_chunk_hdf4.c tst_chunks.c tst_chunks2.c tst_chunks3.c \
-	tst_compounds.c tst_compounds2.c tst_compounds3.c \
-	tst_converts.c tst_converts2.c tst_coords.c tst_coords2.c \
-	tst_coords3.c tst_create_files.c tst_dims.c tst_dims2.c \
-	tst_dims3.c tst_endian_fill.c tst_enums.c tst_files.c \
+	tst_ar5.c tst_atts.c tst_atts1.c tst_atts2.c \
+	tst_atts_string_rewrite.c tst_camrun.c tst_chunk_hdf4.c \
+	tst_chunks.c tst_chunks2.c tst_chunks3.c tst_compounds.c \
+	tst_compounds2.c tst_compounds3.c tst_converts.c \
+	tst_converts2.c tst_coords.c tst_coords2.c tst_coords3.c \
+	tst_create_files.c tst_dims.c tst_dims2.c tst_dims3.c \
+	tst_endian_fill.c tst_enums.c tst_files.c \
 	$(am__tst_files2_SOURCES_DIST) tst_files3.c tst_files4.c \
 	tst_files5.c tst_files6.c tst_fillbug.c tst_fills.c \
 	tst_fills2.c tst_grps.c tst_grps2.c tst_h4_lendian.c \
@@ -1010,7 +1014,7 @@ tst_chunks tst_chunks2 tst_utf8 tst_fills tst_fills2 tst_fillbug	\
 tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts	\
 t_type cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2		\
 tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs        \
-tst_h_scalar tst_rename tst_h5_endians
+tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite
 
 @BUILD_BENCHMARKS_TRUE at bm_netcdf4_recs_SOURCES = bm_netcdf4_recs.c tst_utils.c
 @BUILD_BENCHMARKS_TRUE at bm_many_atts_SOURCES = bm_many_atts.c tst_utils.c
@@ -1032,7 +1036,7 @@ ref_tst_xplatform2_1.nc ref_tst_xplatform2_2.nc ref_tst_dims.nc		\
 ref_tst_interops4.nc run_get_knmi_files.sh CMakeLists.txt               \
 run_grp_rename.sh tst_formatx_hdf4.sh                                   \
 run_chunk_hdf4.sh contiguous.hdf4 chunked.hdf4 \
-tst_h5_endians.c tst_h4_lendian.c
+tst_h5_endians.c tst_h4_lendian.c tst_atts_string_rewrite.c
 
 CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc	\
 bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt			\
@@ -1042,7 +1046,8 @@ tst_*.nc tst_floats2_*.cdl tst_ints2_*.cdl tst_shorts2_*.cdl		\
 tst_elena_*.cdl tst_simple*.cdl tst_chunks.cdl pr_A1.* tauu_A1.*	\
 usi_01.* thetau_01.* tst_*.nc tst_*.h5                                  \
 tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \
-foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc
+foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
+tst_atts_string_rewrite.nc
 
 @USE_HDF4_FILE_TESTS_TRUE at DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf	\
 @USE_HDF4_FILE_TESTS_TRUE at AMSR_E_L3_DailyLand_V06_20020619.hdf			\
@@ -1150,6 +1155,10 @@ tst_atts2$(EXEEXT): $(tst_atts2_OBJECTS) $(tst_atts2_DEPENDENCIES) $(EXTRA_tst_a
 	@rm -f tst_atts2$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_atts2_OBJECTS) $(tst_atts2_LDADD) $(LIBS)
 
+tst_atts_string_rewrite$(EXEEXT): $(tst_atts_string_rewrite_OBJECTS) $(tst_atts_string_rewrite_DEPENDENCIES) $(EXTRA_tst_atts_string_rewrite_DEPENDENCIES) 
+	@rm -f tst_atts_string_rewrite$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(tst_atts_string_rewrite_OBJECTS) $(tst_atts_string_rewrite_LDADD) $(LIBS)
+
 tst_camrun$(EXEEXT): $(tst_camrun_OBJECTS) $(tst_camrun_DEPENDENCIES) $(EXTRA_tst_camrun_DEPENDENCIES) 
 	@rm -f tst_camrun$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(tst_camrun_OBJECTS) $(tst_camrun_LDADD) $(LIBS)
@@ -1446,6 +1455,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts1.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_atts_string_rewrite.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_camrun.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunk_hdf4.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tst_chunks.Po at am__quote@
@@ -2118,6 +2128,13 @@ tst_h5_endians.log: tst_h5_endians$(EXEEXT)
 	--log-file $$b.log --trs-file $$b.trs \
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
+tst_atts_string_rewrite.log: tst_atts_string_rewrite$(EXEEXT)
+	@p='tst_atts_string_rewrite$(EXEEXT)'; \
+	b='tst_atts_string_rewrite'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
 run_grp_rename.sh.log: run_grp_rename.sh
 	@p='run_grp_rename.sh'; \
 	b='run_grp_rename.sh'; \
diff --git a/nc_test4/tst_atts_string_rewrite.c b/nc_test4/tst_atts_string_rewrite.c
new file mode 100644
index 0000000..ebabf74
--- /dev/null
+++ b/nc_test4/tst_atts_string_rewrite.c
@@ -0,0 +1,47 @@
+/* This is part of the netCDF package.
+   Copyright 2006 University Corporation for Atmospheric Research/Unidata.
+   See COPYRIGHT file for conditions of use.
+
+   This test was provided by Jeff Whitaker as an example of a bug,
+   specifically a segfault when re-writing an NC_CHAR attribute as
+   an NC_STRING attribute.
+
+   See https://github.com/Unidata/netcdf-c/issues/149
+
+   $Id$
+*/
+
+#include <netcdf.h>
+#include <config.h>
+#include <nc_tests.h>
+#include <string.h>
+
+#define FILE_NAME "tst_atts_string_rewrite.nc"
+
+int main() {
+   int dataset_id;
+   const char *attstring[1] = {"bar"};
+   int res = 0;
+   printf("\n*** Testing overwriting text attribute with string attribute.\n");
+   printf("\n***Creating file...");
+
+   res = nc_create(FILE_NAME, NC_NETCDF4, &dataset_id); if(res) ERR;
+   printf("Success\n");
+
+   printf("Creating global attribute with nc_put_att_text...");
+   res = nc_put_att_text(dataset_id, NC_GLOBAL, "foo", 3, "bar");
+   printf("Succes\n");
+
+   printf("Overwriting global attribute with nc_put_att_string...");
+   res = nc_put_att_string(dataset_id, NC_GLOBAL, "foo", 1, attstring);
+   printf("Success\n");
+
+   printf("Closing file...");
+   res = nc_close(dataset_id);
+   printf("Success\n");
+
+   printf("Test Finished.\n");
+   SUMMARIZE_ERR;
+   FINAL_RESULTS;
+
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/netcdf.git



More information about the Pkg-grass-devel mailing list