From: Ben Pfaff Date: Thu, 12 Jul 2007 04:30:11 +0000 (+0000) Subject: (map_case): Create destination case instead of leaving it X-Git-Tag: v0.6.0~392 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=077c3c1774fd75627783b407169d6884adcbe663;p=pspp-builds.git (map_case): Create destination case instead of leaving it undefined. Fixes bug #20285. Reviewed by John Darrington. --- diff --git a/src/language/data-io/ChangeLog b/src/language/data-io/ChangeLog index f22711ce..ef323512 100644 --- a/src/language/data-io/ChangeLog +++ b/src/language/data-io/ChangeLog @@ -1,3 +1,9 @@ +2007-07-11 Ben Pfaff + + * get.c (map_case): Create destination case instead of leaving it + undefined. Fixes bug #20285. + Reviewed by John Darrington. + 2007-06-06 Ben Pfaff * get.c: Essentially rewrite MATCH FILES to support FIRST and diff --git a/src/language/data-io/get.c b/src/language/data-io/get.c index 4665c6fb..dbda3662 100644 --- a/src/language/data-io/get.c +++ b/src/language/data-io/get.c @@ -1423,6 +1423,7 @@ map_case (const struct case_map *map, { size_t dst_idx; + case_create (dst, map->value_cnt); for (dst_idx = 0; dst_idx < map->value_cnt; dst_idx++) { int src_idx = map->map[dst_idx]; diff --git a/src/libpspp/ChangeLog b/src/libpspp/ChangeLog index e92778cb..8c8e30c2 100644 --- a/src/libpspp/ChangeLog +++ b/src/libpspp/ChangeLog @@ -1,3 +1,8 @@ +2007-07-06 Ben Pfaff + + * copyleft.c (legal): Update startup notice to use format + recommended by latest GNU coding standards. + 2007-06-06 Ben Pfaff * array.c (binary_search): Fix assertion. diff --git a/tests/automake.mk b/tests/automake.mk index aead28ae..a67be09c 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -81,6 +81,7 @@ dist_TESTS = \ tests/bugs/alpha-freq.sh \ tests/bugs/big-input.sh \ tests/bugs/big-input-2.sh \ + tests/bugs/case-map.sh \ tests/bugs/comment-at-eof.sh \ tests/bugs/compute-fmt.sh \ tests/bugs/compression.sh \ diff --git a/tests/bugs/case-map.sh b/tests/bugs/case-map.sh new file mode 100755 index 00000000..479aea9c --- /dev/null +++ b/tests/bugs/case-map.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +# This program tests for a bug which caused a crash when +# a non-empty case_map was created in SAVE. + + +TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/`basename $0`.sps + +# ensure that top_builddir are absolute +if [ -z "$top_builddir" ] ; then top_builddir=. ; fi +if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi +top_builddir=`cd $top_builddir; pwd` +PSPP=$top_builddir/src/ui/terminal/pspp + +# ensure that top_srcdir is absolute +top_srcdir=`cd $top_srcdir; pwd` + +STAT_CONFIG_PATH=$top_srcdir/config +export STAT_CONFIG_PATH + + +cleanup() +{ + cd / + 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 <