Ben Pfaff [Sun, 2 Dec 2018 21:28:44 +0000 (13:28 -0800)]
SYSFILE INFO: Get rid of nested tables.
Nested tables aren't really necessary and make a number of things harder in
the output subsystem. SYSFILE INFO and DISPLAY, which share code, were the
only code that used them, so this removes them from that code.
Ben Pfaff [Mon, 3 Dec 2018 02:36:51 +0000 (18:36 -0800)]
get-data-psql.at: Make test work with Debian pg_wrapper arrangement.
It had been years since I tested Postgres, but I was making a change that
would affect the Postgres test, and I found out that the test didn't work.
This fixes it.
Ben Pfaff [Mon, 26 Nov 2018 14:54:52 +0000 (06:54 -0800)]
segment: Fix behavior when #! line is not new-line terminated.
The code here is supposed to maintain a invariant that, when it returns a
nonnegative value, it initializes *type, but it failed to do that when a
#! line did not end in a new-line. This fixes the problem.
Bug #55101.
Thanks for Friedrich Beckmann for narrowing down the problem.
Found by the Debian buildd: https://buildd.debian.org/status/fetch.php?pkg=pspp&arch=arm64&ver=1.2.0-1&stamp=1543183214&raw=0
Ben Pfaff [Fri, 16 Nov 2018 21:51:38 +0000 (13:51 -0800)]
ascii: Update min_breaks along with width and length.
min_breaks has to be no larger than the page width (or length), otherwise
the rendering algorithm fails, but the automatic update for TTYs didn't
take that into account.
Ben Pfaff [Sun, 25 Nov 2018 06:22:18 +0000 (22:22 -0800)]
render: Use "long long" instead of "double" for arithmetic.
When I wrote this code in 2010, it seemed reasonable to me to use
floating-point arithmetic to do large integer calculations, because 64-bit
machines were not yet pervasive. Over 8 years later, 32-bit machines are
now a rarity. This commit switches types and modernizes the coding style.
This fixed an assertion failure that I was getting mysteriously while
rendering a particular table. I didn't investigate further because using
integers seemed like a much better idea anyway.
Ben Pfaff [Sat, 17 Nov 2018 04:27:30 +0000 (20:27 -0800)]
psppire: Fix multiple definitions of align_enum_type and two others.
These were defined in both psppire-dict.c and widgets.c, which causes a
problem building with -fno-common (which is desirable because it allows
Address Sanitizer to work better).
fixed setting the font size via css syntax - Closes Bug #55006
The pspp 1.2.0 release showed a problem with setting the font via
the font selection dialog. The root cause is that the style
setting should be done via css syntax and not pango syntax. I
changed the code to do the style setting via css syntax.
See: https://savannah.gnu.org/bugs/?55006
The minimum width setting in the comment dialog does not work how
it is implemented. I removed that code part as it does not seem
to be crucial. At least on MacOS the default
width is large enough to hold 80 characters. Even without that
the user can increase the size of the dialog.
changed install directory for pspp.appdata.xml to metainfo
The default directory for the appdata xml file changed
from appdata to metainfo. During debian package development
lintian complained about the wrong location.
changed emacs mode description to comply with elpa
During the debian package development lintian proposed
to install emacs mode via the elpa system. I changed
the pspp emacs mode description to comply to elpa.
Ben Pfaff [Sun, 14 Oct 2018 19:31:52 +0000 (12:31 -0700)]
hash-functions: Avoid signed integer overflow.
cppcheck reported that 0xdeadbeef + 8 yielded signed integer overflow.
This is probably harmless, as long as the compiler doesn't do something
really strange, but it's even better if we just ensure that this
arithmetic is done as unsigned.
Ben Pfaff [Sat, 6 Oct 2018 22:12:07 +0000 (15:12 -0700)]
lexer: Fix details of journaling.
This fixes test 1075: ASCII driver syntax printback.
Reported by John Darrington and Jeremy Lavergne. Fixes: b4f585e70eca ("lexer: Fix buffer overread in journaling when source does not end in \n.") Fixes: e0f9210e814d ("lexer: Add support for embedded \0 bytes and missing trailing new-line.")
John Darrington [Sat, 29 Sep 2018 10:51:02 +0000 (12:51 +0200)]
Reference count struct dictionary.
This change:
* Adds a ref count to struct dictionary.
* Wraps dict_destroy in a ref-counted wrapper dict_unref.
* Replaces most calls to dict_destroy with dict_unref.
* Adds a new function dict_ref.
* Changes PsppireDict so take a reference to the struct dict it contains.
* Fixes some leaked dictionaries in PsppireImportAssistant.
Ben Pfaff [Sat, 29 Sep 2018 22:43:39 +0000 (15:43 -0700)]
lexer: Fix buffer overread in journaling when source does not end in \n.
An earlier commit removed the requirement that a source file ends in \n,
but the lexer still made that assumption. This is intended to fix the
problem. (Probably, some new tests should be added.)
Thanks to John Darrington for reporting the problem.
Fixes: e0f9210e814d ("lexer: Add support for embedded \0 bytes and missing trailing new-line.")
Ben Pfaff [Mon, 24 Sep 2018 03:42:07 +0000 (20:42 -0700)]
lexer: Add support for embedded \0 bytes and missing trailing new-line.
The lexer, at a low level, has not supported \0 bytes in the input stream
because it used such a byte as the end-of-input indicator. This caused
some awkwardness for the higher-level lexer, which had to remove and flag
\0 bytes as it read them. This caused a bug in the higher-level lexer,
which raised an error for each \0 byte it removed but did so when the
lexer was in an intermediate state, which could read uninitialized data.
This commit fixes the problem by adding support for \0 bytes to the
low-level lexer (segmenter). At the same time, it adds support for input
that doesn't end in a new-line character.
Bug #54664.
Thanks to Tianxiao Gu for reporting this bug.
Ben Pfaff [Mon, 24 Sep 2018 03:26:28 +0000 (20:26 -0700)]
DO REPEAT: Avoid relying on null terminators.
find_dummy_var() currently relies on the string passed in to have a null
terminator (even though it accepts a length). This is safe in the current
tree but an upcoming commit will not ensure that it is null-terminated, so
this commit removes the dependency.
Ben Pfaff [Sun, 23 Sep 2018 04:36:10 +0000 (21:36 -0700)]
sys-file-reader: Fix null deref on bad $@Role attribute.
When a variable had a bad $@Role attribute, this was effectively read as
an attribute without any values. This is the only way to produce such an
attribute. The system file reader assumed that every attribute had at
least one value and segfaulted if $@Role did not.
This commit fixes both the ultimate cause of the segfault, by dropping
attributes with no values, and the proximate cause, by ignoring $@Role
attributes with no values. Either fix by itself would be sufficient to
avoid the segfault.
Thanks to Tianxiao Gu for reporting the problem.
Bug #54687.
John Darrington [Fri, 6 Jul 2018 10:19:45 +0000 (12:19 +0200)]
ODS reader: Deal with case where /READNAMES vs. non-unity column spans.
* src/data/ods-reader.c (ods_make_reader): Populate var_specs for the entire
column span.
* tests/language/data-io/readnames.ods: New file
* tests/automake.mk: Add it.
* tests/language/data-io/get-data-spreadsheet.at: New test.
John Darrington [Wed, 4 Jul 2018 11:12:25 +0000 (13:12 +0200)]
Fix crash when attempting to add a new variable in the middle of the dictionary.
Fixes bug #52551.
* src/ui/gui/psppire-variable-sheet.c (change_var_property): Don't attempt to
alter a variable property if it's index is more than one below the last index.
k-means dialog - number of clusters gtkentry field not visible
The gtkentry field for the number of clusters in the k-means dialog
has a width of zero.
Number entries in this field are not visible with this width, although
the edit is done. I changed the width_chars to 5. Then the field is
visible in the dialog.
Ben Pfaff [Sun, 24 Sep 2017 02:44:48 +0000 (19:44 -0700)]
Avoid unfounded warnings from GCC 7.2.
GCC thinks that these printf formats can produce output longer than the
buffer that is available for them. I think that it is wrong, but it is
easy enough to use larger (or variable-length) buffers, so this commit
does that.
Ben Pfaff [Wed, 20 Sep 2017 15:36:18 +0000 (08:36 -0700)]
SORT VARIABLES: Improve stability of sort.
The sort was being made "stable" by comparing variables' addresses in
memory. There's nothing particularly predictable about that, especially
from one malloc implementation to another. This commit fixes the stability
by comparing the variables' dictionary indexes instead.