From: John Darrington Date: Tue, 31 Mar 2009 07:48:51 +0000 (+0800) Subject: Merge commit 'origin/stable' X-Git-Tag: v0.7.3~176^2~8^2~1 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a331fe64eb814ae5c1322e21717a04fb254bf65;hp=4fcc4128123c6f7b80d40adbeea58ae56b9be55c;p=pspp-builds.git Merge commit 'origin/stable' --- diff --git a/Smake b/Smake index 84537ef0..4c8d83bc 100644 --- a/Smake +++ b/Smake @@ -16,6 +16,7 @@ GNULIB_MODULES = \ environ \ exit \ fatal-signal \ + fcntl \ fpieee \ fprintf-posix \ full-read \ diff --git a/doc/statistics.texi b/doc/statistics.texi index 311f5d7a..98556060 100644 --- a/doc/statistics.texi +++ b/doc/statistics.texi @@ -566,7 +566,7 @@ values. If more than two distinct, non-missing values for a variable under test are encountered then an error occurs. -If the test proportion is equal to 0.5, then a one tailed test is +If the test proportion is equal to 0.5, then a two tailed test is reported. For any other test proportion, a one tailed test is reported. For one tailed tests, if the test proportion is less than diff --git a/src/data/make-file.c b/src/data/make-file.c index 807adc50..2162741a 100644 --- a/src/data/make-file.c +++ b/src/data/make-file.c @@ -185,7 +185,7 @@ replace_file_start (const char *file_name, const char *mode, } /* Create file by that name. */ - fd = open (rf->tmp_name, O_WRONLY | O_CREAT | O_EXCL, permissions); + fd = open (rf->tmp_name, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, permissions); if (fd >= 0) break; if (errno != EEXIST) diff --git a/src/data/por-file-writer.c b/src/data/por-file-writer.c index 77396930..8de293c5 100644 --- a/src/data/por-file-writer.c +++ b/src/data/por-file-writer.c @@ -215,7 +215,8 @@ write_float (struct pfm_writer *w, double d) char buffer[64]; format_trig_double (d, floor (d) == d ? DBL_DIG : w->digits, buffer); buf_write (w, buffer, strlen (buffer)); - buf_write (w, "/", 1); + if (d != SYSMIS) + buf_write (w, "/", 1); } /* Write N to the portable file as an integer field. */ diff --git a/src/data/psql-reader.c b/src/data/psql-reader.c index a54b9f8b..be6d0a60 100644 --- a/src/data/psql-reader.c +++ b/src/data/psql-reader.c @@ -440,6 +440,10 @@ psql_open_reader (struct psql_read_info *info, struct dictionary **dict) break; } + if ( width == 0 && fmt_is_string (fmt.type)) + fmt.w = width = MAX_SHORT_STRING; + + var = create_var (r, &fmt, width, PQfname (qres, i), i); if ( type == NUMERICOID && n_tuples > 0) { diff --git a/tests/command/get-data-psql.sh b/tests/command/get-data-psql.sh index fa61d6d6..1d8afada 100755 --- a/tests/command/get-data-psql.sh +++ b/tests/command/get-data-psql.sh @@ -427,4 +427,44 @@ diff -b $TEMPDIR/pspp.list - << 'EOF' EOF if [ $? -ne 0 ] ; then fail ; fi + + +# Check for a bug caused by having string variables in the database, +# all of which are null. + +activity="populate database 4" +$pgpath/psql -h $TEMPDIR -p $port $dbase > /dev/null << EOF + +-- a table which has a text field containing only null, or zero +-- length entries. + +CREATE TABLE foo (int4 int4, text text); + +INSERT INTO foo VALUES ('12', ''); + +INSERT INTO foo VALUES (null, ''); + +EOF +if [ $? -ne 0 ] ; then fail ; fi + + +activity="create program 4" +cat > $TESTFILE < $TESTFILE <