Commit Graph

90 Commits

Author SHA1 Message Date
Ed Hartnett
6f4b4ac80d moving attribute HDF5 stuff to libhdf5 2018-11-07 14:21:57 -07:00
Ed Hartnett
5f36a3b425 merged master 2018-11-02 10:00:53 -06:00
Dennis Heimbigner
245961de00 re: github issues
https://github.com/Unidata/netcdf-c/issues/1168
    https://github.com/Unidata/netcdf-c/issues/1163
    https://github.com/Unidata/netcdf-c/issues/1162

This PR partially fixes memory leaks in the netcdf-c library,
in the ncdump utility, and in some test cases.

The netcdf-c library now runs memory clean with the assumption
that the --disable-utilities option is used. The primary remaining
problem is ncgen. Once that is fixed, I believe the netcdf-c library
will run memory clean with no limitations.

Notes
-----------
1. Memory checking was performed using gcc -fsanitize=address.
   Valgrind-based testing has yet to be performed.
2. The pnetcdf, hdf4, and examples code has not been tested.

Misc. Non-leak changes
1. Make tst_diskless2 only run when netcdf4 is enabled (issue 1162)
2. Fix CmakeLists.txt to turn off logging if ENABLE_NETCDF_4 is OFF
3. Isolated all my debug scripts into a single top-level directory
   called debug
4. Fix some USE_NETCDF4 dependencies in nc_test and nc_test4 Makefile.am
2018-10-30 20:48:12 -06:00
Ed Hartnett
452f75fadd commented out some tests 2018-10-22 15:04:44 -06:00
Ed Hartnett
958826d0af merged ejh_mem_check 2018-10-22 13:29:46 -06:00
Dennis Heimbigner
e40eb2e950 switch 2018-10-19 11:11:36 -06:00
Ed Hartnett
695e295734 now calling recursive function to close HDF5 objects in file 2018-10-18 03:29:21 -06:00
Ed Hartnett
fa86d3c488 continuing to separate hdf5/libsrc4 file close code 2018-10-18 03:20:39 -06:00
Ed Hartnett
c90ab24b48 moving towards separating HDF5 file close from netcdf4 file close 2018-10-18 03:17:38 -06:00
Dennis Heimbigner
979873f81d Fix provenance memory leak 2018-10-17 11:43:14 -06:00
Dennis Heimbigner
4636584d5b Revert/Improve nc_create + NC_DISKLESS behavior
re: https://github.com/Unidata/netcdf-c/issues/1154

Inadvertently, the behavior of NC_DISKLESS with nc_create() was
changed in release 4.6.1. Previously, the NC_WRITE flag needed
to be explicitly used with NC_DISKLESS in order to cause the
created file to be persisted to disk.

Additional analyis indicated that the current NC_DISKLESS
implementation was seriously flawed.

This PR attempts to clean up and regularize the situation with
respect to NC_DISKLESS control. One important aspect of diskless
operation is that there are two different notions of write.

1. The file is read-write vs read-only when using the netcdf API.
2. The file is persisted or not to disk at nc_close().

Previously, these two were conflated. The rules now are
as follows.

1. NC_DISKLESS + NC_WRITE means that the file is read/write using the netcdf API
2. NC_DISKLESS + NC_PERSIST means that the file is persisted to a disk file at nc_close.
3. NC_DISKLESS + NC_PERSIST + NC_WRITE means both 1 and 2.

The NC_PERSIST flag is new and takes over the obsolete NC_MPIPOSIX flag.
NC_MPIPOSIX is still defined, but is now an alias for the NC_MPIIO flag.

It is also now the case that for netcdf-4, NC_DISKLESS is independent
of NC_INMEMORY and in fact it is an error to specify both flags
simultaneously.

Finally, the MMAP code was fixed to use NC_PERSIST as well.
Also marked MMAP as deprecated.

Also added a test case to test various combinations of NC_DISKLESS,
NC_PERSIST, and NC_WRITE.

This PR affects a number of files and especially test cases
that used NC_DISKLESS.

