From 507c37f9590b890aa36e020e93aecd92bff774a3 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 14 May 2005 00:25:28 +0000 Subject: [PATCH] Fixed bug 13082 --- src/ChangeLog | 5 +++ src/dfm-read.c | 2 +- tests/Makefile.am | 1 + tests/bugs/input-crash.sh | 75 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100755 tests/bugs/input-crash.sh diff --git a/src/ChangeLog b/src/ChangeLog index bf73f10b..38401f8d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +Sat May 14 08:22:26 WST 2005 John Darrington + + * dfm-read.c: Fixed polarity of test in dfm-close-reader. Closes + Bug #13082 + Tue May 10 20:08:18 2005 Ben Pfaff * data-in.c: (data_in) Add assertion to check input specifier. diff --git a/src/dfm-read.c b/src/dfm-read.c index a293cb5f..32b458e0 100644 --- a/src/dfm-read.c +++ b/src/dfm-read.c @@ -78,7 +78,7 @@ dfm_close_reader (struct dfm_reader *r) assert (inline_open_cnt > 0); still_open = --inline_open_cnt; - if (!still_open) + if (still_open) { /* Skip any remaining data on the inline file. */ while ((r->flags & DFM_EOF) == 0) diff --git a/tests/Makefile.am b/tests/Makefile.am index e124e1aa..64c1680a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -65,6 +65,7 @@ TESTS = \ bugs/get-no-file.sh \ bugs/html-frequency.sh \ bugs/if_crash.sh \ + bugs/input-crash.sh \ bugs/lag_crash.sh \ bugs/match-files-scratch.sh \ bugs/multipass.sh \ diff --git a/tests/bugs/input-crash.sh b/tests/bugs/input-crash.sh new file mode 100755 index 00000000..18461c00 --- /dev/null +++ b/tests/bugs/input-crash.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +# This program tests for a bug which caused a crash when +# reading invalid INPUT PROGRAM syntax. + +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() +{ + if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then + echo "NOT cleaning $TEMPDIR" + return ; + fi + 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 test program" +cat > $TESTFILE < /dev/null +if [ $? -ne 1 ] ; then fail ; fi + + + +pass; -- 2.30.2