diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2012-02-13 14:18:09 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2012-02-13 14:18:09 (GMT) |
commit | 12339b0759c5c7ddeebd59a7a1c0c7b7e6f9156d (patch) | |
tree | 977889da7a5ad34143ff904bebabc3c8d49ba7aa | |
parent | 841a7f4b50c886112e59a1eb70ba87a4693a2973 (diff) | |
download | hdf5-12339b0759c5c7ddeebd59a7a1c0c7b7e6f9156d.zip hdf5-12339b0759c5c7ddeebd59a7a1c0c7b7e6f9156d.tar.gz hdf5-12339b0759c5c7ddeebd59a7a1c0c7b7e6f9156d.tar.bz2 |
[svn-r21931] HDFFV-7689 - could not not use a "[" character in a dataset name.
A second problem also discovered was an if statement that should have comapered lengths of a string actually was comapring addreeses. Once thatt was fixed, The "[" character could be used but broke other functionality. Consultation with tools team resulted in the creation of a "--no-subset" option to disable interpretation of "[" character as a subsetting compact-form. This also eliminated and cleaned up the code containing the plomatic if statement.
Tested: local linux and added test, CMake updated autotools test to be added next.
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | release_docs/RELEASE.txt | 6 | ||||
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 5 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 46 | ||||
-rw-r--r-- | tools/testfiles/h5dump-help.txt | 2 | ||||
-rw-r--r-- | tools/testfiles/tno-subset.ddl | 9 | ||||
-rw-r--r-- | tools/testfiles/tno-subset.h5 | bin | 0 -> 1400 bytes | |||
-rw-r--r-- | tools/testfiles/tnofilename-with-packed-bits.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tnofilename.ddl | 4 | ||||
-rw-r--r-- | tools/testfiles/tpbitsIncomplete.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tpbitsLengthExceeded.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tpbitsLengthPositive.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tpbitsMaxExceeded.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tpbitsOffsetExceeded.ddl | 2 | ||||
-rw-r--r-- | tools/testfiles/tpbitsOffsetNegative.ddl | 2 |
15 files changed, 65 insertions, 23 deletions
@@ -1404,6 +1404,8 @@ ./tools/testfiles/tnestcomp-1.ddl ./tools/testfiles/tnestedcomp.h5 ./tools/testfiles/tnofilename.ddl +./tools/testfiles/tno-subset.h5 +./tools/testfiles/tno-subset.ddl ./tools/testfiles/tnullspace.h5 ./tools/testfiles/tnullspace.ddl ./tools/testfiles/tobjref.h5 diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ffa82be..49dd0bd 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -239,6 +239,12 @@ New Features Tools: ------ + - h5dump: Added new option --no-compact-subset. This option will not + interpret the '[' character as starting the compact form of + subsetting. This is useful when the "h5dump error: unable to + open dataset "datset_name"" message is output because a dataset + name contains a '[' character.(JIRA HDFFV-7689). + (ADB - 2012/01/31) - h5dump: Corrected schema location: <hdf5:HDF5-File xmlns:hdf5="http://hdfgroup.org/HDF5/XML/schema/HDF5-File" diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index df13ea4..8f2498d 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -127,6 +127,7 @@ IF (BUILD_TESTING) tnestcomp-1.ddl tnbit.ddl tnofilename.ddl + tno-subset.ddl tnullspace.ddl zerodim.ddl tordergr1.ddl @@ -293,6 +294,7 @@ IF (BUILD_TESTING) tmulti-s.h5 tnamed_dtype_attr.h5 tnestedcomp.h5 + tno-subset.h5 tnullspace.h5 zerodim.h5 torderattr.h5 @@ -830,6 +832,8 @@ IF (BUILD_TESTING) tnbit.out.err tnofilename.out tnofilename.out.err + tno-subset.out + tno-subset.out.err tnullspace.out tnullspace.out.err zerodim.out @@ -1019,6 +1023,7 @@ IF (BUILD_TESTING) ADD_H5_TEST (tall-4s 0 --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5) ADD_H5_TEST (tall-5s 0 -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5) ADD_H5_TEST (tdset-3s 0 -d "/dset1[1,1;;;]" tdset.h5) + ADD_H5_TEST (tno-subset 0 --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" tno-subset.h5) # test printing characters in ASCII instead of decimal ADD_H5_TEST (tchar1 0 -r tchar.h5) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 268824a..61a9607 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -93,6 +93,7 @@ static int display_ai = TRUE; /*array index */ static int display_escape = FALSE; /*escape non printable characters */ static int display_region = FALSE; /*print region reference data */ static int enable_error_stack= FALSE; /* re-enable error stack */ +static int disable_compact_subset= FALSE; /* disable compact form of subset notation */ static int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ /* sort parameters */ @@ -408,7 +409,7 @@ struct handler_t { */ /* The following initialization makes use of C language cancatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b*F:s:S:Aq:z:m:REM:"; +static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b*F:s:S:Aq:z:m:RECM:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -523,6 +524,7 @@ static struct long_options l_opts[] = { { "region", no_arg, 'R' }, { "enable-error-stack", no_arg, 'E' }, { "packed-bits", require_arg, 'M' }, + { "no-compact-subset", no_arg, 'C' }, { NULL, 0, '\0' } }; @@ -695,6 +697,8 @@ usage(const char *prog) fprintf(stdout, " E.g., to dump a file called `-f', use h5dump -- -f\n"); fprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they\n"); fprintf(stdout, " occur.\n"); + fprintf(stdout, " --no-compact-subset Disable compact form of subsetting and allow the use\n"); + fprintf(stdout, " of \"[\" in datset names.\n"); fprintf(stdout, "\n"); fprintf(stdout, " Subsetting is available by using the following options with a dataset\n"); fprintf(stdout, " attribute. Subsetting is done by selecting a hyperslab from the data.\n"); @@ -3638,37 +3642,32 @@ parse_subset_params(char *dset) struct subset_t *s = NULL; register char *brace; - if ((brace = strrchr(dset, '[')) != NULL) { - char *slash = strrchr(dset, '/'); + if (!disable_compact_subset && ((brace = strrchr(dset, '[')) != NULL)) { + *brace++ = '\0'; - /* sanity check to make sure the [ isn't part of the dataset name */ - if (brace > slash) { - *brace++ = '\0'; + s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); + parse_hsize_list(brace, &s->start); - s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); - parse_hsize_list(brace, &s->start); + while (*brace && *brace != ';') + brace++; - while (*brace && *brace != ';') - brace++; + if (*brace) brace++; - if (*brace) brace++; + parse_hsize_list(brace, &s->stride); - parse_hsize_list(brace, &s->stride); + while (*brace && *brace != ';') + brace++; - while (*brace && *brace != ';') - brace++; + if (*brace) brace++; - if (*brace) brace++; + parse_hsize_list(brace, &s->count); - parse_hsize_list(brace, &s->count); + while (*brace && *brace != ';') + brace++; - while (*brace && *brace != ';') - brace++; + if (*brace) brace++; - if (*brace) brace++; - - parse_hsize_list(brace, &s->block); - } + parse_hsize_list(brace, &s->block); } return s; @@ -4541,6 +4540,9 @@ end_collect: case 'E': enable_error_stack = TRUE; break; + case 'C': + disable_compact_subset = TRUE; + break; case 'h': usage(h5tools_getprogname()); free_handler(hand, argc); diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 9083782..ca16c42 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tno-subset.ddl b/tools/testfiles/tno-subset.ddl new file mode 100644 index 0000000..11aa264 --- /dev/null +++ b/tools/testfiles/tno-subset.ddl @@ -0,0 +1,9 @@ +HDF5 "tno-subset.h5" { +DATASET "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 1, 1 ) / ( 1, 1 ) } + DATA { + (0,0): 0 + } +} +} diff --git a/tools/testfiles/tno-subset.h5 b/tools/testfiles/tno-subset.h5 Binary files differnew file mode 100644 index 0000000..e6b6f57 --- /dev/null +++ b/tools/testfiles/tno-subset.h5 diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl index 9083782..ca16c42 100644 --- a/tools/testfiles/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/tnofilename-with-packed-bits.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tnofilename.ddl b/tools/testfiles/tnofilename.ddl index da79fbc..f9bd972 100644 --- a/tools/testfiles/tnofilename.ddl +++ b/tools/testfiles/tnofilename.ddl @@ -34,6 +34,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. @@ -71,7 +73,7 @@ usage: h5dump [OPTIONS] file 1) Attribute foo of the group /bar_none in file quux.h5 - h5dump -a /bar_none/foo quux.h5 + h5dump -a /bar_none/foo quux.h5 2) Selecting a subset from dataset /foo in file quux.h5 diff --git a/tools/testfiles/tpbitsIncomplete.ddl b/tools/testfiles/tpbitsIncomplete.ddl index 4307bed..88dac0a 100644 --- a/tools/testfiles/tpbitsIncomplete.ddl +++ b/tools/testfiles/tpbitsIncomplete.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsLengthExceeded.ddl b/tools/testfiles/tpbitsLengthExceeded.ddl index 4b50e70..35055f4 100644 --- a/tools/testfiles/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/tpbitsLengthExceeded.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsLengthPositive.ddl b/tools/testfiles/tpbitsLengthPositive.ddl index c648c02..3daeab4 100644 --- a/tools/testfiles/tpbitsLengthPositive.ddl +++ b/tools/testfiles/tpbitsLengthPositive.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsMaxExceeded.ddl b/tools/testfiles/tpbitsMaxExceeded.ddl index 8c6e8e1..2b3b68f 100644 --- a/tools/testfiles/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/tpbitsMaxExceeded.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsOffsetExceeded.ddl b/tools/testfiles/tpbitsOffsetExceeded.ddl index e594d27..6ccdc26 100644 --- a/tools/testfiles/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/tpbitsOffsetExceeded.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. diff --git a/tools/testfiles/tpbitsOffsetNegative.ddl b/tools/testfiles/tpbitsOffsetNegative.ddl index 833e47a..eb41bd7 100644 --- a/tools/testfiles/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/tpbitsOffsetNegative.ddl @@ -40,6 +40,8 @@ usage: h5dump [OPTIONS] file E.g., to dump a file called `-f', use h5dump -- -f --enable-error-stack Prints messages from the HDF5 error stack as they occur. + --no-compact-subset Disable compact form of subsetting and allow the use + of "[" in datset names. Subsetting is available by using the following options with a dataset attribute. Subsetting is done by selecting a hyperslab from the data. |