Commit Graph

8196 Commits

Author SHA1 Message Date
Greg Sjaardema
f7c2ba40d6 Revert all whitespace changes 2021-12-07 11:56:34 -07:00
Greg Sjaardema
9dbcf3735e Eliminate tabs added in last commit 2021-12-07 11:50:28 -07:00
Greg Sjaardema
f4e48ff4e0 Better implementation of the no dimscale attach option 2021-12-07 11:49:18 -07:00
Greg Sjaardema
31783b61de Make dimscale attachement to variables optional 2021-12-02 15:13:51 -07:00
Ward Fisher
26ac2a6cba
Merge pull request #2121 from gsjaardema/patch-48
Refactor Z library detection
2021-11-04 15:42:02 -06:00
Ward Fisher
7dc355aab8
Merge pull request #2139 from WardF/gh2135.wif
libxml2 capability
2021-11-04 14:47:14 -06:00
Ward Fisher
b3fe92e304 Fencepost unistd.h inclusion. 2021-11-04 14:21:55 -06:00
Ward Fisher
c0a6acaf5a
Merge branch 'main' into gh2135.wif 2021-11-04 13:56:05 -06:00
Ward Fisher
b69163a387 Preprocessing for generated ezxml files. 2021-11-04 13:46:07 -06:00
Ward Fisher
33e4ec4675
Merge pull request #2138 from DennisHeimbigner/fixosbugs.dmh
Fix a number of OS specific bugs
2021-11-04 13:36:49 -06:00
Ward Fisher
0e336208da Addressed an issue in ncbytes where long unsigned ~= size_t 2021-11-04 10:10:28 -06:00
Ward Fisher
25d3d008f6 Added missing include for read() function. 2021-11-04 10:01:27 -06:00
Ward Fisher
0471869f58 Merge remote-tracking branch 'upstream/main' into gh2135.wif 2021-11-03 13:47:35 -06:00
Ward Fisher
8f648252ee Adding control block, --enable and disable option for libxml2 to configure.ac 2021-11-03 13:40:47 -06:00
Ward Fisher
0e205f9513
Merge pull request #2137 from DennisHeimbigner/typo.dmh
Typo in previous PR
2021-11-03 13:34:47 -06:00
Ward Fisher
516a9c35d3 Updated .gitignore to ignore .vscode directory. 2021-11-03 13:14:02 -06:00
Ward Fisher
73c4cc3883 Updated release notes. 2021-11-03 13:13:25 -06:00
Dennis Heimbigner
6bd289d655 Update release notes 2021-11-03 12:52:42 -06:00
Dennis Heimbigner
55a2643cac Fix a number of OS specific bugs
1. Issue https://github.com/Unidata/netcdf-c/issues/2043
   * FreeBSD build fails because of conflicts in defining the fileno() function. So removed all extern declarations of fileno.

2. Issue https://github.com/Unidata/netcdf-c/issues/2124
   * There were a couple of problems here.
     * I was conflating msys with mingw and they need separate handling of paths. So treat mingw like windows.
     * memio.c was not always writing the full content of the memory to file. Untested fix by properly accounting for zero size writes.
     * Fix bug when skipping white space in tst_xcache.c

3. Issue https://github.com/Unidata/netcdf-c/pull/2105
   * On MINGW, bash and other POSIX utilities use a mounted root directory,
     but executables compiled for Windows do not recognise the mount point.
     Ensure that Windows paths are used in tests of Windows executables.

4. Issue https://github.com/Unidata/netcdf-c/issues/2132
   * Apparently the Intel C compiler on OSX defines isnan etc.
     So disable declaration in dutil.c under that condition.

5. Fix and re-enable test_rcmerge.sh by allowing override of where to
   look for .rc files

6. CMakeLists.txt suppresses certain ncdump directory tests because of differences in printing floats/doubles.
   * Extend the list to include those that also fail under mingw.
   * Suppress the mingw tests in ncdump/Makefile.am
2021-11-03 12:49:54 -06:00
Dennis Heimbigner
e14c17fd08 Typo in previous PR
re: https://github.com/Unidata/netcdf-c/issues/2136

Patch for: https://github.com/Unidata/netcdf-c/pull/2134/

Inadvertent error changing ->info to ->s3.
2021-11-03 12:06:50 -06:00
Ward Fisher
eead7fa6d2 Begin wiring in option to toggle automatic search for libxml2 in support of https://github.com/Unidata/netcdf-c/pulls/2135 2021-11-02 15:35:04 -06:00
Dennis Heimbigner
cf903a678a Update release notes 2021-11-01 22:40:08 -06:00
Dennis Heimbigner
53464e8963 Allow optional use of libxml2
re: https://github.com/Unidata/netcdf-c/issues/2119

