From 26cab92853adc480d0d72bd845fafa229a97becc Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Wed, 21 Mar 2012 13:56:36 -0500 Subject: [svn-r22108] Purpose: HDFFV-7523 JPSS: h5dump fails to open an attribute when using the -a option to specify an attribute with a slash in the name Description: Update command line help page and test generating file. Previous commits: r22052, r22063 Tested: jam (linux32-LE), koala (linux64-LE), cmake (jam) --- tools/h5dump/h5dump.c | 7 +++++++ tools/h5dump/h5dumpgentest.c | 2 +- tools/testfiles/h5dump-help.txt | 7 +++++++ tools/testfiles/tnofilename-with-packed-bits.ddl | 7 +++++++ tools/testfiles/tpbitsIncomplete.ddl | 7 +++++++ tools/testfiles/tpbitsLengthExceeded.ddl | 7 +++++++ tools/testfiles/tpbitsLengthPositive.ddl | 7 +++++++ tools/testfiles/tpbitsMaxExceeded.ddl | 7 +++++++ tools/testfiles/tpbitsOffsetExceeded.ddl | 7 +++++++ tools/testfiles/tpbitsOffsetNegative.ddl | 7 +++++++ 10 files changed, 64 insertions(+), 1 deletion(-) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 650846a..2799d95 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -243,6 +243,9 @@ usage(const char *prog) HDfprintf(rawoutstream, " -e, --escape Escape non printing characters\n"); HDfprintf(rawoutstream, " -V, --version Print version number and exit\n"); HDfprintf(rawoutstream, " -a P, --attribute=P Print the specified attribute\n"); + HDfprintf(rawoutstream, " If an attribute name contains a slash (/), escape the\n"); + HDfprintf(rawoutstream, " slash with a preceding backslash (\\).\n"); + HDfprintf(rawoutstream, " (See example section below.)\n"); HDfprintf(rawoutstream, " -d P, --dataset=P Print the specified dataset\n"); HDfprintf(rawoutstream, " -y, --noindex Do not print array indices with the data\n"); HDfprintf(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); @@ -316,6 +319,10 @@ usage(const char *prog) HDfprintf(rawoutstream, "\n"); HDfprintf(rawoutstream, " h5dump -a /bar_none/foo quux.h5\n"); HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " Attribute \"high/low\" of the group /bar_none in the file quux.h5\n"); + HDfprintf(rawoutstream, "\n"); + HDfprintf(rawoutstream, " h5dump -a \"/bar_none/high\\/low\" quux.h5\n"); + HDfprintf(rawoutstream, "\n"); HDfprintf(rawoutstream, " 2) Selecting a subset from dataset /foo in file quux.h5\n"); HDfprintf(rawoutstream, "\n"); HDfprintf(rawoutstream, " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n"); diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 5b97434..b28f3de 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -426,7 +426,7 @@ gent_attribute(void) /* attribute 1 */ dims[0] = 24; space = H5Screate_simple(1, dims, NULL); - attr = H5Acreate2(root, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); + attr = H5Acreate2(root, "/attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); sprintf(buf, "attribute of root group"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index f04ed48..d8551ca 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] files -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -d P, --dataset=P Print the specified dataset -y, --noindex Do not print array indices with the data -p, --properties Print dataset filters, storage layout and fill value @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] files h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" quux.h5 + 2) Selecting a subset from dataset /foo in file quux.h5 h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5 diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl index d3b12e3..050a3a3 100644 --- a/tools/testfiles/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/tnofilename-with-packed-bits.ddl @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] files -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -d P, --dataset=P Print the specified dataset -y, --noindex Do not print array indices with the data -p, --properties Print dataset filters, storage layout and fill value @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] files h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" quux.h5 + 2) Selecting a subset from dataset /foo in file quux.h5 h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5 diff --git a/tools/testfiles/tpbitsIncomplete.ddl b/tools/testfiles/tpbitsIncomplete.ddl index 0da055b..5608d2b 100644 --- a/tools/testfiles/tpbitsIncomplete.ddl +++ b/tools/testfiles/tpbitsIncomplete.ddl @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] files -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -d P, --dataset=P Print the specified dataset -y, --noindex Do not print array indices with the data -p, --properties Print dataset filters, storage layout and fill value @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] files h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" quux.h5 + 2) Selecting a subset from dataset /foo in file quux.h5 h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5 diff --git a/tools/testfiles/tpbitsLengthExceeded.ddl b/tools/testfiles/tpbitsLengthExceeded.ddl index 594d70c..f89b65f 100644 --- a/tools/testfiles/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/tpbitsLengthExceeded.ddl @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] files -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -d P, --dataset=P Print the specified dataset -y, --noindex Do not print array indices with the data -p, --properties Print dataset filters, storage layout and fill value @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] files h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" quux.h5 + 2) Selecting a subset from dataset /foo in file quux.h5 h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5 diff --git a/tools/testfiles/tpbitsLengthPositive.ddl b/tools/testfiles/tpbitsLengthPositive.ddl index 7b3b678..ba32aa6 100644 --- a/tools/testfiles/tpbitsLengthPositive.ddl +++ b/tools/testfiles/tpbitsLengthPositive.ddl @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] files -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -d P, --dataset=P Print the specified dataset -y, --noindex Do not print array indices with the data -p, --properties Print dataset filters, storage layout and fill value @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] files h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" quux.h5 + 2) Selecting a subset from dataset /foo in file quux.h5 h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5 diff --git a/tools/testfiles/tpbitsMaxExceeded.ddl b/tools/testfiles/tpbitsMaxExceeded.ddl index 60bc2b1..16f953d 100644 --- a/tools/testfiles/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/tpbitsMaxExceeded.ddl @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] files -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -d P, --dataset=P Print the specified dataset -y, --noindex Do not print array indices with the data -p, --properties Print dataset filters, storage layout and fill value @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] files h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" quux.h5 + 2) Selecting a subset from dataset /foo in file quux.h5 h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5 diff --git a/tools/testfiles/tpbitsOffsetExceeded.ddl b/tools/testfiles/tpbitsOffsetExceeded.ddl index 5db6a91..446fe2d 100644 --- a/tools/testfiles/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/tpbitsOffsetExceeded.ddl @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] files -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -d P, --dataset=P Print the specified dataset -y, --noindex Do not print array indices with the data -p, --properties Print dataset filters, storage layout and fill value @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] files h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" quux.h5 + 2) Selecting a subset from dataset /foo in file quux.h5 h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5 diff --git a/tools/testfiles/tpbitsOffsetNegative.ddl b/tools/testfiles/tpbitsOffsetNegative.ddl index 060fc37..747cf99 100644 --- a/tools/testfiles/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/tpbitsOffsetNegative.ddl @@ -10,6 +10,9 @@ usage: h5dump [OPTIONS] files -e, --escape Escape non printing characters -V, --version Print version number and exit -a P, --attribute=P Print the specified attribute + If an attribute name contains a slash (/), escape the + slash with a preceding backslash (\). + (See example section below.) -d P, --dataset=P Print the specified dataset -y, --noindex Do not print array indices with the data -p, --properties Print dataset filters, storage layout and fill value @@ -81,6 +84,10 @@ usage: h5dump [OPTIONS] files h5dump -a /bar_none/foo quux.h5 + Attribute "high/low" of the group /bar_none in the file quux.h5 + + h5dump -a "/bar_none/high\/low" quux.h5 + 2) Selecting a subset from dataset /foo in file quux.h5 h5dump -d /foo -s "0,1" -S "1,1" -c "2,3" -k "2,2" quux.h5 -- cgit v0.12