diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 4c2cb7faf5..2832adb3ed 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -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]. diff --git a/libdispatch/dfile.c b/libdispatch/dfile.c index fa3c9742e2..09e93ec63d 100644 --- a/libdispatch/dfile.c +++ b/libdispatch/dfile.c @@ -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); @@ -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); diff --git a/ncdump/CMakeLists.txt b/ncdump/CMakeLists.txt index 0007888988..acf9dd7167 100644 --- a/ncdump/CMakeLists.txt +++ b/ncdump/CMakeLists.txt @@ -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) diff --git a/ncdump/Makefile.am b/ncdump/Makefile.am index 764ae52748..3d1d0a2bad 100644 --- a/ncdump/Makefile.am +++ b/ncdump/Makefile.am @@ -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 @@ -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 @@ -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. diff --git a/ncdump/test_unicode_directory.sh b/ncdump/test_unicode_directory.sh new file mode 100755 index 0000000000..5944473e33 --- /dev/null +++ b/ncdump/test_unicode_directory.sh @@ -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