Commit Graph

886 Commits

Author SHA1 Message Date
edwardhartnett
965da1de01 now testing that endianness can only be set on atomic ints and floats 2019-11-15 11:10:10 -07:00
edwardhartnett
b844f8f8f6 more testing 2019-11-15 09:26:37 -07:00
edwardhartnett
35e210ac29 test cleanup 2019-11-15 09:21:54 -07:00
edwardhartnett
0017f3e069 test cleanup 2019-11-15 09:21:11 -07:00
edwardhartnett
7f41db9cb3 test cleanup 2019-11-15 09:20:26 -07:00
edwardhartnett
8083b3596e fixed problem of unlim dim and var sharing the same name but not being related 2019-11-15 09:18:42 -07:00
Ward Fisher
1a6351dab2
Merge pull request #1521 from ckhroulev/netcdf4-repeated-attribute-modification
Improve the fix for #350 included in #1119
2019-11-14 17:01:09 -07:00
Ward Fisher
2462cda15e
Merge pull request #1525 from NetCDF-World-Domination-Council/ejh_anon_dims
If HDF5 dataset has multiple anonymous dimensions of the same size, assume they are different dimensions
2019-11-14 16:58:24 -07:00
edwardhartnett
d0b069cf70 cleaned up test handling of strings 2019-11-14 09:39:10 -07:00
edwardhartnett
3e45fa1497 another test for two anon dimensions of same size used in same HDF5 var 2019-11-14 07:23:09 -07:00
edwardhartnett
d73611de73 now handle two anon dimensions of same size used in same HDF5 var 2019-11-14 06:54:22 -07:00
edwardhartnett
cebe84157b adding test for anonymous dims in HDF5 file 2019-11-13 12:51:34 -07:00
edwardhartnett
b9f57b2b5f now UDF mode flags take priority over NC_NETCDF4 2019-11-13 12:13:33 -07:00
Constantine Khrulev
bb45db457e Add regression tests modifying attributes 2^16 times
This commit adds three new tests:

- a test documenting the limitation originally reported in #350 (in
  general modifying an attribute about 2^16 times makes it impossible
  to modify this file in ways requiring nc_redef() and nc_enddef() calls).
- a test ensuring that a scalar attribute can be modified 2^16 times
  as long as its type and size remain the same
- a test ensuring that a text attribute can be modified 2^16 times as
  long as its size remains the same

This version uses the nc_redef(), nc_put_att_...(), nc_enddef()
sequence. One could also use nc_open(), nc_put_att_...(), nc_close()
but that would make these tests significantly slower.
2019-11-13 10:08:31 -09:00
edwardhartnett
0bbe91e438 udf must take priority in NC_infermodel 2019-11-13 12:07:33 -07:00
Dennis Heimbigner
30cfd348e6 Remove debug output 2019-11-06 09:33:14 -07:00
Dennis Heimbigner
9e016b85aa Add test cases 2019-11-03 12:03:13 -07:00
Dennis Heimbigner
f1506d552e Change (again), and hopefully simplify, the file model inference algorithm.
* For URL paths, the new approach essentially centralizes all information
  in the URL into the "#mode=" fragment key and uses that value
  to determine the dispatcher for (most) URLs.

* The new approach has the following steps:

  1. canonicalize the path if it is a URL.
  2. use the mode= fragment key to determine the dispatcher
  3. if dispatcher still not determined, then use the mode flags
     argument to nc_open/nc_create to determine the dispatcher.
  4. if the path points to something readable, attempt to read the
     magic number at the front, and use that to determine the dispatcher.
     this case may override all previous cases.

* Misc changes.

  1. Update documentation
  2. Moved some unit tests from libdispatch to unit_test directory.
  3. Fixed use of wrong #ifdef macro in test_filter_reg.c
     [I think this may fix an previously reported esupport query].