Misc. Unrelated fixes
1. fixed some warnings in ncdump/dumplib.c
2018-10-10 13:32:17 -06:00
Ed Hartnett
d9ef143d1e separated cache code from hdf5file.c 2018-09-14 13:33:22 -06:00
Ed Hartnett
b501748f58 fixed merge error 2018-09-14 11:56:10 -06:00
Ed Hartnett
a009dab557 fixed inadvertant move of function 2018-09-14 11:39:57 -06:00
Ed Hartnett
e2839c120f
Merge branch 'master' into ejh_hdf5_sep_next_2 2018-09-14 11:33:59 -06:00
Ed Hartnett
eabb690949 fixing merge issue 2018-09-12 09:36:36 -06:00
Ed Hartnett
abf247de92 made dumpopenobjects static in attempt to get appvayor build working 2018-09-12 07:53:31 -06:00
Ed Hartnett
08a2dce904 merged master 2018-09-07 12:40:44 -06:00
Ed Hartnett
8390d572ad
Merge branch 'master' into ejh_hdf5_sep_next 2018-09-06 17:30:37 -06:00
Ward Fisher
784d777bff Merge branch 'master' into provenance.dmh 2018-09-06 15:13:09 -06:00
Ed Hartnett
86e002d794 merged master 2018-09-06 14:01:59 -06:00
Ed Hartnett
4213f10ed6 moved function 2018-09-06 13:57:39 -06:00
Ed Hartnett
80dc5bc0f7 merged master 2018-09-06 12:24:29 -06:00
Ed Hartnett
6c86ad8229 moved functions back 2018-09-06 12:19:17 -06:00
Ward Fisher
fbe0a18b1c
Merge branch 'master' into ejh_loop_cleanup_2 2018-09-05 11:22:55 -06:00
Dennis Heimbigner
d62a9e623c Fix the NC_INMEMORY code to work in all cases with HDF5 1.10.
re: github issue https://github.com/Unidata/netcdf-c/issues/1111

One of the less common use cases for the in-memory feature is
apparently failing with HDF5-1.10.x.  The fix is complicated and
requires significant changes to libhdf5/nc4memcb.c. The current
setup is detailed in the file docs/inmeminternal.dox.

Additionally, it was discovered that the program
nc_test/tst_inmemory.c, which is invoked by
nc_test/run_inmemory.sh, actually was failing because of the
above problem. But the failure is not detected since the script
does not return non-zero value.

Other Changes:
1. Fix nc_test_tst_inmemory to return errors correctly.
2. Make ncdap_tests/findtestserver.c and dap4_tests/findtestserver4.c
   be generated from ncdap_test/findtestserver.c.in.
3. Make LOG() print output to stderr instead of stdout to
   avoid contaminating e.g. ncdump output.
4. Modify the handling of NC_INMEMORY and NC_DISKLESS flags
   to properly handle that NC_DISKLESS => NC_INMEMORY. This
   affects a number of code pieces, especially memio.c.
2018-09-04 11:27:47 -06:00
Dennis Heimbigner
2ea1cf5f1b There was a request to extend the provenance information
stored in the _NCProperties attribute to allow two things:
1. capture of additional library dependencies (over and above
   hdf5)
2. Recognition of non-netcdf libraries that create netcdf-4 format
   files.

To this end, the _NCProperties format has been extended to be
and arbitrary set of key=value pairs separated by commas.
This new format has version = 2, and uses commas as the pair separator.
Thus the general form is:
    _NCProperties = "version=2,key1=value,key2=value2..." ;

This new version is accompanied by a new ./configure option of the form
    --with-ncproperties="key1=value1,key2=value2..."
that specifies pairs to add to the _NCProperties attribute for all
files created with that netcdf library.

At this point, what is missing is some programmatic way to
specify either all the pairs or additional pairs
to the _NCProperties attribute. Not sure of the best way
to do this.

Builders using non-netcdf libraries can specify
whatever they want in the key value pairs (as long
as the version=2 is specified first).

By convention, the primary library is expected to be the
the first pair after the leading version=2 pair, but this
is convention only and is neither required nor enforced.

Related changes:
1. Fixed the tests that check _NCProperties to properly operate with version=2.
2. When reading a version 1 _NCProperties attribute, convert it to look
   like a version 2 attribute.
