defined, and were subsequently saved.
+Fri Feb 20 14:37:41 WAST 2004 John Darrington <john@darrington.wattle.id.au>
+
+ * compute.c: Fixed a bug where the Format was not getting set for
+ computed variables (thus causing a crash when SAVEing).
+
+ * Added a test to stop this bug ever coming back
+
Wed Feb 18 22:21:35 2004 Ben Pfaff <blp@gnu.org>
Got rid of approx.h. In general, replaced all references to
{
compute->variable = dict_lookup_var (default_dict, lvalue->var_name);
if (compute->variable == NULL)
- compute->variable = dict_create_var_assert (default_dict,
- lvalue->var_name, 0);
+ {
+ struct fmt_spec input_spec = { 0,8,2 };
+ compute->variable = dict_create_var_assert (default_dict,
+ lvalue->var_name, 0);
+
+ convert_fmt_ItoO (&input_spec, &compute->variable->print);
+ compute->variable->write = compute->variable->print;
+ }
+
compute->fv = compute->variable->fv;
compute->width = compute->variable->width;
+
+
/* Goofy behavior, but compatible: Turn off LEAVE. */
if (dict_class_from_id (compute->variable->name) != DC_SCRATCH)
compute->variable->reinit = 1;
command/t-test-groups.sh \
command/weight.sh \
bugs/alpha-freq.sh \
+ bugs/compute-fmt.sh \
bugs/double-frequency.sh \
bugs/html-frequency.sh \
bugs/crosstabs.sh \
bugs/data-crash.sh \
- bugs/random.sh
+ bugs/random.sh
noinst_PROGRAMS = gengarbage
--- /dev/null
+#!/bin/sh
+
+# This program tests for a bug which caused a crash after SAVE FILE
+# was called on a COMPUTEd variable
+
+
+TEMPDIR=/tmp/pspp-tst-$$
+
+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 > $TEMPDIR/foo.sps <<EOF
+INPUT PROGRAM.
+ COMPUTE num = 3.
+END FILE.
+END INPUT PROGRAM.
+EXECUTE.
+
+SAVE outfile='$TEMPDIR/temp.sav'.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+$SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/foo.sps
+if [ $? -ne 0 ] ; then fail; fi
+
+
+
+pass;