Commit Graph

590 Commits

Author SHA1 Message Date
Ed Hartnett
da928c1b83 merged 780 2018-01-20 06:05:34 -07:00
Ed Hartnett
cc4eb3cd96 more test development 2018-01-19 05:41:05 -07:00
Ed Hartnett
ea3874c567 more test development 2018-01-19 05:40:48 -07:00
Ed Hartnett
196a0b574a more test development 2018-01-19 05:11:07 -07:00
Ed Hartnett
4be1fd82e6 further test development 2018-01-19 04:16:59 -07:00
Ed Hartnett
bc1f103c3d cleaned up h5 checks in nc4grp.c 2018-01-19 03:37:49 -07:00
Ed Hartnett
3f83998b26
Merge branch 'master' into ejh_rename2 2018-01-18 16:05:04 -07:00
Ward Fisher
0f5fc7222b
Merge branch 'master' into plugins.dmh 2018-01-18 15:46:50 -07:00
Ed Hartnett
d350f82889 removed unneeded h5 checks 2018-01-18 07:46:31 -07:00
Ed Hartnett
126d34da1d more tests, error handling 2018-01-18 07:36:52 -07:00
Ed Hartnett
38c7cddf8f further test development, added documentation for uncommitted user-defined types, fixed check of return value 2018-01-18 06:47:50 -07:00
Ed Hartnett
9949a11155 removed some unneeded HDF4 checks, added some needed parameter checks 2018-01-17 09:09:58 -07:00
Ed Hartnett
09ee32b205 fixed some header files, checked some return values 2018-01-17 08:25:15 -07:00
Dennis Heimbigner
99fccab359 1. Keep up to date by merging master
2. Fixed plugin building (nc_test4/hdf5plugins)
   to be done properly by cmake and automake.
4. Duplicated part of the nc_test4 filter test code
   in examples/C

