Commit Graph

8507 Commits

Author SHA1 Message Date
Ward Fisher
65e5fd857c Temporarily disable ubuntu tests on PR. 2022-01-20 14:57:02 -07:00
Ward Fisher
d951322351 Renaming jobs to differentiate between Ubuntu and Linux jobs. 2022-01-20 14:49:50 -07:00
Ward Fisher
4d167366be It was worth a shot. 2022-01-20 14:45:16 -07:00
Ward Fisher
686f51eaac Syntax 2022-01-20 14:43:44 -07:00
Ward Fisher
bb17007350 Syntax 2022-01-20 14:42:55 -07:00
Ward Fisher
a9d792c1af Collapse some redundant definitions in the Ubuntu-based workflow. 2022-01-20 14:41:11 -07:00
Ward Fisher
932a60c005 Renamed some of the job steps. 2022-01-20 14:38:10 -07:00
Ward Fisher
070b8609ee Adding github actions. 2022-01-20 14:27:47 -07:00
Ward Fisher
8d4e0f8362 Renamed the workflow file for running ubuntu-based tests. 2022-01-20 14:12:17 -07:00
Ward Fisher
1666f80701
Merge pull request #2145 from oxelson/docs
Docs migration
2022-01-19 15:46:20 -07:00
Jennifer Oxelson
127e85d616
Update CMakeInstallation.cmake
added missing paren
2022-01-19 14:35:32 -07:00
Jennifer Oxelson
a6646a65ab
Update release_header.html
Fixed typo.
2022-01-19 11:50:59 -07:00
Ward Fisher
abcbd9e1d5
Merge pull request #2156 from edwardhartnett/ejh_t1
Now setting deflate_level of 0 is interpreted to mean no deflate.
2022-01-18 17:02:30 -07:00
Ward Fisher
5fe73f4f65
Merge pull request #2180 from hmaarrfk/fixup_testfilter_misc
Fix a few memory leaks and erroneous logic in nczarr_test/testfilter_misc
2022-01-18 16:37:11 -07:00
Ward Fisher
3980d7616a
Merge pull request #2130 from nco/csz_gbg
Granular BitGroom feature for netcdf-c
2022-01-13 17:35:16 -07:00
Ward Fisher
e7e2f40188
Merge pull request #2179 from DennisHeimbigner/vlenfix.dmh
Fix various problem around VLEN's
2022-01-13 16:58:51 -07:00
Ward Fisher
978a99bbea
Merge branch 'main' into vlenfix.dmh 2022-01-13 16:31:34 -07:00
Ward Fisher
20187ce3a8
Merge pull request #2106 from mjwoods/mingw-w64-strcasecmp
Avoid redefinition of strcasecmp under mingw-w64
2022-01-13 12:31:19 -07:00
Ward Fisher
cdf507a52d
Merge pull request #2183 from DennisHeimbigner/modeflags.dmh
Make sure mode flags are properly defined in netcdf.h
2022-01-13 11:19:59 -07:00
Dave Allured
158f290663
Minor comment fix for return codes 2022-01-12 19:06:17 -07:00
Dennis Heimbigner
b5879b1935 Update release notes 2022-01-11 20:14:34 -07:00
Dennis Heimbigner
56c549af0f Make sure mode flags are properly defined in netcdf.h
In a number of places in the netcdf-c library, some of the
high order mode flags (the mode argument to nc_open or nc_close)
are being used to save state information. This means that the
description of the defined and open mode flags in netcdf.h
were not accurate.

This PR moves all those hack flags so that the list of mode flags
in netcdf.h is correct.
2022-01-11 19:05:46 -07:00
Dave Allured
69b2d20d56
Improve comments about format compatibility 2022-01-11 10:25:13 -07:00
Dennis Heimbigner
d06938fd1d 1. Fix an additional flaw in fill_value handling where non-atomic default values were not properly being handled.
2. Rename the NC4_inq_any_type to NC_inq_any_type
3. Fix performance test cases affected by this PR.
2022-01-10 22:26:19 -07:00
Milton Woods
b33a6348f1
Merge branch 'main' into mingw-w64-strcasecmp 2022-01-11 10:45:15 +11:00
Dennis Heimbigner
11547ffd29 1. Fix an additional flaw in fill_value handling where non-atomic default values were not properly being handled.
2. Rename the NC4_inq_any_type to NC_inq_any_type
2022-01-10 15:27:16 -07:00
Mark Harfouche
cdd97754a9 Fixup nc_test4/test_filter_misc.c too 2022-01-09 15:58:41 -05:00
Mark Harfouche
458fa0b8c7 Fix a few memory leaks and erroneous logic in nczarr_test/testfilter_misc 2022-01-09 14:41:35 -05:00
Dennis Heimbigner
b77918c535 Update actions 2022-01-08 18:53:24 -07:00
Dennis Heimbigner
2e26597e7f update release notes 2022-01-08 18:32:00 -07:00
Dennis Heimbigner
8b9253fef2 Fix various problem around VLEN's
re: https://github.com/Unidata/netcdf-c/issues/541
re: https://github.com/Unidata/netcdf-c/issues/1208
re: https://github.com/Unidata/netcdf-c/issues/2078
re: https://github.com/Unidata/netcdf-c/issues/2041
re: https://github.com/Unidata/netcdf-c/issues/2143