H/T to [Egbert Eich](https://github.com/e4t) and [Bas Couwenberg](https://github.com/sebastic) for this PR.

It is undesirable to make netcdf be dependent on the availability
of libxml2, but it is desirable to allow its use if available.

In order to do this, a wrapper API (include/ncxml.h) was constructed
that supports either ezxml or libxml2 as the implementation.
Additionally, the xml support code was moved to a new directory
netcdf-c/libncxml.

Primary changes:
* Create a new sub-directory named netcdf-c/libncxml to hold all the xml implementation code.
* Move ezxml.c and ezxml.h to libncxml
* Create a wrapper API -- include/ncxml.h
* Create an implementation, ncxml_ezxml.c to support use of ezxml.
* Create an implementation, ncxml_xml2.c to support use of libxml2.
* Add a check for libxml2 in configure.ac and CMakeLists.txt
* Modify libdap to use the wrapper API instead of ezxml directly.

Misc. Other Changes:
* Change include/netcdf_json.h from built source to be part of the distribution.
2021-11-01 22:37:05 -06:00
Ward Fisher
fcf0fa7dbd
Merge pull request #2134 from DennisHeimbigner/zarrs3part2.dmh 2021-11-01 16:00:39 -06:00
Dennis Heimbigner
6f3bfde222 Update release notes 2021-10-29 20:35:13 -06:00
Dennis Heimbigner
f6e25b695e Fix additional S3 support issues
re: https://github.com/Unidata/netcdf-c/issues/2117
re: https://github.com/Unidata/netcdf-c/issues/2119

* Modify libsrc to allow byte-range reading of netcdf-3 files in private S3 buckets; this required using the aws sdk. Also add a test case.
* The aws sdk can sometimes cause problems if the Awd::ShutdownAPI function is not called. So at optional atexit() support to ensure it is called. This is disabled for Windows.
* Add documentation to nczarr.md on how to build and use the aws sdk under windows. Currently it builds, but testing fails.
* Switch testing from stratus to the Unidata bucket on S3.
* Improve support for the s3: url protocol.
* Add a s3 specific utility code file: ds3util.c
* Modify NC_infermodel to attempt to read the magic number of byte-ranged files in S3.

## Misc.

* Move and rename the core S3 SDK wrapper code (libnczarr/zs3sdk.cpp) to libdispatch since it now used in libsrc as well as libnczarr.
* Add calls to nc_finalize in the utilities in case atexit is disabled.
* Add header only json parser to the distribution rather than as a built source.
2021-10-29 20:06:37 -06:00
Ward Fisher
228e7f5b5c
Merge pull request #2114 from DennisHeimbigner/zarrs3.dmh
Significantly Improve Amazon S3 Cloud Storage Support
2021-10-28 14:22:56 -06:00
Dennis Heimbigner
2da684fc37 ckp 2021-10-26 22:52:23 -06:00
Dennis Heimbigner
58ba84de0b update merge 2021-10-26 20:53:05 -06:00
Ward Fisher
783dc54d12
Merge pull request #2131 from gsjaardema/patch-49
Remove duplicate line
2021-10-26 09:48:28 -06:00
Greg Sjaardema
9c6181da09
Remove duplicate line
Remove a duplicate line...
2021-10-25 17:09:17 -06:00
Ward Fisher
19828e137d
Merge pull request #2127 from DennisHeimbigner/byterangefix.dmh
Fix bug in the default HDF5 byte-range reader
2021-10-19 10:35:05 -06:00
Dennis Heimbigner
3d6ab95dea Update Release Notes 2021-10-17 13:57:07 -06:00
Dennis Heimbigner
2d08c64290 Fix bug in the default HDF5 byte-range reader
re: https://github.com/Unidata/netcdf-c/issues/2122

There was a string allocation error in H5FDhttp.c
2021-10-17 13:55:03 -06:00
Ward Fisher
9116700eaf
Merge pull request #2126 from gsjaardema/patch-49
Avoid infinite loop for finding large prime values
2021-10-14 16:31:32 -06:00
Greg Sjaardema
6f65754357
Avoid infinite loop for finding large prime values
If the `val` passed to `findPrimeGreaterThan` is greater than the largest value (not the sentinel) in the `NC_primes`, then the routine will fall into an infinite loop.   Modified to call an external routine that brute forces the finding of a prime larger than the value in this case.  

The brute force routine uses the primes in `NC_primes` table in the prime test, so this will fail if given a `value > 180503 * 180503`.   The `isPrime` function could be rewritten to avoid this, but assuming this won't happen for the forseeable future.  If it does happen, `isPrime` will return that any value larger than this is prime...
2021-10-14 15:55:04 -06:00
Ward Fisher
4086bbd887
Merge pull request #2056 from gsjaardema/WIP-attribute-creation-order-tracking-option
Attribute creation order on/off
2021-10-13 10:18:36 -06:00
Ward Fisher
4c2adb5ff0
Merge pull request #2125 from DennisHeimbigner/dmh-patches1.dmh
Patch errors
2021-10-12 14:57:23 -06:00
Dennis Heimbigner
8bbdee157f Fix memory leak 2021-10-12 14:20:37 -06:00
Dennis Heimbigner
bf593248b3 Update release notes 2021-10-12 14:06:18 -06:00
Dennis Heimbigner
b5d4afd1d5 Patch errors
## Examine and fix ezxml errors

re: Issue https://github.com/Unidata/netcdf-c/issues/2119

Multiple security issues were found in ezxml (see above Issue).

* CVE-2021-31598
* CVE-2021-31348 / CVE-2021-31347
* CVE-2021-31229
* CVE-2021-30485
* CVE-2021-26222
* CVE-2021-26221
* CVE-2021-26220
* CVE-2019-20202
* CVE-2019-20201
* CVE-2019-20200
* CVE-2019-20199
* CVE-2019-20198
* CVE-2019-20007
* CVE-2019-20006
* CVE-2019-20005

In addition, moved ezxml to libdispatch.

## Examine and fix selected  oss-fuzz detected errors

Note that most of these errors are in the libsrc .m4 generated
code so fixing them is difficult. It would nice if we could tell
oss-fuzz to skip those files. They are old and crufty and
probably need a complete refactor.

Issue|Status
-----|------
35382|Fixed; old bug
35398|Closed by OSS-Fuzz
35442|Guarantee alloc > 0 or error; Old bug
35721|Assert failure; ok
35992|Fixed; old bug
36038|Fixed; old bug
36129|Unfixed; old bug
36229|Fixed by adding assert; old bug
37476|Unfixed; old bug
37824|Assert Failure; ok
38300|Closed by OSS-Fuzz
38537|Unfixed; old bug
38658|Unfixed; old bug
38699|Fixed maybe; old bug
38772|Nature of error is unclear, suspect that it results from using too large a type.
39248|Need more information
39394|Unfixed; old bug
2021-10-12 14:03:48 -06:00
Greg Sjaardema
80f3c78593
Clean up some whitespace junk
A previous edit added some extraneous whitespace that should not be there...
2021-10-12 09:52:57 -06:00
Greg Sjaardema
c2fac03d1a
Use consistent form for find_package
Remove the double quotes I had used in the find_package...
2021-10-11 14:56:52 -06:00
Greg Sjaardema
6650bddfcf
Better detection of libz library
Instead of just specifying "z" as a dependent library, use `find_package`
2021-10-11 14:54:21 -06:00
Greg Sjaardema
e48ebe7b80
Remove another duplicate find_path
There was another almost duplicate `find_path` call in the code that is now removed.  It wasn't a part of this PR, but removing just for completeness
2021-10-11 11:08:19 -06:00
Greg Sjaardema
5c2a8f282f
Remove duplicate line
Not sure where the almost duplicate `find_path` line came from.  Removed it.
2021-10-11 11:01:19 -06:00
Dennis Heimbigner
289103d2b1 Merge branch 'master' into zarrs3.dmh 2021-10-07 15:10:03 -06:00
Greg Sjaardema
c457b050d4
fix last commit. 2021-10-05 13:04:35 -06:00
Greg Sjaardema
a007971bd4
Put threads find_package back where it was.
Moving the threads find_package affects the windows build.
2021-10-05 13:03:19 -06:00
Greg Sjaardema
7b2ad585a6
Refactor Z library detection
HDF5 can depend on the Z library (in fact required for netCDF).  Moved the detection of whether hdf5 was built with zlib up before any other tests that may require linking of the hdf5 library to determine presence/absence of symbols.  These tests require that the link line include "-lz" if the hdf5 library was built with libz support.  

This is typically handled somewhat automatically if shared libraries are being used, but in the static library case, the explicit dependency needs to be specified.  For internal CMake checks, it uses the `CMAKE_REQUIRED_LIBRARIES` list to specify the libraries that should be used in a `CHECK_C_SOURCE_COMPILE` or a `CHECK_LIBRARY_EXISTS` call.   In the current CMakeLists.txt ordering, the zlib detection is done _after_ the `CHECK_LIBRARY_EXISTS` calls which can cause them to fail and give an incorrect result about whether the function being tested for exists.   With the reordering in this PR, I am able to correctly configure netCDF on a CRAY HPC system that uses static libraries by default.
2021-10-04 10:52:23 -06:00