An incomplete and untested set of hooks exist
for OS-X in nc_test4/findplugins.in. They need testing.
2018-01-16 11:00:09 -07:00
Ed Hartnett
3fa3d3f9f9 ported rename fix changes from branch ejh_fill_values for easy merging 2018-01-05 06:01:22 -07:00
Levi Naden
f6fc9c183b Allow multiple vars with different chunks on the same unlimited dim
Fix #299
The conditions to make this error are the following:
* Two variables with different chunk sizes
* Both variables write on the same unlimited dimension
* The first variable has already written data when the second variable is created
2018-01-02 11:37:01 -05:00
Ward Fisher
a1fc9fff41
Merge branch 'master' into nc3-per-var-fill-v2 2017-12-22 16:22:12 -07:00
Wei-keng Liao
0f4a85b9f2 a clean commit for #383 2017-12-20 20:53:30 -06:00
Ray Donnelly
879d071b0c Fix buffer overrun in tabs[MAX_NESTS] by adding space for \0 terminator
.. also speed it up by not using strcat when direct array access works just fine.
2017-12-20 21:38:34 +00:00
Ed Hartnett
4de61e21f2 more docs, more cleaning 2017-12-04 12:21:14 -07:00
Ed Hartnett
fec74e18ef more internal documentation 2017-12-04 07:07:45 -07:00
Ed Hartnett
11e3e81489 more internal docs 2017-12-03 15:37:56 -07:00
Ed Hartnett
097a09fc79 more internal docs 2017-12-03 07:57:21 -07:00
Ed Hartnett
3514ae9d08 more internal docs 2017-12-03 07:11:51 -07:00
Ed Hartnett
bf6dab14e0 fixed error value from nc4_find_g_var_nc() when ncid is bad 2017-12-03 04:06:56 -07:00
Ed Hartnett
9e4c564656 more tests 2017-12-02 18:00:22 -07:00
Ed Hartnett
8055c1cede more tests 2017-12-02 17:43:46 -07:00
Ed Hartnett
1cf8177f45 more test 2017-12-02 15:43:40 -07:00
Ed Hartnett
ea63ff526f more tests 2017-12-02 08:05:17 -07:00
Ed Hartnett
bfeb8d4e0b more testing 2017-12-02 07:38:01 -07:00
Ed Hartnett
7cd344f7b0 removed redundant check in NC4_def_var() 2017-12-02 07:23:23 -07:00
Ed Hartnett
6c3aa79684 more testing of nc_set_var_chunk_cache_ints 2017-12-02 07:15:19 -07:00
Ed Hartnett
acbd3e259e more tests 2017-12-01 13:58:13 -07:00
Ed Hartnett
a8e9c196e2 more tests, fixed documentation warnings 2017-12-01 13:02:59 -07:00
Ed Hartnett
42c482d33c more tests 2017-12-01 11:20:09 -07:00
Ed Hartnett
3e45557157 more docs, more tests, eliminated two unneeded functions 2017-12-01 10:02:40 -07:00
Ed Hartnett
2023ed6b7c fixed problems with bad inputs to nc_def_Var 2017-12-01 09:08:12 -07:00
Ed Hartnett
5d11415b83 adding internal documentation 2017-12-01 08:18:49 -07:00
Ed Hartnett
8e47b9bbc2 merged ejh_more_warnings 2017-11-24 10:14:57 -07:00
Ed Hartnett
845355e91b added hdf4 test for inq_format calls 2017-11-22 08:21:24 -07:00
Ed Hartnett
d4495e8e86 more testing 2017-11-22 07:46:03 -07:00
Ed Hartnett
7e662c6b87 fixed easy warnings 2017-11-20 05:55:04 -07:00
Ed Hartnett
3b82328902
Merge branch 'master' into ejh_more_warnings 2017-11-15 03:41:12 -07:00
Ed Hartnett
013151edc6 fixed leak relating to var->params 2017-11-14 09:15:13 -07:00
Ward Fisher
16d6f94f30 Merge branch 'master' into filters.dmh 2017-11-13 11:15:02 -07:00
Ed Hartnett
6d31b47543
Merge branch 'master' into ejh_more_warnings 2017-11-10 02:52:46 -07:00
Ward Fisher
a9dde277d7 Merge branch 'ejh_enum_mem_fix' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into more_ejh_pulls 2017-11-09 16:11:17 -07:00
Ed Hartnett
0e0482bc05 fixed warnings 2017-11-09 06:24:18 -07:00
Ed Hartnett
b9911d6e6f took out most uses of EXTRA_TESTS, returned it to disabled by default 2017-11-08 13:25:23 -07:00
Ed Hartnett
a72d5b4d16
Merge branch 'master' into ejh_enum_mem_fix 2017-11-07 18:34:55 -07:00
Ed Hartnett
ef05ba642f
Merge branch 'master' into ejh_remove_counts 2017-11-05 10:08:36 -07:00
Ed Hartnett
7872785cf0
Merge branch 'master' into ejh_enum_mem_fix 2017-11-03 19:44:40 -06:00
Ward Fisher
f98635be1b Merge remote-tracking branch 'origin/h5offset.dmh' into dmh_multi_merge 2017-11-03 12:40:52 -06:00
Ed Hartnett
0ac8ec40a1 removed archaic code to check memory use 2017-11-02 11:40:13 -06:00
Ed Hartnett
406e979fb4 fixed tst_enums memory issue 2017-11-01 04:31:12 -06:00
Ward Fisher
d7f0919c12
Merge branch 'master' into NC_MAX_VAR_DIMS 2017-10-31 14:06:41 -06:00
Dennis Heimbigner
2d77e6451b Master merge 2017-10-28 14:06:39 -06:00
Dennis Heimbigner
261ed4c99d Merge branch 'master' into h5offset.dmh 2017-10-27 12:33:17 -06:00
Ed Hartnett
c36554ffb8 fixed memory error in handling of (ignored) reference atts in HDF5 file 2017-10-27 06:08:22 -06:00
Ward Fisher
bacdef88fe Merge branch 'master' into NC_MAX_VAR_DIMS 2017-10-26 14:31:22 -06:00
Ward Fisher
b066a2ac76 Merge branch 'ejh_fix_nc4info_warnings' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into merge_small_pulls 2017-10-25 11:03:35 -06:00
Ed Hartnett
785e0c3a9a fixed warning in nc4var.c 2017-10-25 04:55:56 -06:00
Ed Hartnett
19e248c63e fixed compile warnings in nc4info.c 2017-10-25 04:48:03 -06:00
Ed Hartnett
26f443b7ac fixed warnings in libsrc4/nc4hdf.c 2017-10-25 04:28:24 -06:00
Dennis Heimbigner
9983b9d911 re e-support UBS-599337
re pull request https://github.com/Unidata/netcdf-c/pull/405
re pull request https://github.com/Unidata/netcdf-c/pull/446

