Commit Graph

10450 Commits

Author SHA1 Message Date
Ward Fisher
197b4d7d98
Merge pull request #3056 from mannreis/patch-3055
CMAKE: Address #3055 - install plugins filters
2024-12-05 09:51:23 -07:00
Ward Fisher
a910744cb3
Merge pull request #3058 from DennisHeimbigner/ftnaux.dmh
Simplify FORTRAN access to the new plugin path mechanism
2024-12-02 10:58:44 -07:00
Dennis Heimbigner
2133052c6e Simplify FORTRAN access to the new plugin path mechanism
The new plugin path API uses char** to represent
a variable lenght vector of variable length strings.
FORTRAN is not capable of accessing such structures.
So, this PR extends the API to provide a counted string-based
API to the plugin path functionality.

The new functions are inserted in the netcdf_aux.h/daux.c files.
The new functions are just wrappers around other plugin path API
function; they are just (I hope) more convenient for FORTRAN users.

The new functions are as follows:

### *ncaux_plugin_path_stringlen(void)*
* Return the length (as in strlen) of the current plugin path directories encoded as a string. Return -1 if the request fails.

### *int ncaux_plugin_path_stringget(int pathlen, char* path)*
* Get the current sequence of directories in the internal global plugin path list encoded as a string path using ';' as a path separator. As an example, it might return "/a/b/c;/home/user/me;/tmp". The arguments are as follows:
    * *pathlen* -- the length of the path argument.
    * *path* -- a string into which the current plugin path as a string is stored.
* Return NC_NOERR | NC_EINVAL

### *int ncaux_plugin_path_stringset(int pathlen, const char* path)*
* Set the current sequence of directories in the internal global plugin path list. As an example, it might take "/a/b/c;/home/user/me;/tmp". The arguments are as follows:
    * *pathlen* -- the length of the path argument.
    * *path* -- a string that is parsed to obtain the sequence of directories for the current plugin path.
* Return NC_NOERR | NC_EINVAL
2024-11-30 17:07:13 -07:00
Manuel Reis
f188386f75 CMAKE: Address #3055 - install plugins filters 2024-11-25 11:06:24 +01:00
Ward Fisher
e8d23eaa77
Merge pull request #3053 from mannreis/patch-1
Quick warning fix plugin/CMakeLists.txt
2024-11-22 15:15:03 -07:00
Manuel Reis
83f7bb0560
Quick warning fix plugin/CMakeLists.txt 2024-11-22 14:53:20 +01:00
Ward Fisher
942f756eae
Merge pull request #3050 from seanm/warning-fixes
Various clang warning fixes
2024-11-19 10:37:26 -07:00
Sean McBride
dafb4d3e25 Fixed clang -Wunused-variable warning 2024-11-15 23:57:47 -05:00
Sean McBride
5a4040b8e2 Fixed various clang Wunused-but-set-variable warnings
Mostly, this was dead code.

In some cases, the variable looked useful in debug, so I kept it but mark it unused by casting it to void.
2024-11-15 23:55:07 -05:00
Sean McBride
f907cd3b57 Fixed various clang -Wself-assign warnings
Use idiomatic cast to void to indicate that a variable is unused.
2024-11-15 23:47:15 -05:00
Sean McBride
e188eb95d2 Fixed -Wunused-variable warnings 2024-11-15 23:25:21 -05:00
Sean McBride
7beb242316 Fixed -Wsometimes-uninitialized warnings with zero initialization 2024-11-15 23:25:21 -05:00
Ward Fisher
12d6dbed82
Merge pull request #3049 from WardF/nc-config-plugin-path-fix.wif
Update nc-config in support of changes made in #3034
2024-11-14 20:48:48 +01:00
Ward Fisher
64d2f319a0 Update nc-config in support of changes made in #3034 2024-11-14 11:16:58 -07:00
Ward Fisher
fb75ad6588
Merge pull request #3034 from DennisHeimbigner/minpluginx.dmh
Extend the netcdf API to support programmatic changes to the plugin search path
2024-11-13 01:11:54 +01:00
Ward Fisher
818f56d933 Correct typo. 2024-11-12 10:30:31 -07:00
Ward Fisher
f67f25c57b
Merge pull request #3022 from edwardhartnett/ejh_conf2
fixing some autoconf problems
2024-11-04 17:36:23 +00:00
Ward Fisher
8f918820b6
Merge pull request #3047 from DennisHeimbigner/blosctest2.dmh
Replace PR https://github.com/Unidata/netcdf-c/pull/3046
2024-11-01 22:56:22 +00:00
Dennis Heimbigner
d325fbba5b Replace PR 3046 2024-11-01 16:15:09 -06:00
Ward Fisher
1d0b6fd89d
Merge pull request #3046 from DennisHeimbigner/blosctest.dmh
Cleanup the blosc testing in nc_test4 and nczarr_test.
2024-10-29 11:55:55 -05:00
Dennis Heimbigner
7dda2c46b1 Update RELEASE notes 2024-10-28 22:02:15 -06:00
Dennis Heimbigner
73ce129194 Cleanup the blosc testing in nc_test4 and nczarr_test.
re: Issue https://github.com/Unidata/netcdf-c/issues/2868