2019-09-29 12:59:28 -06:00
Greg Sjaardema
56c0d5cf8a Spelling fixes 2019-09-18 08:03:01 -06:00
Ward Fisher
9a92201c94 Wiring unit test directory into cmake-based builds. 2019-08-21 14:50:09 -06:00
edwardhartnett
2077729abc removed base_pe functions from dispatch table 2019-08-15 06:51:06 -06:00
edwardhartnett
0b00f4b5eb more work on tst_parallel5.c 2019-08-14 08:50:09 -06:00
edwardhartnett
c042ea5d23 added parallel I/O test for NC_BYTE scalar 2019-08-14 08:22:35 -06:00
edwardhartnett
170c5b0901 removed NC from open in dispatch table 2019-08-01 14:30:20 -06:00
Even Rouault
9d1331ddc9
tst_bug1442: improve test to retrieve a mix of valid values and values at fillvalue 2019-07-18 03:05:20 +02:00
Even Rouault
3f268203db
tst_bug1442.c: address review comments 2019-07-18 02:41:06 +02:00
Even Rouault
16babd3e89
nc_test4/Makefile.am: add tst_bug1442 2019-07-18 02:38:28 +02:00
Even Rouault
0c7be1d278
Add test case for bugfix of #1442 2019-07-18 02:23:43 +02:00
Ed Hartnett
d5816bb13e using netcdf_dispatch.h in tst_udf.c 2019-07-05 05:24:29 -06:00
Ward Fisher
d6a3944199
Merge pull request #1409 from Unidata/nccopydefault.dmh
Nccopy was overriding default chunking when it should not.
2019-05-29 15:26:09 -06:00
Dennis Heimbigner
06498ff16a various fixes 2019-05-23 16:35:03 -06:00
Ed Hartnett
73a433240c fixed warnings in tst_large2.c 2019-05-21 15:24:56 -06:00
Ed Hartnett
d858313d2e fixed warnings in tst_udf.c 2019-05-21 15:23:23 -06:00
Ed Hartnett
9fd7c06f16 fixed warnings in tst_rename2 2019-05-21 15:16:35 -06:00
Ed Hartnett
f35eea13d7 fixed warnings in tst_rename3 2019-05-21 15:15:25 -06:00
Ed Hartnett
fd29e2e608 uncommented test 2019-05-12 08:51:02 -06:00
Ward Fisher
103e5a3ff5
Merge pull request #1385 from Unidata/mmapfix.dmh
Fix cmake wrt mmap
2019-05-02 11:09:12 -06:00
Ward Fisher
44fce0904e
Merge pull request #1387 from Unidata/fixffilter.dmh
Minor config.h changes to support filters in Fortran
2019-05-01 14:44:53 -06:00
Ward Fisher
5410967b00 Merge branch 'master' into addfilter.dmh 2019-04-30 14:51:25 -06:00
Dennis Heimbigner
62feacee00 missing cmake file 2019-04-29 20:55:28 -06:00
Dennis Heimbigner
c9d16d82d6 Fix cmake X mmap
supercede PR: https://github.com/Unidata/netcdf-c/pull/1384

Since we have an mmap user, undeprecate it and make sure
it works. Other changes:

* fix test cases to work with make -j
* fix exposed ncgen error.
2019-04-19 20:32:26 -06:00
Ed Hartnett
d4ab03ea23 merged upstream/master 2019-03-26 11:29:01 -06:00
Ward Fisher
85b94a4244
Merge pull request #1364 from NetCDF-World-Domination-Council/ejh_non_contoversial
non controversial parts of last PR
2019-03-26 11:14:33 -06:00
Dennis Heimbigner
8d0bced60d Allow in-line definition of filters
Priority: Low

re: issue https://github.com/Unidata/netcdf-c/issues/1329