Notes:
1. This branch is a cleanup of the magic.dmh branch.
2. magic.dmh was originally merged, but caused problems with parallel IO.
   It was re-issued as pull request https://github.com/Unidata/netcdf-c/pull/446.
3. This branch + pull request replace any previous pull requests and magic.dmh branch.

Given an otherwise valid netCDF file that has a corrupted header,
the netcdf library currently crashes. Instead, it should return
NC_ENOTNC.

Additionally, the NC_check_file_type code does not do the
forward search required by hdf5 files. It currently only looks
at file position 0 instead of 512, 1024, 2048,... Also, it turns
out that the HDF4 magic number is assumed to always be at the
beginning of the file (unlike HDF5).
The change is localized to libdispatch/dfile.c See
https://support.hdfgroup.org/release4/doc/DSpec_html/DS.pdf

Also, it turns out that the code in NC_check_file_type is duplicated
(mostly) in the function libsrc4/nc4file.c#nc_check_for_hdf.

This branch does the following.
1. Make NC_check_file_type return NC_ENOTNC instead of crashing.
2. Remove nc_check_for_hdf and centralize all file format checking
   NC_check_file_type.
3. Add proper forward search for HDF5 files (but not HDF4 files)
   to look for the magic number at offsets of 0, 512, 1024...
4. Add test tst_hdf5_offset.sh. This tests that hdf5 files with
   an offset are properly recognized. It does so by prefixing
   a legal file with some number of zero bytes: 512, 1024, etc.
5. Off-topic: Added -N flag to ncdump to force a specific output dataset name.
2017-10-24 16:25:09 -06:00
Dennis Heimbigner
5ff3909704 Fix bug in nc4file.c where it improperly handled filters with more than 4 parameters. 2017-10-09 21:24:56 -06:00
Wei-keng Liao
2cc30c16be check against NC_MAX_VAR_DIMS (but using NC_EMAXDIMS, maybe a new error code NC_EMAXVARDIMS is needed) 2017-09-21 12:37:33 -05:00
Dennis Heimbigner
ed44fd7306 Add szip support via libaec 2017-08-27 13:35:20 -06:00
Dennis Heimbigner
7e8bd784cc Merge branch 'master' into filters.dmh 2017-08-17 14:29:34 -06:00
Dennis Heimbigner
86fc8745dc merge master and resolve conflicts 2017-08-12 15:50:31 -06:00
Ward Fisher
24ca95645c Applied fix for a stack buffer overflow into 4.5.0 release branch. 2017-08-08 13:18:53 -06:00
Ward Fisher
f6ac978f25 Merge branch 'master' into fix_nc4_check_name_buffer_overflow 2017-08-08 11:22:06 -06:00
Ward Fisher
05d3d7e9f5 Merge remote-tracking branch 'origin/d4tempfile.dmh' into v4.5.0-release-branch 2017-08-07 10:12:36 -06:00
Dennis Heimbigner
4d8fbbf501 If DAP (2 or 4) is enabled, but diskless is disabled, then the
dap code will create a real temporary file in which to store the
converted metadata for the DAP .dds or .dmr.