There are three parameters (zero, one, and two) that are currently
used in testing, but should not be. Parameters zero and one
are ignored by the code and parameter two is the typesize
parameter that either takes on the value 0 or 4 (== sizeof(int)).
See nc_test4/tst_specific_filters.sh.

Unfortunately, these three parameters differ depending on the blosc library.
The solution is to force them to a specific value -- namely 0,0,0 --
in the test script.
2024-10-28 21:18:11 -06:00
Dennis Heimbigner
0f8b02c476 replace 2024-10-18 20:42:55 -06:00
Dennis Heimbigner
f947687ae5 conflicts 2024-10-18 20:30:55 -06:00
Dennis Heimbigner
4f78847a84 oops 2024-10-18 20:20:17 -06:00
Dennis Heimbigner
08426c30b9 final update 2024-10-18 19:52:47 -06:00
Dennis Heimbigner
efdec07f3d Extend the netcdf API to support programmatic changes to the plugin search path
Replaces PR https://github.com/Unidata/netcdf-c/pull/3024
         and PR https://github.com/Unidata/netcdf-c/pull/3033

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

As suggested by Ed Hartnett, This PR extends the netcdf.h API to support programmatic control over the search path used to locate plugins.

I created several different APIs, but finally settled on the following API as being the simplest possible. It does have the disadvantage that it requires use of a global lock (not implemented) if used in a threaded environment.

Specifically, note that modifying the plugin path must be done "atomically". That is, in a multi-threaded environment, it is important that the sequence of actions involved in setting up the plugin path must be done by a single processor or in some other way as to guarantee that two or more processors are not simultaneously accessing the plugin path get/set operations.

As an example, assume there exists a mutex lock called PLUGINLOCK. Then any processor accessing the plugin paths should operate as follows:
````
lock(PLUGINLOCK);
nc_plugin_path_get(...);
<rebuild plugin path>
nc_plugin_path_set(...);
unlock(PLUGINLOCK);
````
## Internal Architecture

It is assumed here that there only needs to be a single set of plugin path directories that is shared by all filter code and is independent of any file descriptor; it is global in other words. This means, for example, that the path list for NCZarr and for HDF5 will always be the same.

However internally, processing the set of plugin paths depends on the particular NC_FORMATX value (NC_FORMATX_NC_HDF5 and NC_FORMATX_NCZARR, currently). So the *nc_plugin_path_set* function, will take the paths it is given and propagate them to each of the NC_FORMATX dispatchers to store in a way that is appropriate to the given dispatcher.

There is a complication with respect to the *nc_plugin_path_get* function. It is possible for users to bypass the netcdf API and modify the HDF5 plugin paths directly. This can result in an inconsistent plugin path between the value used by HDF5 and the global value used by netcdf-c. Since there is no obvious fix for this, we warn the user of this possibility and otherwise ignore it.

## Test Changes
* New tests<br>
    a. unit_test/run_pluginpaths.sh -- was created to test this new capability.<br>
    b. A new test utility has been added as *unit_test/run_dfaltpluginpath.sh* to test the default plugin path list.