For a long time, there have been known problems with the
management of complex types containing VLENs.  This also
involves the string type because it is stored as a VLEN of
chars.

This PR (mostly) fixes this problem. But note that it adds new
functions to netcdf.h (see below) and this may require bumping
the .so number.  These new functions can be removed, if desired,
in favor of functions in netcdf_aux.h, but netcdf.h seems the
better place for them because they are intended as alternatives
to the nc_free_vlen and nc_free_string functions already in
netcdf.h.

The term complex type refers to any type that directly or
transitively references a VLEN type. So an array of VLENS, a
compound with a VLEN field, and so on.

In order to properly handle instances of these complex types, it
is necessary to have function that can recursively walk
instances of such types to perform various actions on them.  The
term "deep" is also used to mean recursive.

At the moment, the two operations needed by the netcdf library are:
* free'ing an instance of the complex type
* copying an instance of the complex type.

The current library does only shallow free and shallow copy of
complex types. This means that only the top level is properly
free'd or copied, but deep internal blocks in the instance are
not touched.

Note that the term "vector" will be used to mean a contiguous (in
memory) sequence of instances of some type. Given an array with,
say, dimensions 2 X 3 X 4, this will be stored in memory as a
vector of length 2*3*4=24 instances.

The use cases are primarily these.

## nc_get_vars
Suppose one is reading a vector of instances using nc_get_vars
(or nc_get_vara or nc_get_var, etc.).  These functions will
return the vector in the top-level memory provided.  All
interior blocks (form nested VLEN or strings) will have been
dynamically allocated.

After using this vector of instances, it is necessary to free
(aka reclaim) the dynamically allocated memory, otherwise a
memory leak occurs.  So, the recursive reclaim function is used
to walk the returned instance vector and do a deep reclaim of
the data.

Currently functions are defined in netcdf.h that are supposed to
handle this: nc_free_vlen(), nc_free_vlens(), and
nc_free_string().  Unfortunately, these functions only do a
shallow free, so deeply nested instances are not properly
handled by them.

Note that internally, the provided data is immediately written so
there is no need to copy it. But the caller may need to reclaim the
data it passed into the function.

## nc_put_att
Suppose one is writing a vector of instances as the data of an attribute
using, say, nc_put_att.

Internally, the incoming attribute data must be copied and stored
so that changes/reclamation of the input data will not affect
the attribute.

Again, the code inside the netcdf library does only shallow copying
rather than deep copy. As a result, one sees effects such as described
in Github Issue https://github.com/Unidata/netcdf-c/issues/2143.

Also, after defining the attribute, it may be necessary for the user
to free the data that was provided as input to nc_put_att().

## nc_get_att
Suppose one is reading a vector of instances as the data of an attribute
using, say, nc_get_att.

Internally, the existing attribute data must be copied and returned
to the caller, and the caller is responsible for reclaiming
the returned data.

Again, the code inside the netcdf library does only shallow copying
rather than deep copy. So this can lead to memory leaks and errors
because the deep data is shared between the library and the user.

# Solution

The solution is to build properly recursive reclaim and copy
functions and use those as needed.
These recursive functions are defined in libdispatch/dinstance.c
and their signatures are defined in include/netcdf.h.
For back compatibility, corresponding "ncaux_XXX" functions
are defined in include/netcdf_aux.h.
````
int nc_reclaim_data(int ncid, nc_type xtypeid, void* memory, size_t count);
int nc_reclaim_data_all(int ncid, nc_type xtypeid, void* memory, size_t count);
int nc_copy_data(int ncid, nc_type xtypeid, const void* memory, size_t count, void* copy);
int nc_copy_data_all(int ncid, nc_type xtypeid, const void* memory, size_t count, void** copyp);
````
There are two variants. The first two, nc_reclaim_data() and
nc_copy_data(), assume the top-level vector is managed by the
caller. For reclaim, this is so the user can use, for example, a
statically allocated vector. For copy, it assumes the user
provides the space into which the copy is stored.

