summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release_docs/RELEASE.txt10
-rw-r--r--src/H5.c16
-rw-r--r--test/testcheck_version.sh.in105
3 files changed, 100 insertions, 31 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index b914b06..f89dee9 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -60,6 +60,16 @@ New Features
Library:
--------
+ - The embedded library information is displayed by H5check_version() if a
+ version mismatch is detected. Also changed H5check_version() to
+ suppress the warning message totally if $HDF5_DISABLE_VERSION_CHECK is 2
+ or higher. (Old behavior treated 3 or higher the same as 1, that is
+ print a warning and allows the program to continue.
+ - Added a new feature that have the library information in the file
+ libhdf5.settings embedded in the hdf5 library and statically linked
+ executables. If a user does not care for the extra library information
+ in the executable, he may turn it off by --disable-embedded-libinfo
+ during configure. (AKC - 2009/9/15)
- Corrected problem where library would re-write the superblock in a file
opened for R/W access, even when no changes were made to the file.
(QAK - 2009/08/20, Bz#1473)
diff --git a/src/H5.c b/src/H5.c
index f11e8b7..4041483 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -621,7 +621,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
char lib_str[256];
char substr[] = H5_VERS_SUBRELEASE;
static int checked = 0; /* If we've already checked the version info */
- static int disable_version_check = 0; /* Set if the version check should be disabled */
+ static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */
herr_t ret_value=SUCCEED; /* Return value */
static char *version_mismatch_warning=VERSION_MISMATCH_WARNING;
@@ -638,7 +638,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
s = HDgetenv ("HDF5_DISABLE_VERSION_CHECK");
if (s && HDisdigit(*s))
- disable_version_check = (int)HDstrtol (s, NULL, 0);
+ disable_version_check = (unsigned int)HDstrtol (s, NULL, 0);
}
if (H5_VERS_MAJOR!=majnum || H5_VERS_MINOR!=minnum ||
@@ -648,7 +648,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
HDfprintf(stderr, "%s%s", version_mismatch_warning,
"You can, at your own risk, disable this warning by setting the environment\n"
"variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n"
- "Setting it to 2 will suppress the warning messages totally.\n");
+ "Setting it to 2 or higher will suppress the warning messages totally.\n");
/* Mention the versions we are referring to */
HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n",
majnum, minnum, relnum,
@@ -659,12 +659,9 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
/* Bail out now. */
HDfputs ("Bye...\n", stderr);
HDabort ();
- case 2:
- /* continue silently */
- break;
- default:
+ case 1:
/* continue with a warning */
- /* Note that the warning message is embedded in the format string. */
+ /* Note that the warning message is embedded in the format string.*/
HDfprintf (stderr,
"%s'HDF5_DISABLE_VERSION_CHECK' "
"environment variable is set to %d, application will\n"
@@ -677,6 +674,9 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
/* Show library settings if available */
HDfprintf (stderr, "%s", H5libhdf5_settings);
break;
+ default:
+ /* 2 or higer: continue silently */
+ break;
} /* end switch */
} /* end if */
diff --git a/test/testcheck_version.sh.in b/test/testcheck_version.sh.in
index 15949e9..593a466 100644
--- a/test/testcheck_version.sh.in
+++ b/test/testcheck_version.sh.in
@@ -25,8 +25,18 @@ Shared_Lib=@enable_shared@
Static_Lib=@enable_static@
Static_exec=@STATIC_EXEC@
+CMP='cmp -s'
+DIFF='diff -c'
# Function definitions
+#
+# Show the purpose of this test script and a note about the abort messages.
+PURPOSE() {
+ echo "Tests for the H5check_version function."
+ echo "Note that abort messages may appear due to the expected termination"
+ echo "of the program when it is tested with mis-matched version numnbers."
+}
+
# Print a line-line message left justified in a field of 70 characters.
#
LINEMSG() {
@@ -40,6 +50,42 @@ SKIP() {
LINEMSG $*
echo " -SKIP-"
}
+
+
+# Print warning message of version mismatch.
+WarnMesg(){
+ echo "Warning! ***HDF5 library version mismatched error***"
+ echo "The HDF5 header files used to compile this application do not match"
+ echo "the version used by the HDF5 library to which this application is linked."
+ echo "Data corruption or segmentation faults may occur if the application continues."
+ echo "This can happen when an application was compiled by one version of HDF5 but"
+ echo "linked with a different version of static or shared HDF5 library."
+ echo "You should recompile the application or check your shared library related"
+ echo "settings such as 'LD_LIBRARY_PATH'."
+ echo "You can, at your own risk, disable this warning by setting the environment"
+ echo "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'."
+ echo "Setting it to 2 or higher will suppress the warning messages totally."
+ echo "Headers are $xxh5versmajor.$xxh5versminor.$xxh5versrelease, library is $h5versmajor.$h5versminor.$h5versrelease"
+ test -n "$H5_HAVE_EMBEDDED_LIBINFO" && cat $h5libsettings
+ echo "Bye..."
+}
+
+
+# Print warning message2 of version mismatch.
+WarnMesg2(){
+ echo "Warning! ***HDF5 library version mismatched error***"
+ echo "The HDF5 header files used to compile this application do not match"
+ echo "the version used by the HDF5 library to which this application is linked."
+ echo "Data corruption or segmentation faults may occur if the application continues."
+ echo "This can happen when an application was compiled by one version of HDF5 but"
+ echo "linked with a different version of static or shared HDF5 library."
+ echo "You should recompile the application or check your shared library related"
+ echo "settings such as 'LD_LIBRARY_PATH'."
+ echo "'HDF5_DISABLE_VERSION_CHECK' environment variable is set to 1, application will"
+ echo "continue at your own risk."
+ echo "Headers are $xxh5versmajor.$xxh5versminor.$xxh5versrelease, library is $h5versmajor.$h5versminor.$h5versrelease"
+ test -n "$H5_HAVE_EMBEDDED_LIBINFO" && cat $h5libsettings
+}
# Run a test and print PASS or *FAIL*. If a test fails then increment
@@ -77,6 +123,9 @@ TESTING() {
h5DisableVersion="$1"
wrongversionnumbers="$2"
+ xxh5versmajor=$h5versmajor
+ xxh5versminor=$h5versminor
+ xxh5versrelease=$h5versrelease
if [ "$h5DisableVersion" = unset ]; then
envcmd="" # noop
@@ -90,40 +139,52 @@ TESTING() {
expected_code=0
else
arguments=-t"$wrongversionnumbers"
+ # calculate mismatched version numbers by listing.
+ case $wrongversionnumbers in
+ "M") xxh5versmajor=`expr $h5versmajor + 1`
+ ;;
+ "m") xxh5versminor=`expr $h5versminor + 1`
+ ;;
+ "r") xxh5versrelease=`expr $h5versrelease + 1`
+ ;;
+ esac
case "$h5DisableVersion" in
- 2) # OK: No warning, exit 0
- cp /dev/null $expect
+ 1)
+ # W2/OK: Different Warning, exit 0.
+ WarnMesg2 > $expect
expected_code=0
;;
- [13-9]|[1-9][0-9]*)
- # W2/OK: Different Warning, exit 0.
- cp /dev/null $expect #NEED FIX
+ [2-9]|[1-9][0-9]*)
+ # OK: No warning, exit 0
+ cp /dev/null $expect
expected_code=0
;;
*) # W/A: Warning, abort and exit non-0.
- cp /dev/null $expect #NEED FIX
- expected_code=1 # non-zero since abort exit code maybe
- ;; # machine dependent.
+ WarnMesg > $expect
+ expected_code=134 # Signal Abort exit code (128+6)
+ ;;
esac
fi
# Run test.
LINEMSG $envcmd $TEST_NAME $arguments
(
- echo "#############################"
- echo "Expected output for $TEST_ERR"
- echo "#############################"
$envcmd $RUNSERIAL $TEST_BIN $arguments
) >$actual 2>$actual_err
ret_code=$?
+ cat $actual_err >> $actual
- if [ \( $expected_code -eq 0 -a $expected_code -eq $ret_code \) -o \
- \( $expected_code -ne 0 -a $ret_code -ne 0 \) ]; then
+ if [ \( $expected_code -ne $ret_code \) ]; then
+ echo "*FAILED*"
+ echo " Expected exit code ($expected_code) differs from actual code ($ret_code)"
+ nerrors="`expr $nerrors + 1`"
+ elif $CMP $expect $actual; then
echo " PASSED"
else
echo "*FAILED*"
- echo " Expected exit code ($expected_code) differs from actual code ($ret_code)"
+ echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
@@ -135,7 +196,7 @@ TESTING() {
# Echo parameters for debugging if verbose mode is on.
DEBUGPRINT() {
- if [ -n "$verbose" ]; then
+ if [ -n "$debugmode" ]; then
echo $*
fi
}
@@ -143,20 +204,18 @@ DEBUGPRINT() {
# MAIN Body
nerrors=0
+verbose=yes # default on
+debugmode= # default off
H5_HAVE_EMBEDDED_LIBINFO=`grep '#define H5_HAVE_EMBEDDED_LIBINFO ' ../src/H5pubconf.h`
+h5libsettings=../src/libhdf5.settings
+
+PURPOSE
# The build (current) directory might be different than the source directory.
if test -z "$srcdir"; then
srcdir=.
fi
-# Skip the rest if embedded-libinfo is not enabled.
-if [ -z "$H5_HAVE_EMBEDDED_LIBINFO" ]; then
- echo "embedded-libinfo is not enabled. Test skipped."
- exit 0
-fi
-h5libsettings=../src/libhdf5.settings
-
# Figure out library version numbers from the header file.
h5versmajor=`grep '#define H5_VERS_MAJOR' $srcdir/../src/H5public.h | cut -f2`
h5versminor=`grep '#define H5_VERS_MINOR' $srcdir/../src/H5public.h | cut -f2`
@@ -172,7 +231,7 @@ DEBUGPRINT $h5versmajor.$h5versminor.$h5versrelease
# HDF5_DISABLE_VERSION_CHECK, as unset, "", -1, 0, 1, 2, 3
for val_disable_version_check in unset "" -1 0 1 2 3; do
- for wrong_version in none M m r Mm Mr mr; do
+ for wrong_version in none M m r; do
TESTING "$val_disable_version_check" "$wrong_version"
done
done