HDF5 has the ability to programmatically define new filters,
as opposed to using HDF5_PLUGIN_PATH env variable.
This PR adds support for that feature.
Not clear how useful this is, though.
See docs/filters.md for details.
2019-03-21 11:33:27 -06:00
Ward Fisher
a25236eac4
Merge pull request #1348 from Unidata/pluginst.dmh
Support installation of the bzip2 plugin under name libh5bzip2.so
2019-03-20 15:42:06 -06:00
Ed Hartnett
54eb9dad77
Merge branch 'master' into ejh_non_contoversial 2019-03-19 14:16:52 -06:00
Ward Fisher
e2b31ffae4
Merge branch 'master' into byterange.dmh 2019-03-19 12:05:44 -06:00
Ed Hartnett
d709624174 now run tst_put_vars_two_unlim_dim 2019-03-18 11:16:44 -06:00
Ed Hartnett
8799fff54b cleanup Makefile.am 2019-03-18 11:09:44 -06:00
Ed Hartnett
06c9f681f4 got distcheck target working 2019-03-18 10:15:18 -06:00
Ed Hartnett
94d9cd7c8f don't allow benchmarks for classic only builds 2019-03-18 08:40:18 -06:00
Ed Hartnett
e3c628482e moving metadata performance tests to nc_perf 2019-03-18 08:30:14 -06:00
Ed Hartnett
51b8ba10b4 attempting to get cmake build working with new nc_perf directory 2019-03-18 08:09:46 -06:00
Ed Hartnett
cf7126b294 fixing distcheck issues 2019-03-17 11:17:29 -06:00
Ed Hartnett
e48bd5e4c2 removed benchmarking stuff from nc_test4/Makefile.am 2019-03-17 10:57:45 -06:00
Ed Hartnett
286dddac4b moved many other benchmark tests to nc_perf 2019-03-17 10:57:00 -06:00
Ed Hartnett
95a0b8ddfb moved other benchmark programs to nc_perf 2019-03-17 08:30:06 -06:00
Ed Hartnett
e391a9b41f moved bm_file.c 2019-03-17 08:19:17 -06:00
Ed Hartnett
a3ca0e4333 move benchmark test script to nc_perf 2019-03-17 08:15:29 -06:00
Ed Hartnett
16c68218de move parallel benchmark test script to nc_perf 2019-03-17 08:14:27 -06:00
Ed Hartnett
73354a9862 moved tst_create_files from nc_test4 to nc_perf 2019-03-17 08:11:08 -06:00
Ed Hartnett
7902615b1c adding nc_perf directory 2019-03-17 08:03:27 -06:00
Ed Hartnett
f91e246699 turned off some ncdump test output 2019-03-12 09:26:15 -06:00
Ed Hartnett
c89fad34e0 only run some benchmark tests if utilities have been built 2019-03-12 09:23:49 -06:00
Dennis Heimbigner
15e4fdcbb4 Support installation of the bzip2 plugin under name libh5bzip2.so
re: https://github.com/Unidata/netcdf-c/issues/1347

It turns out that the plugin libraries (bzip2 and misc) were
being installed as part of 'make installed'. This was not intended
behavior. But after some discussion in the above issue, it was decided
to install the bzip2 plugin. However, in order to avoid naming conflicts,
the plugin is installed under the name 'libh5bzip2.so'.
Note that this is automake behavior only; the install does not
(yet) occur using cmake.

Misc. unrelated changes
-----------------------
1. turn off some debug output in ncdump/Makefile.am
2019-02-27 15:22:46 -07:00
Dennis Heimbigner
6d86aab022 Modify tst_filterparser to use baseline array
re: https://github.com/Unidata/netcdf-c/pull/1337

tst_filterparser was creating but not using the baseline
array. Instead, it did the same thing inline. Fixed code
to use baseline array.
2019-02-25 14:31:54 -07:00
Dennis Heimbigner
4c1ed0144b Fix nc_test4/tst_filter.sh for big endian
re: issue https://github.com/Unidata/netcdf-c/issues/1338

Changes:

1. nc_test4/tst_filter.sh + nc_test4/ref_filteredvv.cdl --
   properly suppress _Endianness attribute