2. Added some version 2 tests to ncdump/tst_fileinfo.c and
   ncdump/tst_fileinfo.sh

Misc Changes:
1. Fix minor problem in ncdap_test/testurl.sh where a parameter to
   buildurl needed to be quoted.
2. Minor fix to ncgen to swap switches -H and -h to be consistent
   with other utilities.
3. Document the -M flag in nccopy usage() and the nccopy man page.
4. Modify a test case to use the nccopy -M flag.
2018-08-25 21:44:41 -06:00
Ed Hartnett
8885c75ade removing unneeded lookups 2018-08-22 06:08:19 -06:00
Ed Hartnett
ff1b71a1e4 cleanup of unneeded find functions 2018-08-21 16:46:44 -06:00
Ed Hartnett
580fc89776 cleanup of NC4_abort 2018-08-21 16:41:57 -06:00
Ed Hartnett
f4c36b532f cleanup of NC4_abort 2018-08-21 16:40:32 -06:00
Ed Hartnett
8688b9cbf0 cleanup of NC4_sync 2018-08-21 16:37:12 -06:00
Ed Hartnett
42b9dc778f removing unneeded function nc4_rec_find_grp 2018-08-21 10:28:44 -06:00
Ed Hartnett
8d0844fa7d removing unneeded function calls 2018-08-21 10:20:32 -06:00
Ed Hartnett
e0bdcf5b64 clean up 2018-08-21 08:40:53 -06:00
Ed Hartnett
06db182eff cleaned up error handling in nc4_close_netcdf4_file 2018-08-21 08:32:39 -06:00
Ed Hartnett
f77350c66d testing error for HDF5 file with circular groups 2018-08-20 09:26:50 -06:00
Ward Fisher
5f89204bdb
Merge branch 'master' into ejh_func_cleanup3 2018-08-06 11:32:45 -06:00
Ed Hartnett
5a452c5815 bring in changes from lazy vars branch 2018-08-06 10:49:31 -06:00
Ed Hartnett
f443facac5 merged ejh_hdf5_sep_file_info 2018-08-06 09:57:17 -06:00
Dennis Heimbigner
f46b65c602 Clear up coverity complaints
with respect to this coverity report.

https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZApv53Ry-2FReUME-2Fmei1et81WqdBwm5AxSAYBM9iFSmbw-3D-3D_YxTn3nq1kZ9CfXcyYFaB2DtJSVHTn8U-2BK0LV-2FDyLYKcFvnwYJ7pm2zFB5UovsEUh5miIfeCfQzYxpN9HYcdqs9sKVjtklOkfPIjEpg0Tj8G9wiptznJeX-2FO4PrqJA1ViQYtQfpjugq01XGMQ3-2Bll42dUMxrmbdYSqi8T7bCcANC5evyZs4MKvmAWXt1bnPaHcOYJDN-2FUt-2FJTlhwu91HyR7h-2FnkvMY9paYUNB1gxiyUA-3D
2018-08-04 13:22:29 -06:00
Ed Hartnett
66b1884f41 fixed merge problem 2018-07-29 02:35:53 -06:00
Ed Hartnett
df15707488
Merge branch 'master' into ejh_hdf5_sep_file_info 2018-07-28 08:16:26 -06:00
Ed Hartnett
5631fa512a merged master 2018-07-24 01:51:51 -06:00
Ed Hartnett
c094baea42 merged master 2018-07-23 13:53:07 -06:00
Ed Hartnett
ee944c3fbb merged master 2018-07-23 10:58:14 -06:00
Ed Hartnett
5a52f28bb7 further condensing code 2018-07-21 10:43:36 -06:00
Ed Hartnett
43f094ca50 changing the way global atts are read 2018-07-21 06:46:29 -06:00
Ed Hartnett
a545c1526d further movement towards NC_HDF5_FILE_INFO_T 2018-07-19 13:00:34 -06:00
Ed Hartnett
4fb0e9d248 further movement towards NC_HDF5_FILE_INFO_T 2018-07-19 12:51:46 -06:00