diff options
author | James Laird <jlaird@hdfgroup.org> | 2004-07-20 00:47:37 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2004-07-20 00:47:37 (GMT) |
commit | 24d36e1613a38a6d99e9c81ecd6d83063aec11b3 (patch) | |
tree | 34ea787b798eba19cbf488ba377ac624293606a4 | |
parent | 4e13d7afd521a9775f5888a960f273fbc695b4a1 (diff) | |
download | hdf5-24d36e1613a38a6d99e9c81ecd6d83063aec11b3.zip hdf5-24d36e1613a38a6d99e9c81ecd6d83063aec11b3.tar.gz hdf5-24d36e1613a38a6d99e9c81ecd6d83063aec11b3.tar.bz2 |
[svn-r8897]
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)
Misc. update:
-rw-r--r-- | release_docs/RELEASE.txt | 17 | ||||
-rw-r--r-- | src/H5G.c | 7 | ||||
-rw-r--r-- | test/stab.c | 11 |
3 files changed, 31 insertions, 4 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 996e980..68d531c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -44,9 +44,17 @@ New Features Library: -------- + - Added support for SZIP without encoder. Added H5Zget_filter_info + and changed H5Pget_filter and H5Pget_filter_by_id to support this + change. JL/NF - 2004/06/30 + - SZIP always uses K13 compression. This flag no longer needs to + 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 + - Added support for user defined identifier types. NF/JL - 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 - New Feature of Data transformation is added. AKC - 2004/05/03. @@ -88,10 +96,6 @@ New Features field in the H5G_stat_t struct for testing if two objects are the same within a file. QAK - 2003/08/08 - Switched over to new error API. SLU - 2003/07/25 - - Added support for user defined identifier types. NF/JL - 2004/06/29 - - Added support for SZIP without encoder. Added H5Zget_filter_info - and changed H5Pget_filter and H5Pget_filter_by_id to support this - change. Parallel Library: ----------------- @@ -142,6 +146,11 @@ Bug Fixes since HDF5-1.6.0 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 @@ -1359,6 +1359,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); @@ -1481,6 +1482,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); @@ -1517,6 +1519,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..68c7630 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; |