+Fri Feb 25 21:11:35 WST 2005 John Darrington <john@darrington.wattle.id.au>
+
+ * sfm-read.c: Fixed a buglet which caused a crash when trying
+ to read a non-existent file.
+
Sun Feb 13 16:11:13 2005 Ben Pfaff <blp@gnu.org>
Fix Bug #11955.
if (r->fh != NULL)
fh_close (r->fh, "system file", "rs");
- if (fn_close (handle_get_filename (r->fh), r->file) == EOF)
- msg (ME, _("%s: Closing system file: %s."),
- handle_get_filename (r->fh), strerror (errno));
+
+ if ( r->file ) {
+ if (fn_close (handle_get_filename (r->fh), r->file) == EOF)
+ msg (ME, _("%s: Closing system file: %s."),
+ handle_get_filename (r->fh), strerror (errno));
+ r->file = NULL;
+ }
free (r->vars);
free (r->buf);
free (r);
bugs/double-frequency.sh \
bugs/get.sh \
bugs/examine-1sample.sh \
+ bugs/get-no-file.sh \
bugs/html-frequency.sh \
bugs/if_crash.sh \
bugs/multipass.sh \
--- /dev/null
+#!/bin/sh
+
+# This program tests for a bug which caused a crash when
+# GET specified a non-existent file
+
+TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
+
+here=`pwd`;
+
+# ensure that top_srcdir is absolute
+cd $top_srcdir; top_srcdir=`pwd`
+
+export STAT_CONFIG_PATH=$top_srcdir/config
+
+
+cleanup()
+{
+ rm -rf $TEMPDIR
+}
+
+
+fail()
+{
+ echo $activity
+ echo FAILED
+ cleanup;
+ exit 1;
+}
+
+
+no_result()
+{
+ echo $activity
+ echo NO RESULT;
+ cleanup;
+ exit 2;
+}
+
+pass()
+{
+ cleanup;
+ exit 0;
+}
+
+mkdir -p $TEMPDIR
+
+cd $TEMPDIR
+
+activity="create program"
+cat > $TESTFILE <<EOF
+GET /FILE='$TEMPDIR/no-file.xx'.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+# The command should produce a warning. Not an error.
+# We use the stdinput here, because the bug seems to manifest itself only in
+# interactive mode.
+activity="run program"
+cat $TESTFILE | $SUPERVISOR $here/../src/pspp -o raw-ascii > /dev/null
+if [ $? -ne 0 ] ; then fail ; fi
+
+pass