Commit Graph

186 Commits

Author SHA1 Message Date
Ward Fisher
16d6f94f30 Merge branch 'master' into filters.dmh 2017-11-13 11:15:02 -07: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
111248e067 Changed to make little-endian the standard for 64-bit parameters 2017-10-10 11:21:01 -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
Dennis Heimbigner
733da154c5 1. Keep up to date by merging master
2. Factored out the parameter string parsing for ncgen and nccopy
   int libdispatch/dfilter.c + include/ncfilter.h
3. Allow a parameter string to use constant types other than
   unsigned int. See docs/filters.md for details.
4. Moved the old content of  include/netcdf_filter.h into include/netcdf.h
   and removed include/netcdf_filter.h as no longer needed.
5. Force the test filter (bzip2) in nc_test4/filter_test to
   be built using BUILT_SOURCES.
2017-10-08 15:56:45 -06:00
Dennis Heimbigner
3cc3b6a4a1 add known szip file against which to test 2017-09-04 18:37:13 -06:00
Dennis Heimbigner
99e4250d6d Get szip working under cmake 2017-08-27 20:38:37 -06:00
Dennis Heimbigner
ed44fd7306 Add szip support via libaec 2017-08-27 13:35:20 -06:00
Dennis Heimbigner
5085df7595 1. Add discussion of parameter encoding, esp in face of byte-order,
to docs/filter.md
2. Moved location of filter.md in documentation
3. Add a template file as the basis for building new filters.
4. Did some test case cleanup
2017-08-21 19:54:06 -06:00
Dennis Heimbigner
9719fbfbad re: hithub issue https://github.com/Unidata/netcdf-c/issues/435
Some temporary files are being left in a tempdir (e.g. /tmp
under *nix*).

The situation is described tersely in
netcdf-c/docs/auth.html#REDIR Basically, when a url is used that
requires redirection, a physical cookiejar file is required
to exist in the file system in order for this to work.

Since it was difficult to figure out when redirection was
being used (it was internal to libcurl) I needed to be prepared for that
eventuality. The result was that I always created a cookiejar file if one
was not specified in the rc file. This actually occurs in two places:
one inside oc2 and one inside libdap4.

The solution was two-fold:
1. do not use a cookiejar directory -- create cookiejar file directly
2. ensure that all cookiejar related files are reclaimed by nc_close().
Note that if nc_close (or nc_abort) is not called for whatever reason,
then reclamation will not occur.
2017-07-05 10:03:48 -06:00
Dennis Heimbigner
8f2f9b74e3 re: pull request https://github.com/Unidata/netcdf-c/pull/364
This is a follow-on in that the old utf8 code was still being
used in ncgen to convert utf8->utf16 when converting cdl to Java
(see genj.c).

The new code apparently has no utf16 support, but it does have
utf32 support. Converting utf32 -> utf16 can be approximated by
truncating the 32bits to 16 bits, unless the top 16 bits are
not zero. This latter condition is unlikely to be common because
it implies use of some rather obscure characters.

So solution is to convert to utf32 and truncate to 16 bits to
get utf16. An error is reported if the high-order truncated 16
bits are not zero. If we get complaints, then I will figure out
how to convert full utf32 to a utf16 pair.

Also removed the old code from ncgen.
2017-06-06 15:23:59 -06:00
Dennis Heimbigner
a2090ccc0d Add debug output for libdap4/d4read.c 2017-04-10 12:04:20 -06:00
Dennis Heimbigner
6a4ba35565 Fix pull request https://github.com/Unidata/netcdf-c/pull/374 (dap4.dmh)
1. Cleanup test_common.sh to expunge (mostly) the use of the VS
   path value. This has the effect of being unable to use the
   Visual Studio C compiler for shell tests.
2. There is a missing case in CMakeLists.txt so add
   defaulting for HDF5_C_LIBRARY_hdf5 using HDF5_C_LIBRARY.
   Ward should probably examine this to get it fixed correctly.
3. Put back ref to esg.md in docs/Doxyfile.in
4. Fix minor warning in dut8proc.h
2017-04-10 09:26:57 -06:00
Dennis Heimbigner
e1e7c77c26 Add initial DAP4 documentation 2017-04-06 10:06:32 -06: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
78c0f34c82 Merging master into branch. 2017-02-27 11:00:24 -07:00
Dennis Heimbigner
ee2916f60a Originally, libdap2 was also going to provide
a dap2->netcdf-4 translation. That is now
superceded by dap4. But there is some cruft
in the dap2 code around this that should be removed.
2017-02-21 15:13:37 -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
Dennis Heimbigner
1bf34d8557 A netcdfgroup email
(Re: [netcdfgroup] nccopy fails with corrupted double link list)
shows that ncdump/nccopy was returning EPERM instead of
NC_EDAPCONSTRAINT as an error when we have a malformed constraint.
Also clean up a potential bug that might occur if the user invokes
nc_set_default_format before calling nc_open on a dap url.
2016-06-24 15:28:50 -06:00
dmh
5bfdf54263 The name hash for hdf4 variables was
not being computed. Fix in nc4file.c.
Not sure how this ever worked for any variable.
What is also weird is that the dim hash is
apparently being computed.
2016-06-01 15:20:36 -06:00
Dennis Heimbigner
835511eaeb HDF5 is generating unnecessary error messages when netcdf4 logging is enabled
re: github netcdf-c issue #271

