Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly disallow variable length type compression #2231

Merged
merged 3 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: NetCDF-Build MinGW
on: [workflow_dispatch]
on: [workflow_dispatch,push]

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release

## 4.8.2 - TBD

* [Bug Fix] Require that the type of the variable in nc_def_var_filter is not variable length. See [Github #/2231](https://github.com/Unidata/netcdf-c/pull/2231).
* [File Change] Apply HDF5 v1.8 format compatibility when writing to previous files, as well as when creating new files. The superblock version remains at 2 for newly created files. Full backward read/write compatibility for netCDF-4 is maintained in all cases. See [Github #2176](https://github.com/Unidata/netcdf-c/issues/2176).
* [Enhancement] Add complete bitgroom support to NCZarr. See [Github #2197](https://github.com/Unidata/netcdf-c/pull/2197).
* [Bug Fix] Clean up the handling of deeply nested VLEN types. Marks nc_free_vlen() and nc_free_string as deprecated in favor of ncaux_reclaim_data(). See [Github #2179](https://github.com/Unidata/netcdf-c/pull/2179).
Expand Down
2 changes: 1 addition & 1 deletion dap4_test/test_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Test the netcdf-4 data building process.
#include <stdio.h>
#include "netcdf.h"

#define DEBUG
#undef DEBUG

static void
fail(int code)
Expand Down
2 changes: 1 addition & 1 deletion libdap2/dceconstraints.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "dapincludes.h"
#include "dceparselex.h"

#define DEBUG
#undef DEBUG

#define LBRACE "{"
#define RBRACE "}"
Expand Down
14 changes: 11 additions & 3 deletions libdispatch/dfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,18 @@ nc_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t* nparamsp, u
EXTERNL int
nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int* params)
{
int stat = NC_NOERR;
NC* ncp;
int stat = NC_check_id(ncid,&ncp);
if(stat != NC_NOERR) return stat;
TRACE(nc_inq_var_filter_info);
int fixedsize;
nc_type xtype;

TRACE(nc_inq_var_filter);
if((stat = NC_check_id(ncid,&ncp))) return stat;
/* Get variable' type */
if((stat = nc_inq_vartype(ncid,varid,&xtype))) return stat;
/* If the variable's type is not fixed-size, then signal error */
if((stat = NC4_inq_type_fixed_size(ncid, xtype, &fixedsize))) return stat;
if(!fixedsize) return NC_EFILTER;
if((stat = ncp->dispatch->def_var_filter(ncid,varid,id,nparams,params))) goto done;
done:
return stat;
Expand Down
6 changes: 5 additions & 1 deletion libdispatch/dpathmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#undef DEBUGPATH
static int pathdebug = -1;
#define DEBUG
#undef DEBUG

#ifdef DEBUG
#define REPORT(e,msg) report((e),(msg),__LINE__)
Expand Down Expand Up @@ -113,7 +113,9 @@ static int wide2utf8(const wchar_t* u16, char** u8p);
#endif

/*Forward*/
#ifdef DEBUG
static void report(int stat, const char* msg, int line);
#endif
static char* printPATH(struct Path* p);

EXTERNL
Expand Down Expand Up @@ -1227,6 +1229,7 @@ printutf8hex(const char* s, char* sx)
*q = '\0';
}

#ifdef DEBUG
static void
report(int stat, const char* msg, int line)
{
Expand All @@ -1235,3 +1238,4 @@ report(int stat, const char* msg, int line)
line,msg,stat,nc_strerror(stat));
}
}
#endif
6 changes: 2 additions & 4 deletions libdispatch/ncs3sdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ NC_s3sdkinitialize(void)
ncs3_finalized = 0;
NCTRACE(11,NULL);
Aws::InitAPI(ncs3options);
NCUNTRACE(NC_NOERR);
}
return 1;
return NCUNTRACE(NC_NOERR);
}

EXTERNL int
Expand All @@ -86,9 +85,8 @@ NC_s3sdkfinalize(void)
ncs3_finalized = 1;
NCTRACE(11,NULL);
Aws::ShutdownAPI(ncs3options);
NCUNTRACE(NC_NOERR);
}
return 1;
return NCUNTRACE(NC_NOERR);
}

static char*
Expand Down
1 change: 1 addition & 0 deletions nc_test4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ IF(ENABLE_FILTER_TESTING)
build_bin_test(tst_multifilter)
build_bin_test(test_filter_order)
build_bin_test(test_filter_repeat)
build_bin_test(test_filter_vlen)
ADD_SH_TEST(nc_test4 tst_filter)
IF(ENABLE_BLOSC)
ADD_SH_TEST(nc_test4 tst_specific_filters)
Expand Down
2 changes: 1 addition & 1 deletion nc_test4/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ endif
# Filter Tests (requires ncdump and ncgen)
if ENABLE_FILTER_TESTING
extradir =
check_PROGRAMS += test_filter test_filter_misc test_filter_order test_filter_repeat
check_PROGRAMS += test_filter test_filter_misc test_filter_order test_filter_repeat test_filter_vlen
check_PROGRAMS += tst_multifilter
TESTS += tst_filter.sh
if ENABLE_BLOSC
Expand Down
16 changes: 13 additions & 3 deletions nc_test4/test_filter_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,24 @@ verifychunks(void)
static int
create(void)
{
int i;

/* Create a file with one big variable, but whose dimensions arte not a multiple of chunksize (to see what happens) */
CHECK(nc_create(testfile, NC_NETCDF4|NC_CLOBBER, &ncid));
CHECK(nc_set_fill(ncid, NC_NOFILL, NULL));
return NC_NOERR;
}

static int
defvar(nc_type xtype)
{
int i;

/* Create a file with one big variable, but whose dimensions arte not a multiple of chunksize (to see what happens) */
for(i=0;i<ndims;i++) {
char dimname[1024];
snprintf(dimname,sizeof(dimname),"dim%d",i);
CHECK(nc_def_dim(ncid, dimname, dimsize[i], &dimids[i]));
}
CHECK(nc_def_var(ncid, "var", NC_FLOAT, ndims, dimids, &varid));
CHECK(nc_def_var(ncid, "var", xtype, ndims, dimids, &varid));
return NC_NOERR;
}

Expand Down Expand Up @@ -370,6 +377,7 @@ test_test1(void)

fprintf(stderr,"test1: compression.\n");
create();
defvar(NC_FLOAT);
setchunking();
setvarfilter();
showparameters();
Expand Down Expand Up @@ -401,6 +409,7 @@ test_test2(void)

fprintf(stderr,"test2: dimsize %% chunksize != 0: compress.\n");
create();
defvar(NC_FLOAT);
setchunking();
setvarfilter();
showparameters();
Expand Down Expand Up @@ -433,6 +442,7 @@ test_test3(void)

fprintf(stderr,"test3: dimsize %% chunksize != 0: compress.\n");
create();
defvar(NC_FLOAT);
setchunking();
setvarfilter();
showparameters();
Expand Down
Loading