The second two, nc_reclaim_data_all() and
nc_copy_data_all(), allows the functions to manage the
top-level.  So for nc_reclaim_data_all, the top level is
assumed to be dynamically allocated and will be free'd by
nc_reclaim_data_all().  The nc_copy_data_all() function
will allocate the top level and return a pointer to it to the
user. The user can later pass that pointer to
nc_reclaim_data_all() to reclaim the instance(s).

# Internal Changes
The netcdf-c library internals are changed to use the proper
reclaim and copy functions.  It turns out that the places where
these functions are needed is quite pervasive in the netcdf-c
library code.  Using these functions also allows some
simplification of the code since the stdata and vldata fields of
NC_ATT_INFO are no longer needed.  Currently this is commented
out using the SEPDATA \#define macro.  When any bugs are largely
fixed, all this code will be removed.

# Known Bugs

1. There is still one known failure that has not been solved.
   All the failures revolve around some variant of this .cdl file.
   The proximate cause of failure is the use of a VLEN FillValue.
````
        netcdf x {
        types:
          float(*) row_of_floats ;
        dimensions:
          m = 5 ;
        variables:
          row_of_floats ragged_array(m) ;
              row_of_floats ragged_array:_FillValue = {-999} ;
        data:
          ragged_array = {10, 11, 12, 13, 14}, {20, 21, 22, 23}, {30, 31, 32},
                         {40, 41}, _ ;
        }
````
When a solution is found, I will either add it to this PR or post a new PR.

# Related Changes

* Mark nc_free_vlen(s) as deprecated in favor of ncaux_reclaim_data.
* Remove the --enable-unfixed-memory-leaks option.
* Remove the NC_VLENS_NOTEST code that suppresses some vlen tests.
* Document this change in docs/internal.md
* Disable the tst_vlen_data test in ncdump/tst_nccopy4.sh.
* Mark types as fixed size or not (transitively) to optimize the reclaim
  and copy functions.

# Misc. Changes

* Make Doxygen process libdispatch/daux.c
* Make sure the NC_ATT_INFO_T.container field is set.
2022-01-08 18:30:00 -07:00
Dave Allured
b3b0da91b2
Add compatibility function prototype 2022-01-07 18:40:44 -07:00
Dave Allured
9f461848b5
Format compatibility when re-opening files
This commit selects the best HDF5 format compatibility options when re-opening an existing netCDF-4 file for writing, such as appending, or adding new groups or variables.

The general objective is to make netCDF-4 files that can be read and written by all previous library  versions.  Optimal HDF5 v1.8 compatibility is selected whenever possible.  Otherwise this falls back to the adequate v1.6 compatibility.

Format compatibility is a transient property of the HDF5 library, rather than baked in at file creation time.  Therefore, compatibility options must be re-selected every time a netCDF-4 file is re-opened for writing.

This builds on the previous update for initial file creation, PR #1931, by @brtnfld, released in netcdf-c version 4.8.1.

In particular, this commit moves compatibility controls into a single central location, a new common function that is shared by both create and open functions.

For more details, see issue #951, also documentation at the top of libhdf5/hdf5set_format_compatibility.c.

This commit also makes several corrections and cleanups to previous comments about the use of related property lists.
2022-01-07 18:34:52 -07:00
Ward Fisher
988e771a9e
Merge pull request #2171 from DennisHeimbigner/fixmingw.dmh
Support MSYS2/Mingw platform
2022-01-04 16:17:37 -07:00
Ward Fisher
9e7fa3e448
Merge pull request #2172 from Dave-Allured/main
tst_misc.sh: Fix hang in make check
2022-01-03 16:14:24 -07:00
Dave Allured
d20ac91de7
Merge pull request #1 from Dave-Allured/tst_misc-fix
tst_misc.sh: Fix hang in make check
2021-12-24 06:41:10 -07:00
Dave Allured
b58165f755
tst_misc.sh: Fix hang in make check 2021-12-23 23:18:43 -07:00
Dennis Heimbigner
43f2e51112 Fix new LGTM alerts 2021-12-23 23:10:44 -07:00
Dennis Heimbigner
1397c3407b Update RELEASENOTES.md 2021-12-23 22:33:01 -07:00
Dennis Heimbigner
9380790ea8 Support MSYS2/Mingw platform
re:

The current netcdf-c release has some problems with the mingw platform
on windows. Mostly they are path issues.

Changes to support mingw+msys2:
-------------------------------
* Enable option of looking into the windows registry to find
  the mingw root path. In aid of proper path handling.