This occurs for several reasons, including:
1. using H5Aopen_name instead of H5Aexists to test if attribute exists.
2. using H5Eset_auto instead of H5Eset_auto2.
There are probably others that will have to be extinguished as encountered.
p.s Hope I did not overdo this and kill too much.
2016-05-27 10:08:01 -06:00
Dennis Heimbigner
8c1f8f57ee re: https://github.com/Unidata/netcdf-c/issues/269
The hash field for phony dimensions was not being set
(in nc4hdf.c). Also added test case (nc_test4/?).
Note that I searched for other similar failures and
did not find any, but I may have missed them.
2016-05-24 19:37:21 -06:00
Dennis Heimbigner
272e6f4022 Oops, forgot to test nc3 only.
Fixed some errors from that case.
2016-05-07 14:32:07 -06:00
Dennis Heimbigner
11a259ad86 Add provenance info for netcdf-4 files.
This consists of a persistent attribute named
_NCProperties plus two computed attributes
_IsNetcdf4 and _SuperblockVersion.
See the 'Provenance Attributes' section
of docs/attribute_conventions.md for details.
2016-05-07 14:32:07 -06:00
Dennis Heimbigner
45572f5971 Fix github issue: https://github.com/Unidata/netcdf-c/issues/208
Return an error when specifying deflation (compression) or fletcher32 on
a file created for parallel IO in netcdf-4.
2016-02-01 16:15:58 -07:00
Dennis Heimbigner
39e9cd0ffe Fix issues with Github pull request 187
(https://github.com/Unidata/netcdf-c/pull/187)
Primary problem was cmake build errors.
2016-01-08 12:55:11 -07:00
Dennis Heimbigner
8e6beda671 NetCDF-c Github issue #178
NetCDF-c Github issue #178 / esupport BNL-694121

The ncgen man pages says:
> Note also that the words variable',dimension', data',group', and
> `types' are legal CDL names, but be careful that there is a space be-
> tween them and any following colon character when used as a variable
> name. This is mostly an issue with attribute declarations.

Ncdump does not obey this rule.
The fix is to modify ncdump/ncdump.c to check if a variable name is
a keyword.

Also added test case.
2015-12-26 18:19:04 -07:00
dmh
47e10591b4 ckp 2015-11-19 13:44:55 -07:00
dmh
413e49d758 1. There were several bugs in ncdump/dumplib.c
that were not taking the CDF-5 format into account.

2. Had to update ncgen.1 man page to define the new
   k-flag rules to deal with cdf-5.

3. Had to fix some tests that use 'cmp' for comparison;
   this really should be deprecated.

3. There was a bug in configure.ac with respect
   to using the enable-netcdf-4 flag vs
   using disable-netcdf-4.
2015-11-06 17:03:28 -07:00
Ward Fisher
612b35a84c Merge branch 'master' into cdf-5, in preparation for merging the CDF-5 functionality into the master branch. This will be the key new feature for netcdf 4.4.0. 2015-11-05 13:40:35 -07:00
Dennis Heimbigner
cd7a06b193 pull request 2015-10-12 17:09:37 -06:00
dmh
39ccdc5ee3 conflicts 2015-10-11 13:43:19 -06:00
dmh
ed57a337ec add ptrdiff_t checks 2015-10-11 13:35:44 -06:00
Dennis Heimbigner
554034b712 1. Added temporary work-around for cygwin where
AC_CHECK_SIZEOF is not working because anti-virus
   will not allow very rapid creation/deletion of a
   file with same name.
2. modified some test baselines to attempt to fix
   Ward's issue
2015-10-09 10:33:40 -06:00
dmh
9f65c3b808 cleanup and squash changes vav master 2015-10-09 10:26:49 -06:00
dmh
58d486f0ac ckp 2015-10-09 10:23:21 -06:00
dmh
8fc86035b2 merge-squash 2015-10-09 10:22:00 -06:00
Dennis Heimbigner
dccbc87d24 1. Added temporary work-around for cygwin where
AC_CHECK_SIZEOF is not working because anti-virus
   will not allow very rapid creation/deletion of a
   file with same name.
2. modified some test baselines to attempt to fix
   Ward's issue
2015-10-09 10:14:45 -06:00
dmh
087ae58ffd cleanup and squash changes vav master 2015-10-09 10:12:11 -06:00
dmh
5f3088185d ckp 2015-10-09 10:12:11 -06:00
dmh
49597a64af merge-squash 2015-10-09 10:12:11 -06:00
dmh
5b89b22021 missing include file 2015-09-18 11:11:57 -06:00
Dennis Heimbigner
a1be2456eb 1. Added temporary work-around for cygwin where
AC_CHECK_SIZEOF is not working because anti-virus
   will not allow very rapid creation/deletion of a
   file with same name.
2. modified some test baselines to attempt to fix
   Ward's issue
2015-09-15 15:18:59 -06:00
dmh
b8f0522c91 add experimental stdio based ncio module 2015-08-19 17:14:13 -06:00
dmh
2bfe9bba32 cleanup and squash changes vav master 2015-08-16 21:44:18 -06:00
dmh
4d82140a5b ckp 2015-08-16 14:54:35 -06:00
dmh
859f105005 merge-squash 2015-08-15 16:26:35 -06:00
dmh
dbc7215063 1. fix nc_open_mem doxygen description
2. fix some bugs wrt to cygwin vs linux.
3. add to RELEASE_NOTES
4. try to fix tst_inmemory fd error by putting the first
   arg to dotest in quotes.
2015-05-28 19:23:33 -06:00
dmh
be5e3cd606 1. Allow for the user specified rc file via the env variable
DAPRCFILE.  Note that the value of this environment
   variable should be the absolute path of the rc file, not
   the path to its containing directory.
2. fixup testauth.sh and add some new tests
3. synch oc
2015-05-24 17:31:39 -06:00
dmh
8673e66640 A couple of docs/ .dox files have apparently
been converted to .md.
2015-04-16 16:44:51 -06:00