2. fix some warnings
2019-02-24 22:20:01 -07:00
Dennis Heimbigner
0c59e13bf7 Master merge, conflict resolution, cleanup 2019-02-24 16:54:13 -07:00
Dennis Heimbigner
45a8a265b8 master merge 2019-02-23 17:14:12 -07:00
Ward Fisher
404f87b8c2 Turned of filterparser test when building static library. 2019-02-20 15:11:06 -07:00
Ward Fisher
53ba2ff316
Merge pull request #1311 from Unidata/filterexpr.dmh
Extend nccopy -F option syntax.
2019-02-15 15:16:25 -07:00
Dennis Heimbigner
a1f080db19
Merge branch 'master' into byterange.dmh 2019-02-13 14:45:53 -07:00
Ward Fisher
e32e0b1eb2
Merge branch 'master' into filterexpr.dmh 2019-02-12 09:48:03 -07:00
Ed Hartnett
909402ccd6
Merge branch 'master' into ejh_more_rename_woes_3 2019-02-12 05:49:04 -07:00
Dennis Heimbigner
5f0fdd7e5d Update Makefile.am to use ref_ filter files 2019-02-11 16:07:03 -07:00
Dennis Heimbigner
e932655888 Renamed the baseline files for tst_filter.sh 2019-02-09 15:14:13 -07:00
Dennis Heimbigner
a6b04c0c66 Extend nccopy -F option syntax.
A user suggested that the nccopy -F option
syntax should be extended to support specification
of multiple (or all) variables in a single -F option.

The new syntax allows:

1. '*' as the name of the variable; this means apply the
   filter to all variables in the data set.
2. *var1|var2|...* as the variable name to indicate that the filter
   should be applied to the multiple specified variables.
2019-02-08 18:48:17 -07:00
Ward Fisher
4c6d56abc0
Merge branch 'master' into ejh_more_rename_woes_3 2019-02-07 14:28:46 -07:00
Ward Fisher
3a14251dd9
Merge branch 'master' into bigend.dmh 2019-02-07 14:28:39 -07:00
Ward Fisher
1fde39c8d7
Merge branch 'master' into byterange.dmh 2019-02-07 14:28:23 -07:00
Ward Fisher
6511599a6d Corrected issue in support of https://github.com/Unidata/netcdf-c/issues/1310 2019-02-07 12:43:07 -07:00
Ed Hartnett
5d908a0bbb now preserve order of varids after a var rename 2019-02-03 06:56:03 -07:00
Ed Hartnett
275e116f49 added test to demonstrate out of order varids after rename 2019-02-03 06:28:04 -07:00
Ed Hartnett
6728fceab6 uncommented a bunch of rename tests 2019-02-02 05:55:18 -07:00
Ed Hartnett
1dd76c996e added tst_rename3.c for more rename testing 2019-02-02 05:53:45 -07:00
Ed Hartnett
c8cbff4728 added test (commented out) in tst_rename2.c which fails 2019-02-02 04:00:34 -07:00
Dennis Heimbigner
6723a38d90 remove some debug statements 2019-02-01 14:39:30 -07:00
Dennis Heimbigner
65e9a46d84 ckp 2019-02-01 12:00:12 -07:00
Dennis Heimbigner
8714066b18 Fix errors when building on big-endian machine
re: issue https://github.com/Unidata/netcdf-c/issues/1278
re: issue https://github.com/Unidata/netcdf-c/issues/876
re: issue https://github.com/Unidata/netcdf-c/issues/806

* Major change to the handling of 8-byte parameters for nc_def_var_filter.
  The old code was not well thought out.
  * The new algorithm is documented in docs/filters.md.
  * Added new utility file plugins/H5Zutil.c to support
  * Modified plugins/H5Zmisc.c to use new algorithm
  the new algorithm.
  * Renamed include/ncfilter.h to include/netcdf_filter.h
    and made it an installed header so clients can access the
    new algorithm utility.
  * Fixed nc_test4/tst_filterparser.c and nc_test4/test_filter_misc.c
    to use the new algorithm
