From: John Darrington Date: Wed, 5 Jan 2005 00:32:16 +0000 (+0000) Subject: Added a test for reading/writing of portable files. X-Git-Tag: v0.4.0~206 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=071bf8498aaa74c71d56617b683c07466f78febb;p=pspp-builds.git Added a test for reading/writing of portable files. Fixed a bug which crashed PSPP if VALUE LABELS had a trailing slash. --- diff --git a/po/en_GB.po b/po/en_GB.po index b1a3ea93..4e60da85 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PSPP 0.3.1\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2005-01-01 18:55+0800\n" +"POT-Creation-Date: 2005-01-05 08:20+0800\n" "PO-Revision-Date: 2004-01-23 13:04+0800\n" "Last-Translator: John Darrington \n" "Language-Team: John Darrington \n" @@ -2115,11 +2115,11 @@ msgstr "" msgid "expecting %s" msgstr "" -#: src/lexer.c:556 src/val-labs.c:151 +#: src/lexer.c:556 src/val-labs.c:154 msgid "expecting string" msgstr "" -#: src/lexer.c:570 src/val-labs.c:160 +#: src/lexer.c:570 src/val-labs.c:163 msgid "expecting integer" msgstr "" @@ -2714,26 +2714,6 @@ msgstr "" msgid "Error opening page on %s device of %s class." msgstr "" -#: src/percentiles.c:38 -msgid "HAverage" -msgstr "" - -#: src/percentiles.c:39 -msgid "Weighted Average" -msgstr "" - -#: src/percentiles.c:40 -msgid "Rounded" -msgstr "" - -#: src/percentiles.c:41 -msgid "Empirical" -msgstr "" - -#: src/percentiles.c:42 -msgid "Empirical with averaging" -msgstr "" - #: src/permissions.c:75 #, c-format msgid "Expecting %s or %s." @@ -2875,44 +2855,44 @@ msgstr "" msgid "position %d: character `\\%03o' is not valid in a variable name." msgstr "" -#: src/pfm-read.c:748 +#: src/pfm-read.c:746 #, c-format msgid "Duplicate variable name %s." msgstr "" -#: src/pfm-read.c:792 +#: src/pfm-read.c:790 #, c-format msgid "Bad missing values for %s." msgstr "" -#: src/pfm-read.c:815 +#: src/pfm-read.c:813 #, c-format msgid "Weighting variable %s not present in dictionary." msgstr "" -#: src/pfm-read.c:886 +#: src/pfm-read.c:884 #, c-format msgid "Unknown variable %s while parsing value labels." msgstr "" -#: src/pfm-read.c:889 +#: src/pfm-read.c:887 #, c-format msgid "" "Cannot assign value labels to %s and %s, which have different variable types " "or widths." msgstr "" -#: src/pfm-read.c:922 +#: src/pfm-read.c:920 #, c-format msgid "Duplicate label for value %g for variable %s." msgstr "" -#: src/pfm-read.c:925 +#: src/pfm-read.c:923 #, c-format msgid "Duplicate label for value `%.*s' for variable %s." msgstr "" -#: src/pfm-read.c:978 +#: src/pfm-read.c:976 msgid "End of file midway through case." msgstr "" @@ -3780,19 +3760,19 @@ msgstr "" msgid "Document entered %s %02d:%02d:%02d by %s (%s):" msgstr "" -#: src/val-labs.c:115 +#: src/val-labs.c:118 #, c-format msgid "" "It is not possible to assign value labels to long string variables such as %" "s." msgstr "" -#: src/val-labs.c:164 +#: src/val-labs.c:167 #, c-format msgid "Value label `%g' is not integer." msgstr "" -#: src/val-labs.c:174 +#: src/val-labs.c:177 msgid "Truncating value label to 60 characters." msgstr "" diff --git a/po/pspp.pot b/po/pspp.pot index 9025987c..170e85d7 100644 --- a/po/pspp.pot +++ b/po/pspp.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n" -"POT-Creation-Date: 2005-01-01 18:55+0800\n" +"POT-Creation-Date: 2005-01-05 08:20+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2115,11 +2115,11 @@ msgstr "" msgid "expecting %s" msgstr "" -#: src/lexer.c:556 src/val-labs.c:151 +#: src/lexer.c:556 src/val-labs.c:154 msgid "expecting string" msgstr "" -#: src/lexer.c:570 src/val-labs.c:160 +#: src/lexer.c:570 src/val-labs.c:163 msgid "expecting integer" msgstr "" @@ -2714,26 +2714,6 @@ msgstr "" msgid "Error opening page on %s device of %s class." msgstr "" -#: src/percentiles.c:38 -msgid "HAverage" -msgstr "" - -#: src/percentiles.c:39 -msgid "Weighted Average" -msgstr "" - -#: src/percentiles.c:40 -msgid "Rounded" -msgstr "" - -#: src/percentiles.c:41 -msgid "Empirical" -msgstr "" - -#: src/percentiles.c:42 -msgid "Empirical with averaging" -msgstr "" - #: src/permissions.c:75 #, c-format msgid "Expecting %s or %s." @@ -2875,44 +2855,44 @@ msgstr "" msgid "position %d: character `\\%03o' is not valid in a variable name." msgstr "" -#: src/pfm-read.c:748 +#: src/pfm-read.c:746 #, c-format msgid "Duplicate variable name %s." msgstr "" -#: src/pfm-read.c:792 +#: src/pfm-read.c:790 #, c-format msgid "Bad missing values for %s." msgstr "" -#: src/pfm-read.c:815 +#: src/pfm-read.c:813 #, c-format msgid "Weighting variable %s not present in dictionary." msgstr "" -#: src/pfm-read.c:886 +#: src/pfm-read.c:884 #, c-format msgid "Unknown variable %s while parsing value labels." msgstr "" -#: src/pfm-read.c:889 +#: src/pfm-read.c:887 #, c-format msgid "" "Cannot assign value labels to %s and %s, which have different variable types " "or widths." msgstr "" -#: src/pfm-read.c:922 +#: src/pfm-read.c:920 #, c-format msgid "Duplicate label for value %g for variable %s." msgstr "" -#: src/pfm-read.c:925 +#: src/pfm-read.c:923 #, c-format msgid "Duplicate label for value `%.*s' for variable %s." msgstr "" -#: src/pfm-read.c:978 +#: src/pfm-read.c:976 msgid "End of file midway through case." msgstr "" @@ -3780,19 +3760,19 @@ msgstr "" msgid "Document entered %s %02d:%02d:%02d by %s (%s):" msgstr "" -#: src/val-labs.c:115 +#: src/val-labs.c:118 #, c-format msgid "" "It is not possible to assign value labels to long string variables such as %" "s." msgstr "" -#: src/val-labs.c:164 +#: src/val-labs.c:167 #, c-format msgid "Value label `%g' is not integer." msgstr "" -#: src/val-labs.c:174 +#: src/val-labs.c:177 msgid "Truncating value label to 60 characters." msgstr "" diff --git a/src/ChangeLog b/src/ChangeLog index a7214983..801c825f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +Wed Jan 5 08:30:48 WST 2005 John Darrington + + * val-labs.c Fixed bug which caused a crash if VALUE LABELS had + a trailing slash. + Mon Jan 3 17:44:37 2005 Ben Pfaff * pfm-read.c: (read_variables) Remove direct manipulation of diff --git a/src/val-labs.c b/src/val-labs.c index 1af46a2c..1cc7b84c 100644 --- a/src/val-labs.c +++ b/src/val-labs.c @@ -79,12 +79,15 @@ do_value_labels (int erase) goto lossage; if (token != '/') + { + free (vars); break; + } + lex_get (); free (vars); } - free (vars); if (token != '.') { diff --git a/tests/Makefile.am b/tests/Makefile.am index a48b9092..a2ae4090 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -57,6 +57,7 @@ TESTS = \ bugs/t-test-alpha2.sh \ bugs/temporary.sh \ bugs/val-labs.sh \ + bugs/val-labs-trailing-slash.sh \ bugs/recode-copy-bug.sh \ bugs/computebug.sh \ xforms/casefile.sh \ diff --git a/tests/bugs/val-labs-trailing-slash.sh b/tests/bugs/val-labs-trailing-slash.sh new file mode 100755 index 00000000..6a16984a --- /dev/null +++ b/tests/bugs/val-labs-trailing-slash.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# This program tests for a bug in the VALUE LABELS command +# which caused a crash if it had a trailing / + +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/out.stat < $TEMPDIR/prog.stat <