summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2012-03-09 20:34:37 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2012-03-09 20:34:37 (GMT)
commit0a46593a382259ac39df2e317609d21c32160317 (patch)
treeaa943f539bf055fc760e5c8cf6a66bc4cc84e673 /tools/lib
parent3ac8dfa8b7a8f9b5e22a9ac6812a2ba9a5a9f730 (diff)
downloadhdf5-0a46593a382259ac39df2e317609d21c32160317.zip
hdf5-0a46593a382259ac39df2e317609d21c32160317.tar.gz
hdf5-0a46593a382259ac39df2e317609d21c32160317.tar.bz2
[svn-r22038] Purpose:
Fix for HDFFV-7835 h5diff: incorrect result for comparing the two same type symlinks as dangling links. Description: When two symbolic dangling links are compared with --follow-symlinks option, the result should be same. It works for comparing two files, but didn't work for comparing two objects. Test cases were added and tagged with jira#. Tested: jam (linux32-LE), koala (linux64-LE), ostrich (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Windows (32-LE cmake), Cmake (jam)
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index bc8acd5..c6353eb 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -644,8 +644,8 @@ hsize_t h5diff(const char *fname1,
char filenames[2][MAX_FILENAME];
hsize_t nfound = 0;
int i;
- //int i1, i2;
- int l_ret;
+ int l_ret1 = -1;
+ int l_ret2 = -1;
const char * obj1fullname = NULL;
const char * obj2fullname = NULL;
/* init to group type */
@@ -862,6 +862,10 @@ hsize_t h5diff(const char *fname1,
}
+ /* get any symbolic links info */
+ l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, TRUE);
+ l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, TRUE);
+
/*---------------------------------------------
* check for following symlinks
*/
@@ -874,13 +878,12 @@ hsize_t h5diff(const char *fname1,
/*-------------------------------
* check symbolic link (object1)
*/
- l_ret = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, TRUE);
/* dangling link */
- if (l_ret == 0)
+ if (l_ret1 == 0)
{
if (options->no_dangle_links)
{
- /* gangling link is error */
+ /* treat dangling link is error */
if(options->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname);
options->err_stat = 1;
@@ -890,30 +893,33 @@ hsize_t h5diff(const char *fname1,
{
if(options->m_verbose)
parallel_print("obj1 <%s> is a dangling link.\n", obj1fullname);
- nfound++;
- print_found(nfound);
- goto out;
+ if (l_ret1 != 0 || l_ret2 != 0)
+ {
+ nfound++;
+ print_found(nfound);
+ goto out;
+ }
}
}
- else if(l_ret < 0) /* fail */
+ else if(l_ret1 < 0) /* fail */
{
parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1);
options->err_stat = 1;
goto out;
}
- else if(l_ret != 2) /* symbolic link */
+ else if(l_ret1 != 2) /* symbolic link */
obj1type = trg_linfo1.trg_type;
/*-------------------------------
* check symbolic link (object2)
*/
- l_ret = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, TRUE);
+
/* dangling link */
- if (l_ret == 0)
+ if (l_ret2 == 0)
{
if (options->no_dangle_links)
{
- /* gangling link is error */
+ /* treat dangling link is error */
if(options->m_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname);
options->err_stat = 1;
@@ -923,18 +929,21 @@ hsize_t h5diff(const char *fname1,
{
if(options->m_verbose)
parallel_print("obj2 <%s> is a dangling link.\n", obj2fullname);
- nfound++;
- print_found(nfound);
- goto out;
+ if (l_ret1 != 0 || l_ret2 != 0)
+ {
+ nfound++;
+ print_found(nfound);
+ goto out;
+ }
}
}
- else if(l_ret < 0) /* fail */
+ else if(l_ret2 < 0) /* fail */
{
parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2);
options->err_stat = 1;
goto out;
}
- else if(l_ret != 2) /* symbolic link */
+ else if(l_ret2 != 2) /* symbolic link */
obj2type = trg_linfo2.trg_type;
} /* end of if follow symlinks */
@@ -947,8 +956,10 @@ hsize_t h5diff(const char *fname1,
if(!(options->m_verbose || options->m_report))
{
- if (h5tools_is_obj_same(file1_id,obj1fullname,file2_id,obj2fullname)!=0)
- goto out;
+ /* if no danglink links */
+ if ( l_ret1 > 0 && l_ret2 > 0 )
+ if (h5tools_is_obj_same(file1_id,obj1fullname,file2_id,obj2fullname)!=0)
+ goto out;
}