* libdap4/ fixes:
  * d4swap.c has an error in the endian pre-processing such
    that record counts were not being swapped correctly.
  * d4data.c had an error in that checksums were being computed
    after endian swapping rather than before.
* ocinitialize() was never being called, so xxdr bigendian handling
  was never set correctly.
  * Required adding debug statements to occompile
* Found and fixed memory leak in ncdump.c

Not tested:
* HDF4
* Pnetcdf
* parallel HDF5
2019-01-31 21:13:06 -07:00
Ed Hartnett
fcae21bb9e more testing 2019-01-27 11:48:28 -07:00
Ed Hartnett
b3796633e7 more testing 2019-01-27 11:40:18 -07:00
Ed Hartnett
e859be9a1d more testing 2019-01-27 11:38:39 -07:00
Ed Hartnett
42c64598dc created function create_dim_wo_var() 2019-01-27 10:51:25 -07:00
Ward Fisher
b27c7d899d Merge branch 'master' into byterange.dmh 2019-01-25 14:50:23 -07:00
Ed Hartnett
713804ea03 added rename test to tst_rename2.c which fails :-( 2019-01-24 10:01:46 -07:00
Ed Hartnett
59ee728b93 fixed parallel build problem with tst_files2.c when --enable-benchmarks is used 2019-01-20 10:07:13 -07:00
Ward Fisher
2285e1dfa1 Merge branch 'ejh_test_null_vars_stride' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into pr-aggregation.wif 2019-01-15 15:10:40 -07:00
Ward Fisher
c6ca9dfa1e Merge branch 'ejh_coords_3' of https://github.com/NetCDF-World-Domination-Council/netcdf-c into pr-aggregation.wif 2019-01-15 15:03:36 -07:00
Ward Fisher
9a365be6d0 Merge branch 'ansifix.dmh' into pr-aggregation.wif 2019-01-15 14:58:54 -07:00
Ed Hartnett
ee1680bb80
Merge branch 'master' into ejh_relax 2019-01-03 05:18:57 -07:00
Ed Hartnett
e1785cd324
Merge branch 'master' into ejh_coords_3 2019-01-03 05:18:41 -07:00
Ed Hartnett
c278109c9f
Merge branch 'master' into ejh_test_null_vars_stride 2019-01-03 05:18:25 -07:00
Ward Fisher
c21820a1ae Merge branch 'master' into ansifix.dmh 2019-01-02 22:26:59 -08:00
Ward Fisher
94af1d49c6
Merge branch 'master' into ansicomment.dmh 2019-01-02 20:51:28 -08:00
Dennis Heimbigner
84c2bc0d78 Merge branch 'master' into byterange.dmh 2019-01-02 13:18:45 -07:00
Ed Hartnett
5e66c086a2 took config include out of h5testszip 2019-01-02 06:46:56 -07:00
Ed Hartnett
35017d9549 fixed mistake in Makefile.am 2019-01-02 06:21:11 -07:00
Ed Hartnett
140967e174 more config.h includes for tests 2019-01-02 05:37:54 -07:00
Ed Hartnett
c15c3fa8d5 cleaned up makefile.am, added config.h to some tests 2019-01-02 05:31:15 -07:00
Ed Hartnett
bdf7eef7c6 merged master 2019-01-02 03:52:51 -07:00
Ed Hartnett
35495eb734
Merge branch 'master' into ejh_test_null_vars_stride 2019-01-02 03:49:22 -07:00
Dennis Heimbigner
bf2746b8ea Provide byte-range reading of remote datasets
re: issue https://github.com/Unidata/netcdf-c/issues/1251

Assume that you have the URL to a remote dataset
which is a normal netcdf-3 or netcdf-4 file.

This PR allows the netcdf-c to read that dataset's
contents as a netcdf file using HTTP byte ranges
if the remote server supports byte-range access.

Originally, this PR was set up to access Amazon S3 objects,
but it can also access other remote datasets such as those
provided by a Thredds server via the HTTPServer access protocol.
It may also work for other kinds of servers.

Note that this is not intended as a true production
capability because, as is known, this kind of access to
can be quite slow. In addition, the byte-range IO drivers
do not currently do any sort of optimization or caching.

An additional goal here is to gain some experience with
the Amazon S3 REST protocol.

This architecture and its use documented in
the file docs/byterange.dox.

There are currently two test cases:

1. nc_test/tst_s3raw.c - this does a simple open, check format, close cycle
   for a remote netcdf-3 file and a remote netcdf-4 file.
2. nc_test/test_s3raw.sh - this uses ncdump to investigate some remote
   datasets.

This PR also incorporates significantly changed model inference code
(see the superceded PR https://github.com/Unidata/netcdf-c/pull/1259).

1. It centralizes the code that infers the dispatcher.
2. It adds support for byte-range URLs

Other changes:

1. NC_HDF5_finalize was not being properly called by nc_finalize().
2. Fix minor bug in ncgen3.l
3. fix memory leak in nc4info.c
4. add code to walk the .daprc triples and to replace protocol=
   fragment tag with a more general mode= tag.

Final Note:
Th inference code is still way too complicated. We need to move
to the validfile() model used by netcdf Java, where each
dispatcher is asked if it can process the file. This decentralizes
the inference code. This will be done after all the major new
dispatchers (PIO, Zarr, etc) have been implemented.
2019-01-01 18:27:36 -07:00
Ed Hartnett
091880fd4d fixed null stride problem for vars calls 2018-12-31 07:36:39 -07:00
Ed Hartnett
322840e4cf benchmarking test work 2018-12-31 07:02:18 -07:00
Ed Hartnett
563f9088f2 cleaned up, added wrf checm file test 2018-12-23 06:29:59 -07:00
Ed Hartnett
029aa5f626 now using hidden coordinates att to speed file opens 2018-12-20 05:59:31 -07:00
Ed Hartnett
1b38d9aef8 lazy read of some var metadata 2018-12-18 07:48:22 -07:00
Ed Hartnett
b2fbc71bd4 added test, uncommented some test code 2018-12-17 09:24:47 -07:00
Ed Hartnett
dc982efb3d moved tst_attsperf to be with rest of benchmarks 2018-12-17 08:44:36 -07:00
Dennis Heimbigner
75759ca957 Separate out the --ansi comment fixes.
re: pull request https://github.com/Unidata/netcdf-c/pull/1242

This pr should be applied before https://github.com/Unidata/netcdf-c/pull/1242.
It fixes only the -ansi '//' comment problems. There may be some
slight conflicts with that other pr when it is applied, since in some
cases I converted #if 0...#endif to /*...*/
2018-12-12 13:23:09 -07:00
Dennis Heimbigner
735ae80928 merge master and fix conflicts 2018-12-12 11:47:54 -07:00
Ed Hartnett
8ca5a1ac17
Merge branch 'master' into ejh_fast_var_prep 2018-12-12 07:05:45 -07:00
Ed Hartnett
f724fe6385 uncommented test in tst_interops.c 2018-12-11 06:34:44 -07:00
Ed Hartnett
89b2c48d4c added benchmark program tst_wrf_reads.c 2018-12-11 06:32:25 -07:00
Ward Fisher
d135fb4200 Removed confounding text from a reference file, turned on filter testing by default in Cmake-based builds. 2018-12-07 14:44:47 -07:00
Ward Fisher
462ec93913 Whew! Updated copyright stanza in nc_test4. 2018-12-06 15:27:32 -07:00
Dennis Heimbigner
1a7531392f Make the netcdf-c library compile with gcc -ansi.
Primary fixes to get -ansi to work.
1. Convert all '//' C++ style comments to /*...*/ or to use #if 0...#endif
2. It turns out that when -ansi is specified, then a number of
   functions no longer are defined in the header -- but they are still
   in the .so file.<br>
   The big example is strdup(). So, added code to include/ncconfig.h to define
   externs for those missing functions that occur in more than one place.
   These are enabled if !_WIN32 && __STDC__ == 1 (__STDC__ is supposed to
   be the equivalent compile time flag to -ansi). Note that this requires
   config.h (which references ncconfig.h) to be included in files where it is
   currently not included. Single uses will be only in the file that uses them.
3. Added mmap test for the MAP_ANONYMOUS flag to configure.ac. Apparently
   this is not always defined with -ansi.
4. fix some large integer constants in nc_test4/tst_atts3.c and nc_test4/tst_filterparser.c
   to avoid compiler complaints.
5. fix a double constant in nc_test4/tst_filterparser.c to avoid compiler complaints.

[Note I suspect #4 and #5 will be a problem on big-endian machines, but we have no way to test]

Misc. Changes:
1. convert more instances of _MSC_VER to _WIN32.
2. added some debugging code to include/nctestserver.h
3. added comment about libdispatch/drc.c always being compiled.
4. modify parser generation in ncgen to remove unneeded files.
2018-12-05 19:20:43 -07:00
Ed Hartnett
846153b3fd makefile.am cleanup 2018-12-03 07:42:34 -07:00
Ed Hartnett
262763c254 clean up 2018-11-16 10:01:31 -07:00
Ward Fisher
53dc9022be Merge remote-tracking branch 'origin/ncgenmem.dmh' into tmptmp 2018-11-15 10:20:08 -07:00
Dennis Heimbigner
751300ec59 Fix more memory leaks in netcdf-c library
This is a follow up to PR https://github.com/Unidata/netcdf-c/pull/1173

Sorry that it is so big, but leak suppression can be complex.

This PR fixes all remaining memory leaks -- as determined by
-fsanitize=address, and with the exceptions noted below.

Unfortunately. there remains a significant leak that I cannot
solve. It involves vlens, and it is unclear if the leak is
occurring in the netcdf-c library or the HDF5 library.

I have added a check_PROGRAM to the ncdump directory to show the
problem.  The program is called tst_vlen_demo.c To exercise it,
build the netcdf library with -fsanitize=address enabled. Then
go into ncdump and do a "make clean check".  This should build
tst_vlen_demo without actually executing it.  Then do the
command "./tst_vlen_demo" to see the output of the memory
checker.  Note the the lost malloc is deep in the HDF5 library
(in H5Tvlen.c).

I am temporarily working around this error in the following way.
1. I modified several test scripts to not execute known vlen tests
   that fail as described above.
2. Added an environment variable called NC_VLEN_NOTEST.
   If set, then those specific tests are suppressed.

This should mean that the --disable-utilities option to
./configure should not need to be set to get a memory leak clean
build.  This should allow for detection of any new leaks.

Note: I used an environment variable rather than a ./configure
option to control the vlen tests. This is because it is
temporary (I hope) and because it is a bit tricky for shell
scripts to access ./configure options.

Finally, as before, this only been tested with netcdf-4 and hdf5 support.
2018-11-15 10:00:38 -07:00
Ward Fisher
619f0f1bdf
Merge branch 'master' into patch-28 2018-11-14 13:16:24 -07:00
Greg Sjaardema
a519c12f52
Remove extra argument
Removes extra argument to match function prototype in `NC_Dispatch` as described in #1196
2018-11-14 10:35:58 -07:00
Ed Hartnett
c62804f1f2 whitespace issues 2018-11-09 05:48:30 -07:00
Ed Hartnett
c3d5c43662 fixed test output 2018-11-09 05:45:29 -07:00
Ed Hartnett
1a858e847b fixed test output 2018-11-09 05:41:35 -07: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
Dennis Heimbigner
a5a34f6aba
Merge branch 'master' into nc_mpiio_nc_mpiposix 2018-10-06 13:33:55 -06:00
Dennis Heimbigner
d07c05b58f Fix memory problems when using HDF5 version 1.10.x and later.
re: issue https://github.com/Unidata/netcdf-c/issues/1156

Starting with HDF5 version 1.10.x, the plugin code MUST be
careful when using the standard *malloc()*, *realloc()*, and
*free()* function.

In the event that the code is allocating, reallocating, or
free'ing memory that either came from -- or will be exported to --
the calling HDF5 library, then one MUST use the corresponding
HDF5 functions *H5allocate_memory()*, *H5resize_memory()*,
*H5free_memory()* [5] to avoid memory failures.

Additionally, if your filter code leaks memory, then the HDF5 library
generates a failure something like this.
````
H5MM.c:232: H5MM_final_sanity_check: Assertion `0 == H5MM_curr_alloc_bytes_s' failed.
````

This PR modifies the code in the plugins directory to
conform to these new requirements.

This raises a question about the libhdf5 code where this
same problem may occur. We need to scan especially nc4hdf.c
to look for this problem.
2018-10-04 11:37:21 -06:00
Dennis Heimbigner
dd654a272e Remove debug from tst_filter.sh 2018-10-01 15:54:25 -06:00
Dennis Heimbigner
8072d1f6bb Modify DAP2 and DAP4 to optionally allow Fillvalue/Variable mismatch
re: issue https://github.com/Unidata/netcdf-c/issues/1151

Modify DAP2 and DAP4 code to handle case when _FillValue type is not
same as the parent variable type.

Specifically:
1. Define a parameter [fillmismatch] to allow this mismatch;
   default is to disallow.
2. If allowed, forcibly change the type of the _FillValue to match
   the parent variable.
3. If allowed Convert the values to match new type
4. Generate a log message
5. if not allowed, then fail

Implementing this required some changes to ncdap_test/dapcvt.c
Also added test cases.

Minor Unrelated Changes:
1. There were a number of warnings about e.g.
   assigning a const char* to a char*. Fix these
2. In nccopy.1, replace .NP with .IP "n"
   (re PR https://github.com/Unidata/netcdf-c/pull/1144)
3. fix minor error in ncdump/ocprint
2018-10-01 15:51:43 -06:00
Wei-keng Liao
0ed70756cc Ignore flags NC_MPIIO and NC_MPIPOSIX. 2018-09-22 20:22:34 -05:00
Ward Fisher
5259b4b1e8
Merge branch 'master' into ejh_hdf5_sep_next_2 2018-09-17 14:53:55 -06:00
Dennis Heimbigner
108dc0f01d Fix szip filter handling code and correspondingtests
re: https://github.com/Unidata/netcdf-c/issues/972

The current szip plugin code in the HDF5 library has some
unexpected behaviors that require some changes to how
nc_inq_var_szip is implemented and to the corresponding tests:
nc_test4/{test_szip,tst_vars3}.

Specifically, the following can happen:

1. The number of parameters provided by the user will be two,
   but the number of parameters returned by nc_inq_var_filter
   will be four because the HDF5 code (H5Zszip) will add two
   extra parameters for internal use. It turns out that the two
   parameters provided when calling nc_def_var_filter correspond
   to the first two parameters of the four parameters returned
   by nc_inq_var_filter.

2. The nc_inq_var_szip values corresponding to the ones provided
   by the caller may be different than those provided by
   nc_def_var_filter.  The value of the options_mask argument is
   known to add additional flag bits, and the pixels_per_block
   parameter may be modified.
2018-09-15 15:21:51 -06:00
Ed Hartnett
86e002d794 merged master 2018-09-06 14:01:59 -06:00
Ed Hartnett
80dc5bc0f7 merged master 2018-09-06 12:24:29 -06:00
Ward Fisher
fbe0a18b1c
Merge branch 'master' into ejh_loop_cleanup_2 2018-09-05 11:22:55 -06:00
Ward Fisher
ecffb53f40
Merge branch 'master' into NC_ENOTINDEFINE 2018-09-04 11:23:19 -06:00
Ed Hartnett
9fd74d2c83 uncommented test code 2018-08-28 10:09:39 -06:00
Wei-keng Liao
116f303182 correct error code for operation not allowed in data mode is NC_ENOTINDEFINE 2018-08-24 21:26:25 -05:00