diff options
author | John Mainzer <mainzer@hdfgroup.org> | 2008-11-27 04:48:40 (GMT) |
---|---|---|
committer | John Mainzer <mainzer@hdfgroup.org> | 2008-11-27 04:48:40 (GMT) |
commit | 53fcc77e7d077f1a9ca17d63787634baa1d2893c (patch) | |
tree | 8712d00af172c5aa7c3e65e732ef57eec1c5b40f /tools/h5recover/h5recover.c | |
parent | 230a3eff621be4d8954feceb4565a45249a465f0 (diff) | |
download | hdf5-53fcc77e7d077f1a9ca17d63787634baa1d2893c.zip hdf5-53fcc77e7d077f1a9ca17d63787634baa1d2893c.tar.gz hdf5-53fcc77e7d077f1a9ca17d63787634baa1d2893c.tar.bz2 |
[svn-r16136] Several changes:
Modified H5C2_journal_post_flush() write the super block and flush
the file before truncating the journal. Failure to do this opened
a window in which the application could crash leaving the HDF5 file
in a state that was un-recoverable.
The hope is that this will fix the file recovery bug observed on
RSQ -- but I have not been able to test there. However, I was able
to generate a similar bug on Linew, and this fix seems to deal with
the Linew bug.
Added a third test to the h5recovery tests. This is really
a test for the library, but it was easier to use existing test
code there to construct the new test.
The new test runs the same application repeatedly, but setting a
timer to crash the application at progressively later times. The object
is to search for windows in which the application leaves the HDF5 file
in an un-recoverable state.
Also, updated H5recover.c to use HDstrtoll() instead of HDstrtod()
to read some addresses and such from the journal file.
Tested serial (debug) on Phoenix and Linew, and parallel (debug)
on Jam.
Diffstat (limited to 'tools/h5recover/h5recover.c')
-rw-r--r-- | tools/h5recover/h5recover.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/tools/h5recover/h5recover.c b/tools/h5recover/h5recover.c index 2c3a3b3..9be4f30 100644 --- a/tools/h5recover/h5recover.c +++ b/tools/h5recover/h5recover.c @@ -563,7 +563,7 @@ main (int argc, const char *argv[]) } /* end for */ - size = HDstrtod(tok[3], NULL); + size = (size_t)HDstrtoll(tok[3], NULL, 10); if (max_size < size) { @@ -587,15 +587,30 @@ main (int argc, const char *argv[]) fgets(temp, 100, journal_fp); p = &temp[11]; - - eoa = HDstrtod(p, NULL); + + /* according to the man page, strtoll() should accept a + * "0x" prefix on any base 16 value -- seems this is + * not the case. Deal with this by incrementing p + * past the prefix. + */ + + while ( HDisspace(*(p)) ) { p++; } + + if ( ( *(p) == '0' ) && + ( *(p + 1) == 'x' ) ) { + + p += 2; + } + + eoa = (haddr_t)HDstrtoll(p, NULL, 16); if (eoa == 0) { - error_msg(progname, "Could not convert eoa to integer\n"); + error_msg(progname, + "Could not convert eoa to integer\n"); leave( EXIT_FAILURE); } /* end if */ - + if (update_eoa < eoa) { update_eoa = eoa; @@ -851,7 +866,19 @@ main (int argc, const char *argv[]) if ( verbose ) printf("Converting data from character strings.\n"); /* convert address from character character string */ - address = HDstrtod(tok[6], NULL); + + /* according to the man page, strtoll() should accept a + * "0x" prefix on any base 16 value -- seems this is + * not the case. Deal with this by incrementing tok[6] + * past the prefix. + */ + while ( HDisspace(*(tok[6])) ) { (tok[6])++; } + if ( ( *(tok[6]) == '0' ) && + ( *(tok[6] + 1) == 'x' ) ) { + + (tok[6]) += 2; + } + address = (off_t)HDstrtoll(tok[6], NULL, 16); if (address == 0) { error_msg(progname, "Could not convert address to integer\n"); @@ -862,7 +889,7 @@ main (int argc, const char *argv[]) if ( verbose ) printf(" address : %llx\n", address); /* convert size from character string*/ - size = HDstrtod(tok[4], NULL); + size = (size_t)HDstrtoll(tok[4], NULL, 10); if (size == 0) { error_msg(progname, "Could not convert size to double\n"); |