* Add mingw+msys as a specific platform in configure.ac and move testing
  of the platform to the front so it is available early.
* Handle mingw X libncpoco (dynamic loader) properly even though
  mingw does not yet support it.
* Handle mingw X plugins properly even though mingw does not yet support it.
* Alias pwd='pwd -W' to better handle paths in shell scripts.
* Plus a number of other minor compile irritations.
* Disallow the use of multiple nc_open's on the same file for windows
  (and mingw) because windows does not seem to handle these properly.
  Not sure why we did not catch this earlier.
* Add mountpoint info to dpathmgr.c to help support mingw.
* Cleanup dpathmgr conversions.

Known problems:
---------------
* I have not been able to get shared libraries to work, so
  plugins/filters must be disabled.
* There is some kind of problem with libcurl that I have not solved,
  so all uses of libcurl (currently DAP+Byterange) must be disabled.

Misc. other fixes:
------------------
* Cleanup the relationship between ENABLE_PLUGINS and various other flags
  in CMakeLists.txt and configure.ac.
* Re-arrange the TESTDIRS order in Makefile.am.
* Add pseudo-breakpoint to nclog.[ch] for debugging.
* Improve the documentation of the path manager code in ncpathmgr.h
* Add better support for relative paths in dpathmgr.c
* Default the mode args to NCfopen to include "b" (binary) for windows.
* Add optional debugging output in various places.
* Make sure that everything builds with plugins disabled.
* Fix numerous (s)printf inconsistencies betweenb the format spec
  and the arguments.
2021-12-23 22:18:56 -07:00
Dennis Heimbigner
a16ffef2da remove ezxml code as no longer required 2021-12-23 12:22:19 -07:00
Dennis Heimbigner
e8c794d391 Remove debug 2021-12-22 22:11:56 -07:00
Dennis Heimbigner
6523f048e1 Update RELEASENOTES.md 2021-12-22 21:06:57 -07:00
Dennis Heimbigner
b0a495c7d0 Replace ezxml with tinyxml2
re: PR https://github.com/Unidata/netcdf-c/pull/2139
re: PR https://github.com/Unidata/netcdf-c/pull/2169
re: PR https://github.com/Unidata/netcdf-c/pull/2146
re: Issue https://github.com/Unidata/netcdf-c/issues/2119

Found the product tinyxml2 at https://github.com/leethomason/tinyxml2.git
and replaced ezxml with it. Tinyxml2 is about twice the LOC of ezxml,
but at least is it still being maintained, and I can use it out of the box.
It is C++ rather than C, but we seem to have reached the point that we can
include C++ code with only minor compile flag changes. Untested on Mac OS.
Added instructions to the end of libncxml/Makefile.am on how to upgrade
to a later version of tinyxml2.

This PR obsoletes the use of ezxml (re PRs https://github.com/Unidata/netcdf-c/pull/2146 and https://github.com/Unidata/netcdf-c/issue/2119).
2021-12-22 21:04:40 -07:00
Ward Fisher
dfb10a3f21
Merge pull request #2168 from DennisHeimbigner/ncdumptests.dmh
Cleanup the CMake inter-test dependencies
2021-12-21 14:29:46 -07:00
Dennis Heimbigner
5fb64d59af Update RELEASE Notes 2021-12-20 18:10:56 -07:00
Dennis Heimbigner
73caeb674d Cleanup the CMake inter-test dependencies
The ncdump test set has a number of inter-test dependencies
that are not properly established in ncdump/CMakeLists.txt.

So this PR attempts to:
1. reorder the tests
2. change tests in CMakeLists.txt from build_bin_test_no_prefix to add_bin_test_no_prefix so they get executed

Plus a couple of minor bug fixes.
1. Change ENABLE_NC4 => ENABLE_HDF5 in github action.
2. fix a memory error in findtestserver.c.in
3. fix bug in ncdap_tests/tst_urls.sh
4. fix netcdf file name bug in tst_netcdf4_4.sh
2021-12-20 15:13:08 -07:00
Ward Fisher
1ad0a53595
Merge pull request #2167 from DennisHeimbigner/addremotetest.dmh
Restore default enable for enable-dap-remote-testsc
2021-12-17 12:02:46 -06:00
Dennis Heimbigner
f00d03284a Restore default on for enable-dap-remote-testsc
The remote test server is up again. So re-enable.
Also do some test cleanup.
2021-12-16 15:43:22 -07:00
Ward Fisher
ebbb742819
Merge pull request #2164 from DennisHeimbigner/cmakelog4j.dmh
Disable by default dap-remote-tests for CMake
2021-12-13 10:16:18 -06:00