* New test support utilities<br>
    a. unit_test/ncpluginpath.c -- report current state of the plugin path<br>
    b. unit_test/tst_pluginpaths.c -- test program to support run_pluginpaths.sh

## Documentation
* A new file -- docs/pluginpath.md -- provides documentation of the new API. It includes some
  material taken fro filters.md.

## Other Major Changes
1. Cleanup the whole plugin path decision tree. This is described in the *docs/pluginpath.md* document and summarized in Addendum 2 below.
2. I noticed that the ncdump/testpathcvt.sh had been disabled, so fixed and re-enabled it. This necessitated some significant changes to dpathmgr.c.

## Misc. Changes
1. Add some path manipulation utilities to netcf_aux.h
2. Fix some minor bugs in netcdf_json.h
3. Convert netcdf_json.h and netcdf_proplist.h to BUILT_SOURCE.
4. Add NETCDF_ENABLE_HDF5 as synonym for USE_HDF5
5. Fix some size_t <-> int conversion warnings.
6. Encountered and fixed the Windows \r\n problem in tst_pluginpaths.c.
7. Cleanup some minor CMakeLists.txt problems.
8. Provide an implementation of echo -n since it appears to not be
   available on all platforms.
9. Add a property list mechanism to pass environmental information to filters.
10. Cleanup Doxyfile.in
11. Fixed a memory leak in libdap2; surprised that I did not find this earlier.

## Addendum 1: Proposed API

The API makes use of a counted vector of strings representing the sequence of directories in the path. The relevant type definition is as follows.
````
typedef struct NCPluginList {size_t ndirs; char** dirs;} NCPluginList;
````

The API proposed in this PR looks like this (from netcdf-c/include/netcdf_filter.h).

* ````int nc_plugin_path_ndirs(size_t* ndirsp);````
    Arguments: *ndirsp* -- store the number of directories in this memory.

    This function returns the number of directories in the sequence if internal directories of the internal plugin path list.

* ````int nc_plugin_path_get(NCPluginList* dirs);````
    Arguments:  *dirs* -- counted vector for storing the sequence of directies in the internal path list.

    This function returns the current sequence of directories from the internal plugin path list. Since this function does not modify the plugin path, it does not need to be locked; it is only when used to get the path to be modified that locking is required.  If the value of *dirs.dirs* is NULL (the normal case), then memory is allocated to hold the vector of directories. Otherwise, use the memory of *dirs.dirs* to hold the vector of directories.

* ````int nc_plugin_path_set(const NCPluginList* dirs);````
    Arguments: *dirs* -- counted vector for providing the new sequence of directories in the internal path list.

    This function empties the current internal path sequence and replaces it with the sequence of directories argument. Using an *ndirs* argument of 0 will clear the set of plugin paths.

## Addendum 2: Build-Time and Run-Time Constants.

### Build-Time Constants
<table style="border:2px solid black;border-collapse:collapse">
<tr style="outline: thin solid;" align="center"><td colspan="4">Table showing the build-time computation of NETCDF_PLUGIN_INSTALL_DIR and NETCDF_PLUGIN_SEARCH_PATH.</td>
<tr style="outline: thin solid" ><th>--with-plugin-dir<th>--prefix<th>NETCDF_PLUGIN_INSTALL_DIR<th>NETCDF_PLUGIN_SEARCH_PATH
<tr style="outline: thin solid" ><td>undefined<td>undefined<td>undefined<td>PLATFORMDEFALT
<tr style="outline: thin solid" ><td>undefined<td>&lt;abspath-prefix&gt;<td>&lt;abspath-prefix&gt;/hdf5/lib/plugin<td>&lt;abspath-prefix&gt;/hdf5/lib/plugin&lt;SEP&gt;PLATFORMDEFALT
<tr style="outline: thin solid" ><td>&lt;abspath-plugins&gt;<td>N.A.<td>&lt;abspath-plugins&gt;<td>&lt;abspath-plugins&gt;&lt;SEP&gt;PLATFORMDEFALT
</table>

