diff options
author | James Laird <jlaird@hdfgroup.org> | 2004-07-20 00:52:28 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2004-07-20 00:52:28 (GMT) |
commit | 1b0b9048b75f333ff923cb440e30f3d6e1a96c42 (patch) | |
tree | 6651bd4de9aa288b1fbd09975b11af26d7f2489f | |
parent | b79142ca2b750b6d45e636bb138fc947a0b92e3f (diff) | |
download | hdf5-1b0b9048b75f333ff923cb440e30f3d6e1a96c42.zip hdf5-1b0b9048b75f333ff923cb440e30f3d6e1a96c42.tar.gz hdf5-1b0b9048b75f333ff923cb440e30f3d6e1a96c42.tar.bz2 |
[svn-r8898]
Purpose:
Bug Fix
Description:
Trying to create the root group or the working group ("/" or ".") fakes out
HDF5 so that it neither creates a group nor returns an error.
Solution:
H5G_namei now throws an error if it was supposed to insert but didn't.
Platforms tested:
sleipnir, Visual Studio 7 (very minor change)
-rw-r--r-- | release_docs/RELEASE.txt | 21 | ||||
-rw-r--r-- | src/H5G.c | 7 | ||||
-rw-r--r-- | test/stab.c | 11 |
3 files changed, 31 insertions, 8 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 070007c..4b4ee3a 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -41,14 +41,6 @@ New Features Library: -------- - - A new API function H5Fget_name was added. It returns the name - of the file by object(file, group, data set, named data type, - attribute) ID. SLU - 2004/06/29 - - A new API function H5Fget_filesize was added. It returns the - actual file size of the opened file. SLU - 2004/06/24 - - Added option that if $HDF5_DISABLE_VERSION_CHECK is set to 2, - will suppress all library version mismatch warning messages. - AKC - 2004/4/14 - HDF5 can now link to SZIP with or without szip's encoder. The new API function H5Zget_filter_info can be used to check szip's status. Attempting to assign szip to a dataset property @@ -58,6 +50,14 @@ New Features be set when calling H5Pset_szip. If the flag for CHIP compression is set, it will be ignored (since the two are mutually exclusive). JL/NF - 2004/6/30 + - A new API function H5Fget_name was added. It returns the name + of the file by object(file, group, data set, named data type, + attribute) ID. SLU - 2004/06/29 + - A new API function H5Fget_filesize was added. It returns the + actual file size of the opened file. SLU - 2004/06/24 + - Added option that if $HDF5_DISABLE_VERSION_CHECK is set to 2, + will suppress all library version mismatch warning messages. + AKC - 2004/4/14 Parallel Library: ----------------- @@ -82,6 +82,11 @@ Bug Fixes since HDF5-1.6.2 release Library ------- + - Calling H5Gcreate() on "/" or "." throws an error instead of + failing quietly. JML - 2004/07/19 + - Fixed bug where setting file address size to be very small could + trigger an assert if the file grew to more than 64 KB. Now throws + an error and data can be recovered. JL/NF - 2004/07/14 - Fixed bug where "resurrecting" a dataset was failing. QAK - 2004/07/14 - Fixed bug where incorrect data could be read from a chunked dataset @@ -1393,6 +1393,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, unsigned null_grp; /* Flag to indicate this function was called with grp_ent set to NULL */ unsigned group_copy = 0; /* Flag to indicate that the group entry is copied */ unsigned last_comp = 0; /* Flag to indicate that a component is the last component in the name */ + unsigned did_insert = 0; /* Flag to indicate that H5G_stab_insert was called */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5G_namei); @@ -1515,6 +1516,7 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, } } /* end if */ else { + did_insert = 1; if (H5G_stab_insert(grp_ent, H5G_comp_g, ent, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert name"); HGOTO_DONE(SUCCEED); @@ -1551,6 +1553,11 @@ H5G_namei(H5G_entry_t *loc_ent, const char *name, const char **rest/*out*/, if (rest) *rest = name; /*final null */ + /* If this was an insert, make sure that the insert function was actually + * called (this catches no-op names like "/" and ".") */ + if(action == H5G_NAMEI_INSERT && !did_insert) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group already exists"); + done: /* If we started with a NULL obj_ent, free the entry information */ if(null_obj) diff --git a/test/stab.c b/test/stab.c index 1c43760..6ce9871 100644 --- a/test/stab.c +++ b/test/stab.c @@ -81,6 +81,17 @@ test_misc(hid_t file) if (H5Gclose(g2)<0) goto error; if (H5Gclose(g3)<0) goto error; + /* Check that creating groups with no-op names isn't allowed */ + H5E_BEGIN_TRY { + g1=H5Gcreate(file, "/", 0); + } H5E_END_TRY + if(g1 >= 0) goto error; + + H5E_BEGIN_TRY { + g1=H5Gcreate(file, "./././", 0); + } H5E_END_TRY + if(g1 >= 0) goto error; + PASSED(); return 0; |