It was assumed that the nc_close code would reclaim the
temporary file. For DAP2, reclamation occurs in the ncio
code. For DAP4, it was assumed that the libsrc4 code would do
the reclamation, but for whatever reason, this is not happening.
Thus, in this situation, a temporary file is left in the file
system. Aside from being irritating to users, this screws up
'make distcheck'.

So the DAP4 code is fixed to ensure that the temporary file is
properly reclaimed independent of the libsrc4 code.
2017-08-05 22:41:31 -06:00
Even Rouault
1989ddc252 Fix stack buffer overflow in nc4_check_name()
nc4_check_name() checks that the provided string doesn't exceed NC_MAX_NAME,
but fails to do so after calling nc_utf8_normalize(). This extra check is
needed since a caller of nc4_check_name(), like NC4_def_dim, allocates
norm_name as char norm_name[NC_MAX_NAME + 1]

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2840
Credit to OSS-Fuzz
2017-08-02 21:57:36 +02:00
Dennis Heimbigner
715a6fe5eb The files libdispatch/dwinpath.c and include/ncwinpath.h
were added to provide a path name converter from e.g. cygwin
paths to e.g. windows paths. This is necessary because
the shell scripts may produce cygwin paths, but the code
may have been compiled with Visual Studio. Similar issues
arise with Mingw.

At appropriate places, and if using Visual Studio or Mingw,
I added calls to the path conversion code.
Apparently I forgot to find all the places where this
conversion was needed. So this pr does the following:
1. Push the calls to the converter to the various libXXX
   directories and out of libdispatch/dfile.c.
2. Add conversion calls to other parts of the code like oc2.

I also turns out that conversion code in dapcvt.c
had a bug when handling DAP Byte type under visual studio.

Notes:
1. there may still be places I missed that need to do path conversion.
2. need to make sure that calls to e.g. H5open also use converted path.
2017-07-13 10:40:07 -06:00
Ward Fisher
8a4f5aea95 Corrected a double-free reported by static analysis. 2017-06-15 12:09:54 -06:00
Even Rouault
d02e3c952b Fix memory leak in NC4_put_propattr()
Current code only frees char* text in error cases. It should
also free it in success case.

Otherwise Valgrind reports a leak:

==28536== 64 bytes in 1 blocks are definitely lost in loss record 4 of 13
==28536==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28536==    by 0xE673496: NC4_buildpropinfo (nc4info.c:239)
==28536==    by 0xE67313B: NC4_put_propattr (nc4info.c:162)
==28536==    by 0xE65BF35: nc4_create_file (nc4file.c:468)
==28536==    by 0xE65C0AC: NC4_create (nc4file.c:564)
==28536==    by 0xE608A08: NC_create (dfile.c:1773)
==28536==    by 0xE607E6A: nc__create (dfile.c:511)
==28536==    by 0xE607E23: nc_create (dfile.c:440)

Credit to OSS Fuzz
2017-06-07 10:48:38 +02:00
Dennis Heimbigner
c834d4af12 merge from master 2017-05-10 12:33:03 -06:00
Dennis Heimbigner
7c3164577e Finalize the compression support.
This relies on the HDF5 capability to
dynamically load compression filters.
Note that a compression filter is just
a subcase of filters.

The primary user-visible changes are as follows:
1. Add a standard header "netcdf_filter.h" that defines
   the necessary API extensions
2. Modify ncgen to support two new special attributes
   "_Filter_ID" and "_Filter_Parameters" so that compression
   can be turned on when creating a file using ncgen.
4. Add a detailed description of filtering support
   to the user's guide; see the file filters.md
5. Add a test case directory for this: nc_test4/filter_test.
   It is fragile and a ./configure flags (-enable-filter-test)
   is defined (default disabled) to shut this off this test
   to avoid spurious 'make check' failures.

