Skip to content

Commit

Permalink
Merge pull request #1669 from Unidata/gh1668.wif
Browse files Browse the repository at this point in the history
Add test to #1668
  • Loading branch information
WardF authored Mar 11, 2020
2 parents acce5ee + 825978b commit d925565
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
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.7.4 - TBD

* [Bug Fix] Correct behavior for the command line utilities when directly accessing a directory using utf8 characters. See [Github #1669](https://github.com/Unidata/netcdf-c/issues/1669), [Github #1668](https://github.com/Unidata/netcdf-c/issues/1668) and [Github #1666](https://github.com/Unidata/netcdf-c/issues/1666) for more information.
* [Bug Fix] Attempts to set filters or chunked storage on scalar vars will now return NC_EINVAL. Scalar vars cannot be chunked, and only chunked vars can have filters. Previously the library ignored these attempts, and always storing scalars as contiguous storage. See [https://github.com/Unidata/netcdf-c/issues/1644].
* [Enhancement] Support has been added for multiple filters per variable. See [https://github.com/Unidata/netcdf-c/issues/1584].
* [Enhancement] Now nc_inq_var_szip retuns 0 for parameter values if szip is not in use for var. See [https://github.com/Unidata/netcdf-c/issues/1618].
Expand Down
8 changes: 4 additions & 4 deletions libdispatch/dfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1851,8 +1851,8 @@ NC_create(const char *path0, int cmode, size_t initialsz,

{
/* Skip past any leading whitespace in path */
const char* p;
for(p=(char*)path0;*p;p++) {if(*p > ' ') break;}
const unsigned char* p;
for(p=(const unsigned char*)path0;*p;p++) {if(*p > ' ') break;}
#ifdef WINPATH
/* Need to do path conversion */
path = NCpathcvt(p);
Expand Down Expand Up @@ -1999,8 +1999,8 @@ NC_open(const char *path0, int omode, int basepe, size_t *chunksizehintp,

{
/* Skip past any leading whitespace in path */
const char* p;
for(p=(char*)path0;*p;p++) {if(*p > ' ') break;}
const unsigned char* p;
for(p=(const unsigned char*)path0;*p;p++) {if(*p > ' ') break;}
#ifdef WINPATH
/* Need to do path conversion */
path = NCpathcvt(p);
Expand Down
1 change: 1 addition & 0 deletions ncdump/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ ENDIF(MSVC)
add_sh_test(ncdump tst_fileinfo)
add_sh_test(ncdump tst_hdf5_offset)
ENDIF(USE_NETCDF4)
add_sh_test(ncdump test_unicode_directory)

add_sh_test(ncdump tst_null_byte_padding)
IF(USE_STRICT_NULL_BYTE_HEADER_PADDING)
Expand Down
8 changes: 5 additions & 3 deletions ncdump/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ utils.h utils.c dimmap.h dimmap.c list.c list.h
# netcdf-3 validator program
# (https://github.com/Parallel-NetCDF/PnetCDF/blob/master/src/utils/ncvalidator/ncvalidator.c)
# that prints out the structure of a netcdf-3 file.
# This program is built but not installed.
# This program is built but not installed.
noinst_PROGRAMS += ncvalidator
ncvalidator_SOURCES = ncvalidator.c

Expand All @@ -61,7 +61,7 @@ bom tst_dimsizes nctrunc
# Tests for classic and 64-bit offset files.
TESTS = tst_inttags.sh run_tests.sh tst_64bit.sh ref_ctest \
ref_ctest64 tst_output.sh tst_lengths.sh tst_calendars.sh \
run_utf8_tests.sh tst_nccopy3.sh tst_nccopy3_subset.sh \
run_utf8_tests.sh test_unicode_directory.sh tst_nccopy3.sh tst_nccopy3_subset.sh \
tst_charfill.sh tst_iter.sh tst_formatx3.sh tst_bom.sh \
tst_dimsizes.sh run_ncgen_tests.sh tst_ncgen4_classic.sh test_radix.sh

Expand Down Expand Up @@ -149,7 +149,9 @@ tst_ncgen4.sh tst_ncgen4_classic.sh tst_ncgen4_diff.sh \
tst_ncgen4_cycle.sh tst_null_byte_padding.sh \
ref_null_byte_padding_test.nc ref_tst_irish_rover.nc ref_provenance_v1.nc \
ref_tst_radix.cdl tst_radix.cdl test_radix.sh \
ref_nccopy_w.cdl tst_nccopy_w3.sh tst_nccopy_w4.sh ref_no_ncproperty.nc
ref_nccopy_w.cdl tst_nccopy_w3.sh tst_nccopy_w4.sh ref_no_ncproperty.nc \
test_unicode_directory.sh


# The L512.bin file is file containing exactly 512 bytes each of value 0.
# It is used for creating hdf5 files with varying offsets for testing.
Expand Down
33 changes: 33 additions & 0 deletions ncdump/test_unicode_directory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
#
# Test to make sure ncdump works with a subdirectory which starts
# with a unicode character.
# See https://github.com/Unidata/netcdf-c/issues/1666 for more information.
# Ward Fisher

if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh


ERR() {
RES=$?
if [ $RES -ne 0 ]; then
echo "Error found: $RES"
exit $RES
fi
}

UNISTRING=$(echo '\xe6\xb5\xb7')

echo ""
echo "Creating Unicode String Directory ${UNISTRING}"
mkdir -p ${UNISTRING}; ERR

echo "*** Generating binary file ${UNISTRING}/tst_utf.nc..."
${NCGEN} -b -o "${UNISTRING}/tst_utf.nc" "${srcdir}/ref_tst_utf8.cdl"; ERR
echo "*** Accessing binary file ${UNISTRING}/tst_utf.nc..."
${NCDUMP} -h "${UNISTRING}/tst_utf.nc"; ERR

echo "Test Passed. Cleaning up."
rm "${UNISTRING}/tst_utf.nc"; ERR
rmdir "${UNISTRING}"; ERR

0 comments on commit d925565

Please sign in to comment.