<table style="border:2px solid black;border-collapse:collapse">
<tr style="outline: thin solid" align="center"><td colspan="2">Table showing the computation of the initial global plugin path</td>
<tr style="outline: thin solid"><th>HDF5_PLUGIN_PATH<th>Initial global plugin path
<tr style="outline: thin solid"><td>undefined<td>NETCDF_PLUGIN_SEARCH_PATH
<tr style="outline: thin solid"><td>&lt;path1;...pathn&gt;<td>&lt;path1;...pathn&gt;
</table>
2024-10-18 19:23:59 -06:00
Dennis Heimbigner
a747f5ea76 Merge remote-tracking branch 'Unidata/main' 2024-10-16 09:27:19 -06:00
Ward Fisher
c4c8e12c5c
Merge pull request #3040 from mannreis/cmake-zip
Fix failing building with custom libzip
2024-10-15 14:34:36 -06:00
Dennis Heimbigner
357c412feb kp 2024-10-13 16:47:53 -06:00
Manuel Reis
2d052a27b4 Extend library filter library lookup to lib64/ 2024-10-10 18:20:24 +02:00
Manuel Reis
1327ab6915 cmake - when building libnczarr, include zip.h if NETCDF_ENABLE_NCZARR_ZIP=ON 2024-10-10 14:30:29 +02:00
Dennis Heimbigner
318eb36ad2 Merge branch 'master' into minpluginx.dmh 2024-10-08 12:32:58 -06:00
Dennis Heimbigner
83c890aec7 Merge remote-tracking branch 'Unidata/main' 2024-10-08 12:30:39 -06:00
Ward Fisher
95a6361cc6
Merge pull request #3037 from WardF/fix-nc-config.wif
Modify nc-config --libs and --static arguments
2024-10-01 17:57:29 -05:00
Ward Fisher
042c0b7cbd Modify nc-config --libs and --static arguments in support of https://github.com/Unidata/netcdf-c/issues/3032 2024-10-01 16:54:38 -05:00
Ward Fisher
f33fb51e37
Merge pull request #3036 from WardF/fix-zstd-cmake.wif
If libZstd isn't found, turn off netcdf_enable_filter_zstd
2024-10-01 16:51:30 -05:00
Ward Fisher
7eaafef034 Incorporate a recent change to netcdf_plugin_install_dir 2024-09-30 17:16:51 -06:00
Ward Fisher
ebd0229749 Merge branch 'main' of https://github.com/Unidata/netcdf-c into minpluginx.dmh 2024-09-30 17:06:15 -06:00
Ward Fisher
b84fcd7e30
Merge pull request #3035 from WardF/gh3007.wif
Fix in support of https://github.com/Unidata/netcdf-c/issues/3007
2024-09-30 18:02:12 -05:00
Ward Fisher
870875d7c2 If libZstd isn't found, turn off netcdf_enable_filter_zstd 2024-09-30 16:22:06 -06:00
Ward Fisher
7a0999ef3f Fix in support of https://github.com/Unidata/netcdf-c/issues/3007 2024-09-30 16:19:38 -06:00
Dennis Heimbigner
ef425b9171 ckp 2024-09-30 14:39:48 -06:00
Dennis Heimbigner
4bf7e6f964 Merge remote-tracking branch 'Unidata/main' 2024-09-29 20:22:04 -06:00
Ward Fisher
0ad7164de0
Merge pull request #3030 from WardF/gh3029-unsafe-macro.wif
Add legacy macro option
2024-09-27 17:48:39 -05:00
Ward Fisher
b03d1373b9 Amend annoying whitespace. 2024-09-27 15:56:05 -06:00
Ward Fisher
28ff401f9f Updated release notes. 2024-09-27 15:51:44 -06:00
Ward Fisher
dc0634c6e0 Toggle legacy macros to on, for now. 2024-09-27 14:22:59 -06:00
Ward Fisher
0f92d4c0f6 Clean up a couple of logic errors resulting in github action failures. 2024-09-26 16:52:05 -06:00
Ward Fisher
5f09bbf492 Ensure absolute paths in rpath for plugins. 2024-09-26 17:38:23 -05:00