Note that the HDF5 documentation is not up-to-date, so
much of what is encoded here comes from examining the
actual code in the file H5PL.c in the HDF5 source code.
2017-04-27 13:01:59 -06:00
Ward Fisher
8dddd222a3 Merged master, DAP4 support into branch. 2017-04-19 09:29:35 -06:00
Dennis Heimbigner
32fe709615 ckp 2017-04-14 11:05:30 -06:00
Ward Fisher
b5b99cbebb Merge branch 'master' into ghpull-375 2017-04-05 16:24:55 -06:00
Dennis Heimbigner
5f15c9e777 1) master merge 2)fix uname -o problem 2017-03-30 16:21:31 -06:00
Greg Sjaardema
97c27b1582 Merge branch 'master' into patch-1 2017-03-29 20:19:37 -06:00
Wei-keng Liao
1508bd5529 fix the previous commit that missed the case of re-open file 2017-03-29 12:16:25 -05:00
Dennis Heimbigner
80390b94e5 keep up-to-date with master 2017-03-27 12:16:24 -06:00
Wei-keng Liao
73ccb364a9 To solve NC_ELATEFILL error for NetCDF-4 files, mark all variables written at enddef. 2017-03-24 20:55:00 -05:00
Ward Fisher
eeb673bf8c Merge branch 'master' into ghpull-375 2017-03-22 11:24:56 -06:00
Greg Sjaardema
26c393cd13 Merge branch 'master' into patch-1 2017-03-15 08:50:12 -06:00
Stephan Hoyer
4dd8e380c1 Switch NC_CHAR on netCDF4 to use ASCII
Fixes GH298
2017-03-13 20:12:08 -07:00
Ward Fisher
d4a4dfdd15 Resolved a conflict. 2017-03-13 14:23:57 -06:00
Ward Fisher
8e3790f7ce Merged master. 2017-03-09 12:53:28 -07:00
Dennis Heimbigner
3db4f013bf Primary change: add dap4 support
Specific changes:
1. Add dap4 code: libdap4 and dap4_test.
   Note that until the d4ts server problem is solved, dap4 is turned off.
2. Modify various files to support dap4 flags:
	configure.ac, Makefile.am, CMakeLists.txt, etc.
3. Add nc_test/test_common.sh. This centralizes
   the handling of the locations of various
   things in the build tree: e.g. where is
   ncgen.exe located. See nc_test/test_common.sh
   for details.
4. Modify .sh files to use test_common.sh
5. Obsolete separate oc2 by moving it to be part of
   netcdf-c. This means replacing code with netcdf-c
   equivalents.
5. Add --with-testserver to configure.ac to allow
   override of the servers to be used for --enable-dap-remote-tests.
6. There were multiple versions of nctypealignment code. Try to
   centralize in libdispatch/doffset.c and include/ncoffsets.h
7. Add a unit test for the ncuri code because of its complexity.
8. Move the findserver code out of libdispatch and into
   a separate, self contained program in ncdap_test and dap4_test.
9. Move the dispatch header files (nc{3,4}dispatch.h) to
   .../include because they are now shared by modules.
10. Revamp the handling of TOPSRCDIR and TOPBUILDDIR for shell scripts.
11. Make use of MREMAP if available
12. Misc. minor changes e.g.
	- #include <config.h> -> #include "config.h"
	- Add some no-install headers to /include
	- extern -> EXTERNL and vice versa as needed
	- misc header cleanup
	- clean up checking for misc. unix vs microsoft functions
13. Change copyright decls in some files to point to LICENSE file.
14. Add notes to RELEASENOTES.md
2017-03-08 17:01:10 -07:00
Ward Fisher
2558fd6f9f Merge branch 'att_callbk' of https://github.com/brtnfld/netcdf-c into gh276 2017-03-06 12:56:33 -07:00
Greg Sjaardema
cbb9448ab0 Remove unused fields from struct
The nvars, ndims, and natts fields on the NC_HDF5_FILE_INFO struct are
never set.  The nvars field is read, but since it is never written,
the value is always zero.
2017-03-06 11:14:00 -07:00
Greg Sjaardema
473529d199 Remove unused ndims from grp struct 2017-03-06 11:14:00 -07:00
Dennis Heimbigner
47daf33074 Resolves Github issue https://github.com/Unidata/netcdf-c/issues/349.
Update utf8proc.[ch] to use the version now
maintained by the Julia Language project
(https://github.com/JuliaLang/utf8proc/blob/master/LICENSE.md).
The license for the previous version was
unacceptable for the Debian and Ubuntu release
systems. The new version both updates the code
and addresses the license issue.

It turns out that the utf8proc software we are using
was turned over to the Julia Language developers
and the license terms changed to allow modification.
(https://github.com/JuliaLang/utf8proc/blob/master/LICENSE.md).

So the fix here is as follows:
1. Wrap the library with a fixed interface: libdispatch/dutf8.c
   and include/ncutf8.h.
2. Replace the existing utf8proc code with the new version
   from https://github.com/JuliaLang/utf8proc.
3. Add a couple more test cases: nc_test/tst_utf8_validate.c
   and nc_test_utf8_phrases.c.  If/when I can find a usable
   normalization test, I will incorporate that later.
2017-02-16 14:27:54 -07:00
Ward Fisher
7edb08977a Added platform checks for ARM. 2017-02-03 11:19:39 -07:00
Ward Fisher
3e5124996e Merged https://github.com/Unidata/netcdf-c/pull/319 to resolve some recently arisen conflicts, in preparation for larger merge. 2017-02-01 13:27:29 -07:00
Ward Fisher
0d2727d9da Merging pull request from gsjaardema, see https://github.com/Unidata/netcdf-c/pull/335 for more information. 2017-01-30 12:45:50 -07:00
Greg Sjaardema
b334171548 Merge branch 'master' into patch-1 2017-01-11 21:18:03 -07:00
Ward Fisher
34161aab69 Added fixes for Visual Studio 10 2017-01-10 13:54:09 -07:00
Greg Sjaardema
a2fdfa04ab Eliminate an MPI_Allreduce in many cases 2016-12-09 09:52:15 -07:00
Greg Sjaardema
f8e818385e Modify previous no_fill setting
HDF5 does not permit a variable to have no_fill == TRUE if the variable type is variable length.  This includes types NC_STRING and NC_VLEN.  

The test above also excludes user-defined types which I'm not sure is needed or not.
2016-12-05 11:08:26 -07:00
Greg Sjaardema
8401e2087e Set variable no_fill to match database default (nc4)
In nc4 mode, the variables were ignoring the default "database" fill/no_fill mode set via a call to nc_set_fill().  This sets the no_fill mode on the variable to match the default database setting at the time the variable is defined.
2016-12-02 08:17:47 -07:00
Greg Sjaardema
72c1948980 Move metadata ops calls 2016-12-01 13:35:16 -07:00
Greg Sjaardema
e0269d6cac Add hdf5 collective metadata api detection to cmake build 2016-12-01 13:35:10 -07:00
Greg Sjaardema
39c90e7b76 Enable collective metadata operations for hdf5-1.10; not protected yet 2016-12-01 13:34:58 -07:00
Wei-keng Liao
fe9685deb4 implement an error code precedence 2016-12-01 12:31:20 -06:00
Wei-keng Liao
4cdbf7dba5 Merge branch 'master' into issue258 2016-12-01 01:09:45 -06:00
Ward Fisher
767a5b372c Corrected an issue reported as part of the pull request at https://github.com/Unidata/netcdfic/pull/328 2016-11-28 13:31:43 -07:00
Ward Fisher
05ceb8d471 Merge branch 'nc4-var-array' of https://github.com/gsjaardema/netcdf-c into gh328 2016-11-28 13:10:07 -07:00
Wei-keng Liao
ab73a57fca Merge branch 'master' into issue258 2016-11-25 10:49:03 -06:00
Ward Fisher
24a4a230e6 Updated debugging script, fixed a problem in logging type size. 2016-11-16 12:18:20 -07:00
Greg Sjaardema
b9c50aec89 Create var correctly for hdf4 files 2016-11-16 10:37:37 -07:00
Greg Sjaardema
a55d96eba1 Clean-up build after changes -- remove unused variables 2016-11-16 08:45:28 -07:00
Greg Sjaardema
207a2ee4f9 Fix stdc violation 2016-11-16 08:45:23 -07:00
Greg Sjaardema
d16f5a8842 Whitespace cleanup 2016-11-16 08:45:19 -07:00
Greg Sjaardema
8698e57424 Compile with c89 -- eliminate init in for-loop 2016-11-16 08:45:15 -07:00
Greg Sjaardema
c84b475ccf Remove var linked list 2016-11-16 08:45:10 -07:00
Greg Sjaardema
dee1baca8e Store vars in array instead of linked list (linked list still active) 2016-11-16 08:45:06 -07:00
Wei-keng Liao
e8cfdbb25a Merge branch 'master' into issue258 2016-11-13 00:00:54 -06:00
Wei-keng Liao
2081ae7099 add configure option --enable-relax-coord-bound for issue #243 2016-11-12 23:58:09 -06:00
Ward Fisher
f4ac2f827d Merge branch 'patch-4' of https://github.com/gsjaardema/netcdf-c into gh290 2016-11-09 12:27:48 -07:00
Wei-keng Liao
4725c1484b move varid check right after ncid 2016-10-12 13:33:17 -05:00
Wei-keng Liao
dbb9be59d2 temporally disable __arm__ for testing 2016-10-09 22:21:32 -05:00
Ward Fisher
49fb3241c6 Corrected coverity issue 1372965. 2016-09-15 11:07:11 -06:00
Greg Sjaardema
dab30468f9 Merge branch 'master' into patch-4 2016-09-15 11:04:30 -06:00
Ward Fisher
a08be0a312 Corrected issue 1372910 in coverity. 2016-09-14 16:26:08 -06:00
Ward Fisher
934bb4bd66 Corrected typo. 2016-09-14 16:20:43 -06:00
Ward Fisher
ad1220453a Corrected issue 1372911 in Coverity. 2016-09-14 16:16:06 -06:00
Ward Fisher
485faa0333 Addressed defect 1372912 in coverity. 2016-09-14 16:11:22 -06:00
Dennis Heimbigner
ddfb6d6279 Make sure that the _NcProperties attr is null terminated and stored as such 2016-08-08 21:54:23 -06:00
Dennis Heimbigner
0cf1e2c49f re: Github issue netcdf-c 300
Modified provenance code to allocate the minimal space
needed for _NCProperties attribute in file.  Basically
required using malloc in the provenance code and in ncdump.
Otherwise should cause no externally visible effects.
Also removed the ENABLE_FILEINFO from configure.ac since
the provenance code is no longer optional.
2016-08-08 09:24:19 -06:00
Greg Sjaardema
c7ccdfa543 More pedantically correct check
This modifies the previous change to be more pedantically correct.  It should always be an NC_EINVALCOORDS error if start exceeds fdims[2]; however, if start equals fdims[2], then it is only an error if count is non-zero.
2016-07-21 09:30:18 -06:00
Greg Sjaardema
9290b31c9d Fix variable bounds check for parallel output
The following code is in nc4hdf.c, function `nc4_put_vara`.

```
  /* Check dimension bounds. Remember that unlimited dimnsions can
   * put data beyond their current length. */
  for (d2 = 0; d2 < var->ndims; d2++)
    {
      dim = var->dim[d2];
      assert(dim && dim->dimid == var->dimids[d2]);
      if (!dim->unlimited)
        {
          if (start[d2] >= (hssize_t)fdims[d2])
            BAIL_QUIET(NC_EINVALCOORDS);
          if (start[d2] + count[d2] > fdims[d2])
            BAIL_QUIET(NC_EEDGE);
        }
    }
```

There is an issue when the process with the highest rank has zero items to output.  As an example, if I have 4 mpi processes which are each writing the following amount of data:
 * rank 0: 0 items
 * rank 1: 2548 items
 * rank 2: 4352 items
 * rank 3: 0 items.

I will define the variable to have a length of 6900 items (0 + 2548 + 4352 + 0).  When I am outputting data to the variable, each rank will call nc_put_vara_longlong with the following start and count values:
 * rank 0: start = 0, count = 0
 * rank 1: start = 0, count = 2548
 * rank 2: start = 2548, count = 4352
 * rank 3: start = 6900, count = 0.

In each case, the `start` for rank N is equal to `start` for rank N-1 + `count` for rank N-1.  This all works ok until the highest rank is writing 0 items.  In that case, the `start` value for that rank is equal to the total size of the variable and the check in the code fragment shown above fails since `start[] == fdims[]`.

This could be fixed in the application code by checking whether the `count` is zero and if so, then set `start` to 0 also, but I think that is a kluge that should not be required.

Note that this test appears three times in this file.  In one case, the check for non-zero count already exists, but not in the other two.  This pull request adds the check to the other two tests.
2016-07-21 09:30:18 -06:00
Ward Fisher
c1ec950d70 Merge branch 'extent-llu' of https://github.com/brtnfld/netcdf-c into consolidate-gh 2016-07-15 14:42:49 -06:00
Ward Fisher
d419b53925 Merge branch 'patch-1' of https://github.com/gsjaardema/netcdf-c into consolidate-gh 2016-07-15 14:40:32 -06:00
Greg Sjaardema
382ff98e6c Use an hdf5-api function that eliminates code
The H5Aexists hdf5 function does the same function as the manually coded loop with much less code and fewer function calls.

Also, the H5Aopen_idx and H5Aget_num_attrs functions are deprecated.
2016-07-13 09:30:54 -04:00
Greg Sjaardema
fcb1455b28 Update nc4hdf.c
If H5Aopen_idx on line 1964 fails, then attid will be < 0.  The BAIL will goto exit at line 1989 and then the test of "if (attid ...)" at line 1995 will pass (attd != 0) and then call H5Aclose(attid) with a negative attid.    Similar issue for spaceid.  

Result of function if probably the same since there is a failure somewhere, but more difficult to track down if looks like failure is happening in the wrong place.
2016-07-12 08:59:01 -04:00
Greg Sjaardema
c361938c8e Fix att_name size
There was a mismatch between the allocated size of att_name and the size that H5Aget_name was told the size was.
2016-07-12 08:12:23 -04:00
Scot Breitenfeld
55bf63d35c Merge branch 'master' into extent-llu 2016-06-21 13:07:20 -05:00
M. Scot Breitenfeld
2bf233c9d5 This patch changes the algorithm for determining the extended size of a dataset in parallel to pass a variable of type unsigned long long to MPI_Allreduce. Despite the comment in the code on this line (removed in this patch), the current usage is not correct. For example, consider if process 0 has an extend size of 2^32 (0x100000000) and process 2 has an extend size of 1 (0x1). The current algorithm will compute the max of each 4 byte segment then combine these into an 8 byte number, yielding a max of (2^32)+1 (0x100000001), when it should simply be 2^32.
N. Fortner
2016-06-21 13:04:15 -05:00
Ward Fisher
3e24dcd575 Removed some dead assignments reported by clang. 2016-06-20 15:28:46 -06:00
Scot Breitenfeld
b2dc48d7b3 Merge branch 'master' into att_callbk 2016-06-15 08:36:41 -05:00
Ward Fisher
46c63344f7 Added comments where needed. 2016-06-14 10:47:24 -06:00
Ward Fisher
a499bf1ed8 Extending when attributes are copied. 2016-06-14 10:29:14 -06:00
Ward Fisher
13b088f49f Moved fix out to a separate function so that we can hopefully address a few other NCO-reported issues. 2016-06-14 10:22:06 -06:00
M. Scot Breitenfeld
4f43988e84 Changed from discovering attributes and then looping through them to using H5Aiterate2 instead. 2016-06-14 09:33:52 -05:00