Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-mathematics/pspp/files/, sci-mathematics/pspp/
Date: Sun, 04 Oct 2020 16:39:06
Message-Id: 1601829512.2e42197fcabcd1372267affa74297e1e9c19c092.soap@gentoo
1 commit: 2e42197fcabcd1372267affa74297e1e9c19c092
2 Author: John Helmert III <jchelmert3 <AT> posteo <DOT> net>
3 AuthorDate: Sun Oct 4 16:38:32 2020 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 4 16:38:32 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e42197f
7
8 sci-mathematics/pspp: Add security patches
9
10 This fixes several QA issues, adds a missing dependency, fixes
11 compiling with GCC 10, fixes tests, and adds patches for security.
12
13 Bug: https://bugs.gentoo.org/679392
14 Closes: https://bugs.gentoo.org/674362
15 Closes: https://bugs.gentoo.org/677282
16 Closes: https://bugs.gentoo.org/682342
17 Closes: https://bugs.gentoo.org/708548
18 Package-Manager: Portage-3.0.0, Repoman-2.3.23
19 Signed-off-by: John Helmert III <jchelmert3 <AT> posteo.net>
20 Closes: https://github.com/gentoo/gentoo/pull/16785
21 Signed-off-by: David Seifert <soap <AT> gentoo.org>
22
23 .../pspp/files/pspp-1.2.0-CVE-2018-20230.patch | 134 +++++++++++++++++++++
24 .../pspp/files/pspp-1.2.0-CVE-2019-9211.patch | 74 ++++++++++++
25 .../pspp/files/pspp-1.2.0-fix-gcc10.patch | 30 +++++
26 .../pspp/files/pspp-1.2.0-fix-overflow.patch | 32 +++++
27 .../pspp/files/pspp-1.2.0-fix-segfaults.patch | 45 +++++++
28 .../pspp/files/pspp-1.2.0-fix-tests.patch | 61 ++++++++++
29 sci-mathematics/pspp/files/pspp-1.2.0-py3.patch | 38 ++++++
30 sci-mathematics/pspp/pspp-1.2.0-r1.ebuild | 112 +++++++++++++++++
31 8 files changed, 526 insertions(+)
32
33 diff --git a/sci-mathematics/pspp/files/pspp-1.2.0-CVE-2018-20230.patch b/sci-mathematics/pspp/files/pspp-1.2.0-CVE-2018-20230.patch
34 new file mode 100644
35 index 00000000000..f0fee070deb
36 --- /dev/null
37 +++ b/sci-mathematics/pspp/files/pspp-1.2.0-CVE-2018-20230.patch
38 @@ -0,0 +1,134 @@
39 +Upstream: https://git.savannah.gnu.org/cgit/pspp.git/commit/?id=abd1f816ca3b4f382bddf4564ad092aa934f0ccc
40 +Bug: https://bugs.gentoo.org/679392
41 +
42 +From abd1f816ca3b4f382bddf4564ad092aa934f0ccc Mon Sep 17 00:00:00 2001
43 +From: Ben Pfaff <blp@×××××××××××.edu>
44 +Date: Tue, 1 Jan 2019 08:36:05 -0800
45 +Subject: pspp-dump-sav: Issue error message for too-large extension records.
46 +
47 +CVE-2018-20230.
48 +---
49 + NEWS | 2 ++
50 + utilities/pspp-dump-sav.c | 30 ++++++++++++++++++------------
51 + 2 files changed, 20 insertions(+), 12 deletions(-)
52 +
53 +diff --git a/NEWS b/NEWS
54 +index 3263062ca..191a9804b 100644
55 +--- a/NEWS
56 ++++ b/NEWS
57 +@@ -9,6 +9,8 @@ Changes since 1.2.0:
58 + * Plain text output is no longer divided into pages, since it is now
59 + rarely printed on paper.
60 +
61 ++ * Bug fix for CVE-2018-20230.
62 ++
63 + Changes from 1.0.1 to 1.2.0:
64 +
65 + * New experimental command SAVE DATA COLLECTION to save MDD files.
66 +diff --git a/utilities/pspp-dump-sav.c b/utilities/pspp-dump-sav.c
67 +index aeb648665..b0001ac61 100644
68 +--- a/utilities/pspp-dump-sav.c
69 ++++ b/utilities/pspp-dump-sav.c
70 +@@ -37,6 +37,7 @@
71 + #include "gl/progname.h"
72 + #include "gl/version-etc.h"
73 + #include "gl/xalloc.h"
74 ++#include "gl/xsize.h"
75 +
76 + #define ID_MAX_LEN 64
77 +
78 +@@ -99,7 +100,7 @@ static void read_simple_compressed_data (struct sfm_reader *, int max_cases);
79 + static void read_zlib_compressed_data (struct sfm_reader *);
80 +
81 + static struct text_record *open_text_record (
82 +- struct sfm_reader *, size_t size);
83 ++ struct sfm_reader *, size_t size, size_t count);
84 + static void close_text_record (struct text_record *);
85 + static bool read_variable_to_value_pair (struct text_record *,
86 + char **key, char **value);
87 +@@ -735,7 +736,7 @@ read_extra_product_info (struct sfm_reader *r,
88 + const char *s;
89 +
90 + printf ("%08llx: extra product info\n", (long long int) ftello (r->file));
91 +- text = open_text_record (r, size * count);
92 ++ text = open_text_record (r, size, count);
93 + s = text_get_all (text);
94 + print_string (s, strlen (s));
95 + close_text_record (text);
96 +@@ -749,7 +750,7 @@ read_mrsets (struct sfm_reader *r, size_t size, size_t count)
97 +
98 + printf ("%08llx: multiple response sets\n",
99 + (long long int) ftello (r->file));
100 +- text = open_text_record (r, size * count);
101 ++ text = open_text_record (r, size, count);
102 + for (;;)
103 + {
104 + const char *name;
105 +@@ -909,7 +910,7 @@ read_long_var_name_map (struct sfm_reader *r, size_t size, size_t count)
106 +
107 + printf ("%08llx: long variable names (short => long)\n",
108 + (long long int) ftello (r->file));
109 +- text = open_text_record (r, size * count);
110 ++ text = open_text_record (r, size, count);
111 + while (read_variable_to_value_pair (text, &var, &long_name))
112 + printf ("\t%s => %s\n", var, long_name);
113 + close_text_record (text);
114 +@@ -926,7 +927,7 @@ read_long_string_map (struct sfm_reader *r, size_t size, size_t count)
115 +
116 + printf ("%08llx: very long strings (variable => length)\n",
117 + (long long int) ftello (r->file));
118 +- text = open_text_record (r, size * count);
119 ++ text = open_text_record (r, size, count);
120 + while (read_variable_to_value_pair (text, &var, &length_s))
121 + printf ("\t%s => %d\n", var, atoi (length_s));
122 + close_text_record (text);
123 +@@ -1004,7 +1005,7 @@ read_datafile_attributes (struct sfm_reader *r, size_t size, size_t count)
124 + struct text_record *text;
125 +
126 + printf ("%08llx: datafile attributes\n", (long long int) ftello (r->file));
127 +- text = open_text_record (r, size * count);
128 ++ text = open_text_record (r, size, count);
129 + read_attributes (r, text, "datafile");
130 + close_text_record (text);
131 + }
132 +@@ -1196,7 +1197,7 @@ read_variable_attributes (struct sfm_reader *r, size_t size, size_t count)
133 + struct text_record *text;
134 +
135 + printf ("%08llx: variable attributes\n", (long long int) ftello (r->file));
136 +- text = open_text_record (r, size * count);
137 ++ text = open_text_record (r, size, count);
138 + for (;;)
139 + {
140 + const char *variable = text_tokenize (text, ':');
141 +@@ -1389,18 +1390,23 @@ struct text_record
142 + size_t pos; /* Current position in buffer. */
143 + };
144 +
145 +-/* Reads SIZE bytes into a text record for R,
146 ++/* Reads SIZE * COUNT bytes into a text record for R,
147 + and returns the new text record. */
148 + static struct text_record *
149 +-open_text_record (struct sfm_reader *r, size_t size)
150 ++open_text_record (struct sfm_reader *r, size_t size, size_t count)
151 + {
152 + struct text_record *text = xmalloc (sizeof *text);
153 +- char *buffer = xmalloc (size + 1);
154 +- read_bytes (r, buffer, size);
155 ++
156 ++ if (size_overflow_p (xsum (1, xtimes (size, count))))
157 ++ sys_error (r, "Extension record too large.");
158 ++
159 ++ size_t n_bytes = size * count;
160 ++ char *buffer = xmalloc (n_bytes + 1);
161 ++ read_bytes (r, buffer, n_bytes);
162 + buffer[size] = '\0';
163 + text->reader = r;
164 + text->buffer = buffer;
165 +- text->size = size;
166 ++ text->size = n_bytes;
167 + text->pos = 0;
168 + return text;
169 + }
170 +--
171 +cgit v1.2.1
172 +
173
174 diff --git a/sci-mathematics/pspp/files/pspp-1.2.0-CVE-2019-9211.patch b/sci-mathematics/pspp/files/pspp-1.2.0-CVE-2019-9211.patch
175 new file mode 100644
176 index 00000000000..eb0b84414e8
177 --- /dev/null
178 +++ b/sci-mathematics/pspp/files/pspp-1.2.0-CVE-2019-9211.patch
179 @@ -0,0 +1,74 @@
180 +Source: https://git.savannah.gnu.org/cgit/pspp.git/commit/?id=0b842a84353790534a401e09a8d3bdd3d25bc3a6
181 +Bug: https://bugs.gentoo.org/679392
182 +
183 +From 0b842a84353790534a401e09a8d3bdd3d25bc3a6 Mon Sep 17 00:00:00 2001
184 +From: Ben Pfaff <blp@×××××××××××.edu>
185 +Date: Wed, 27 Feb 2019 20:11:06 -0800
186 +Subject: sys-file-writer: Remove assertions based on file position.
187 +
188 +These assertions can fail if the underlying file is not a regular file,
189 +e.g. if it is a device such as /dev/null.
190 +
191 +CVE-2019-9211.
192 +See also https://bugzilla.redhat.com/show_bug.cgi?id=1683499.
193 +See also https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-9211.
194 +See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923417.
195 +---
196 + src/data/sys-file-writer.c | 6 ------
197 + 1 file changed, 6 deletions(-)
198 +
199 +diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c
200 +index df5108e2a..bbe58aecd 100644
201 +--- a/src/data/sys-file-writer.c
202 ++++ b/src/data/sys-file-writer.c
203 +@@ -953,7 +953,6 @@ write_long_string_value_labels (struct sfm_writer *w,
204 + const char *encoding = dict_get_encoding (dict);
205 + size_t n_vars = dict_get_var_cnt (dict);
206 + size_t size, i;
207 +- off_t start UNUSED;
208 +
209 + /* Figure out the size in advance. */
210 + size = 0;
211 +@@ -985,7 +984,6 @@ write_long_string_value_labels (struct sfm_writer *w,
212 + write_int (w, 1); /* Data item (byte) size. */
213 + write_int (w, size); /* Number of data items. */
214 +
215 +- start = ftello (w->file);
216 + for (i = 0; i < n_vars; i++)
217 + {
218 + struct variable *var = dict_get_var (dict, i);
219 +@@ -1022,7 +1020,6 @@ write_long_string_value_labels (struct sfm_writer *w,
220 + free (label);
221 + }
222 + }
223 +- assert (ftello (w->file) == start + size);
224 + }
225 +
226 + static void
227 +@@ -1032,7 +1029,6 @@ write_long_string_missing_values (struct sfm_writer *w,
228 + const char *encoding = dict_get_encoding (dict);
229 + size_t n_vars = dict_get_var_cnt (dict);
230 + size_t size, i;
231 +- off_t start UNUSED;
232 +
233 + /* Figure out the size in advance. */
234 + size = 0;
235 +@@ -1058,7 +1054,6 @@ write_long_string_missing_values (struct sfm_writer *w,
236 + write_int (w, 1); /* Data item (byte) size. */
237 + write_int (w, size); /* Number of data items. */
238 +
239 +- start = ftello (w->file);
240 + for (i = 0; i < n_vars; i++)
241 + {
242 + struct variable *var = dict_get_var (dict, i);
243 +@@ -1087,7 +1082,6 @@ write_long_string_missing_values (struct sfm_writer *w,
244 + write_bytes (w, value_str (value, width), 8);
245 + }
246 + }
247 +- assert (ftello (w->file) == start + size);
248 + }
249 +
250 + static void
251 +--
252 +cgit v1.2.1
253 +
254
255 diff --git a/sci-mathematics/pspp/files/pspp-1.2.0-fix-gcc10.patch b/sci-mathematics/pspp/files/pspp-1.2.0-fix-gcc10.patch
256 new file mode 100644
257 index 00000000000..d228ccc4259
258 --- /dev/null
259 +++ b/sci-mathematics/pspp/files/pspp-1.2.0-fix-gcc10.patch
260 @@ -0,0 +1,30 @@
261 +Upstream: https://git.savannah.gnu.org/cgit/pspp.git/commit/?id=614bbfbc4be1f4f47d55d3fbee9ae20f3a9955bb
262 +Gentoo Bug: https://bugs.gentoo.org/708548
263 +
264 +commit 614bbfbc4be1f4f47d55d3fbee9ae20f3a9955bb
265 +Author: Ben Pfaff <blp@×××××××××××.edu>
266 +Date: Fri Nov 16 20:27:30 2018 -0800
267 +
268 + psppire: Fix multiple definitions of align_enum_type and two others.
269 +
270 + These were defined in both psppire-dict.c and widgets.c, which causes a
271 + problem building with -fno-common (which is desirable because it allows
272 + Address Sanitizer to work better).
273 +
274 +diff --git a/src/ui/gui/widgets.c b/src/ui/gui/widgets.c
275 +index 26a5dac4f..6ce129249 100644
276 +--- a/src/ui/gui/widgets.c
277 ++++ b/src/ui/gui/widgets.c
278 +@@ -171,9 +171,9 @@ enum_to_string (const GValue *src, GValue *dest)
279 +
280 +
281 +
282 +-GType align_enum_type;
283 +-GType measure_enum_type;
284 +-GType role_enum_type;
285 ++extern GType align_enum_type;
286 ++extern GType measure_enum_type;
287 ++extern GType role_enum_type;
288 +
289 +
290 + extern const GEnumValue align[];
291
292 diff --git a/sci-mathematics/pspp/files/pspp-1.2.0-fix-overflow.patch b/sci-mathematics/pspp/files/pspp-1.2.0-fix-overflow.patch
293 new file mode 100644
294 index 00000000000..8c31c5f8702
295 --- /dev/null
296 +++ b/sci-mathematics/pspp/files/pspp-1.2.0-fix-overflow.patch
297 @@ -0,0 +1,32 @@
298 +Upstream: https://git.savannah.gnu.org/cgit/pspp.git/commit/?id=be42ce976006feed2a7ba7599ee417c28887af52
299 +
300 +From be42ce976006feed2a7ba7599ee417c28887af52 Mon Sep 17 00:00:00 2001
301 +From: Ben Pfaff <blp@×××××××××××.edu>
302 +Date: Fri, 22 Feb 2019 17:16:40 -0800
303 +Subject: pspp-dump-sav; Fix write past end of buffer in corner case.
304 +
305 +If count == 0 and size > 0, then n_bytes is 0, buffer is a 1-byte
306 +allocation, and the assignment to buffer[size] would write to buffer[1]
307 +(or past it), which is past the end of the allocation.
308 +
309 +Found by Address Sanitizer.
310 +---
311 + utilities/pspp-dump-sav.c | 2 +-
312 + 1 file changed, 1 insertion(+), 1 deletion(-)
313 +
314 +diff --git a/utilities/pspp-dump-sav.c b/utilities/pspp-dump-sav.c
315 +index 1d8d78c87..70687ebc8 100644
316 +--- a/utilities/pspp-dump-sav.c
317 ++++ b/utilities/pspp-dump-sav.c
318 +@@ -1403,7 +1403,7 @@ open_text_record (struct sfm_reader *r, size_t size, size_t count)
319 + size_t n_bytes = size * count;
320 + char *buffer = xmalloc (n_bytes + 1);
321 + read_bytes (r, buffer, n_bytes);
322 +- buffer[size] = '\0';
323 ++ buffer[n_bytes] = '\0';
324 + text->reader = r;
325 + text->buffer = buffer;
326 + text->size = n_bytes;
327 +--
328 +cgit v1.2.1
329 +
330
331 diff --git a/sci-mathematics/pspp/files/pspp-1.2.0-fix-segfaults.patch b/sci-mathematics/pspp/files/pspp-1.2.0-fix-segfaults.patch
332 new file mode 100644
333 index 00000000000..03b9d00fe73
334 --- /dev/null
335 +++ b/sci-mathematics/pspp/files/pspp-1.2.0-fix-segfaults.patch
336 @@ -0,0 +1,45 @@
337 +Upstream: https://git.savannah.gnu.org/cgit/pspp.git/commit/?id=df8cf077b2aacb7fe7b33dd8cb90ba57c8681aa0
338 +
339 +From df8cf077b2aacb7fe7b33dd8cb90ba57c8681aa0 Mon Sep 17 00:00:00 2001
340 +From: John Darrington <john@××××××××××××××××××××.au>
341 +Date: Sat, 2 Mar 2019 15:29:39 +0100
342 +Subject: PSPPIRE: Avoid some segmentation faults when corrupt data is
343 + encountered.
344 +
345 +---
346 + src/ui/gui/psppire-data-store.c | 8 ++++++--
347 + 1 file changed, 6 insertions(+), 2 deletions(-)
348 +
349 +diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c
350 +index f97b8eaf1..3c2765f5d 100644
351 +--- a/src/ui/gui/psppire-data-store.c
352 ++++ b/src/ui/gui/psppire-data-store.c
353 +@@ -183,6 +183,8 @@ psppire_data_store_value_to_string (gpointer unused, PsppireDataStore *store, gi
354 + g_return_val_if_fail (variable, g_strdup ("???"));
355 +
356 + GVariant *vrnt = g_value_get_variant (v);
357 ++ g_return_val_if_fail (vrnt, g_strdup ("???"));
358 ++
359 + union value val;
360 + value_variant_get (&val, vrnt);
361 +
362 +@@ -231,12 +233,14 @@ __get_value (GtkTreeModel *tree_model,
363 + if (NULL == variable)
364 + return;
365 +
366 +- g_value_init (value, G_TYPE_VARIANT);
367 +-
368 + gint row = GPOINTER_TO_INT (iter->user_data);
369 +
370 + struct ccase *cc = datasheet_get_row (store->datasheet, row);
371 +
372 ++ g_return_if_fail (cc);
373 ++
374 ++ g_value_init (value, G_TYPE_VARIANT);
375 ++
376 + const union value *val = case_data_idx (cc, var_get_case_index (variable));
377 +
378 + GVariant *vv = value_variant_new (val, var_get_width (variable));
379 +--
380 +cgit v1.2.1
381 +
382
383 diff --git a/sci-mathematics/pspp/files/pspp-1.2.0-fix-tests.patch b/sci-mathematics/pspp/files/pspp-1.2.0-fix-tests.patch
384 new file mode 100644
385 index 00000000000..1b92572cc82
386 --- /dev/null
387 +++ b/sci-mathematics/pspp/files/pspp-1.2.0-fix-tests.patch
388 @@ -0,0 +1,61 @@
389 +Upstream: https://git.savannah.gnu.org/cgit/pspp.git/commit/?id=fe94912b9c8682c4666873b84c83cda88f4c135d
390 +
391 +commit fe94912b9c8682c4666873b84c83cda88f4c135d
392 +Author: Ben Pfaff <blp@×××××××××××.edu>
393 +Date: Mon Nov 26 06:54:52 2018 -0800
394 +
395 + segment: Fix behavior when #! line is not new-line terminated.
396 +
397 + The code here is supposed to maintain a invariant that, when it returns a
398 + nonnegative value, it initializes *type, but it failed to do that when a
399 + #! line did not end in a new-line. This fixes the problem.
400 +
401 + Bug #55101.
402 + Thanks for Friedrich Beckmann for narrowing down the problem.
403 + 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
404 +
405 +diff --git a/src/language/lexer/segment.c b/src/language/lexer/segment.c
406 +index c0a09973c..c607c4bd1 100644
407 +--- a/src/language/lexer/segment.c
408 ++++ b/src/language/lexer/segment.c
409 +@@ -92,21 +92,26 @@ segmenter_parse_shbang__ (struct segmenter *s, const char *input, size_t n,
410 + {
411 + if (input[1] == '!')
412 + {
413 +- int ofs;
414 +-
415 +- for (ofs = 2; ofs < n; ofs++)
416 +- if (input[ofs] == '\n')
417 +- {
418 +- if (input[ofs] == '\n' && input[ofs - 1] == '\r')
419 +- ofs--;
420 +-
421 +- s->state = S_GENERAL;
422 +- s->substate = SS_START_OF_COMMAND;
423 +- *type = SEG_SHBANG;
424 +- return ofs;
425 +- }
426 ++ for (int ofs = 2; ; ofs++)
427 ++ {
428 ++ if (ofs >= n)
429 ++ {
430 ++ if (!eof)
431 ++ return -1;
432 ++ }
433 ++ else if (input[ofs] == '\n')
434 ++ {
435 ++ if (input[ofs - 1] == '\r')
436 ++ ofs--;
437 ++ }
438 ++ else
439 ++ continue;
440 +
441 +- return eof ? ofs : -1;
442 ++ s->state = S_GENERAL;
443 ++ s->substate = SS_START_OF_COMMAND;
444 ++ *type = SEG_SHBANG;
445 ++ return ofs;
446 ++ }
447 + }
448 + }
449 + else if (!eof)
450
451 diff --git a/sci-mathematics/pspp/files/pspp-1.2.0-py3.patch b/sci-mathematics/pspp/files/pspp-1.2.0-py3.patch
452 new file mode 100644
453 index 00000000000..d2bf940eae6
454 --- /dev/null
455 +++ b/sci-mathematics/pspp/files/pspp-1.2.0-py3.patch
456 @@ -0,0 +1,38 @@
457 +Upstream: https://git.savannah.gnu.org/cgit/pspp.git/commit/?id=123c3f55a80630655e84f97c9df558d988fa0055
458 +
459 +commit 123c3f55a80630655e84f97c9df558d988fa0055
460 +Author: Ben Pfaff <blp@×××××××××××.edu>
461 +Date: Mon Nov 19 08:35:23 2018 -0800
462 +
463 + test-date-input.py: Make compatible with Python 3.
464 +
465 +diff --git a/tests/data/test-date-input.py b/tests/data/test-date-input.py
466 +index 6ccc2f8f4..cdab260d6 100644
467 +--- a/tests/data/test-date-input.py
468 ++++ b/tests/data/test-date-input.py
469 +@@ -50,8 +50,8 @@ def print_all_formats(date, template, formatted, exp_y, exp_m, exp_d,
470 + global n
471 + n += 1
472 + year, month, day, julian, hour, minute, second = date
473 +- quarter = (month - 1) / 3 + 1
474 +- week = (julian - 1) / 7 + 1
475 ++ quarter = (month - 1) // 3 + 1
476 ++ week = (julian - 1) // 7 + 1
477 + if year >= 1930 and year < 2030:
478 + years = ('%d' % year, '%d' % (year % 100))
479 + else:
480 +@@ -163,10 +163,10 @@ def print_all_formats(date, template, formatted, exp_y, exp_m, exp_d,
481 + EPOCH = -577734 # 14 Oct 1582
482 + expected = (EPOCH - 1
483 + + 365 * (exp_y - 1)
484 +- + (exp_y - 1) / 4
485 +- - (exp_y - 1) / 100
486 +- + (exp_y - 1) / 400
487 +- + (367 * exp_m - 362) / 12
488 ++ + (exp_y - 1) // 4
489 ++ - (exp_y - 1) // 100
490 ++ + (exp_y - 1) // 400
491 ++ + (367 * exp_m - 362) // 12
492 + + (0 if exp_m <= 2
493 + else -1 if exp_m >= 2 and is_leap_year(exp_y)
494 + else -2)
495
496 diff --git a/sci-mathematics/pspp/pspp-1.2.0-r1.ebuild b/sci-mathematics/pspp/pspp-1.2.0-r1.ebuild
497 new file mode 100644
498 index 00000000000..02e509da024
499 --- /dev/null
500 +++ b/sci-mathematics/pspp/pspp-1.2.0-r1.ebuild
501 @@ -0,0 +1,112 @@
502 +# Copyright 1999-2020 Gentoo Authors
503 +# Distributed under the terms of the GNU General Public License v2
504 +
505 +EAPI=7
506 +
507 +PYTHON_COMPAT=( python3_{6..9} )
508 +
509 +inherit elisp-common python-any-r1 xdg-utils
510 +
511 +DESCRIPTION="Program for statistical analysis of sampled data"
512 +HOMEPAGE="https://www.gnu.org/software/pspp/pspp.html"
513 +SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
514 +
515 +LICENSE="GPL-3"
516 +SLOT="0/${PV}"
517 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
518 +IUSE="cairo doc emacs examples gtk ncurses nls perl postgres test"
519 +RESTRICT="!test? ( test )"
520 +REQUIRED_USE="test? ( cairo )"
521 +
522 +RDEPEND="
523 + dev-libs/libxml2:2
524 + sci-libs/gsl:0=
525 + sys-devel/gettext
526 + sys-libs/ncurses:0=
527 + sys-libs/readline:0=
528 + sys-libs/zlib
529 + virtual/libiconv
530 + cairo? (
531 + x11-libs/cairo[svg]
532 + x11-libs/pango
533 + )
534 + emacs? ( >=app-editors/emacs-23.1:* )
535 + gtk? (
536 + x11-libs/gtk+:3
537 + x11-libs/gtksourceview:3.0=
538 + x11-libs/spread-sheet-widget
539 + cairo? ( dev-util/glib-utils )
540 + )
541 + postgres? ( dev-db/postgresql:=[server] )"
542 +DEPEND="${RDEPEND}"
543 +BDEPEND="
544 + sys-devel/gettext
545 + virtual/pkgconfig
546 + doc? ( virtual/latex-base )
547 + test? ( ${PYTHON_DEPS} )"
548 +
549 +PATCHES=(
550 + "${FILESDIR}"/${P}-CVE-2018-20230.patch
551 + "${FILESDIR}"/${P}-CVE-2019-9211.patch
552 + "${FILESDIR}"/${P}-fix-overflow.patch
553 + "${FILESDIR}"/${P}-fix-segfaults.patch
554 + "${FILESDIR}"/${P}-fix-gcc10.patch
555 + "${FILESDIR}"/${P}-py3.patch
556 + "${FILESDIR}"/${P}-fix-tests.patch
557 +)
558 +
559 +SITEFILE=50${PN}-gentoo.el
560 +
561 +pkg_setup() {
562 + use test && python-any-r1_pkg_setup
563 +}
564 +
565 +src_prepare() {
566 + default
567 + sed -i '/appdata$/s/appdata$/metainfo/' Makefile.in || die
568 +}
569 +
570 +src_configure() {
571 + econf \
572 + --disable-static \
573 + $(use_enable nls) \
574 + $(use_with cairo) \
575 + $(use_with gtk gui) \
576 + $(use_with perl perl-module) \
577 + $(use_with postgres libpq)
578 +}
579 +
580 +src_compile() {
581 + default
582 + if use doc; then
583 + emake html pdf
584 + HTML_DOCS=( doc/pspp{,-dev}.html )
585 + fi
586 + use emacs && elisp-compile *.el
587 +}
588 +
589 +src_install() {
590 + default
591 +
592 + use doc && dodoc doc/pspp{,-dev}.pdf
593 + if use examples; then
594 + dodoc -r examples
595 + docompress -x /usr/share/doc/${PF}/examples
596 + fi
597 + if use emacs; then
598 + elisp-install ${PN} *.el *.elc
599 + elisp-site-file-install "${FILESDIR}/${SITEFILE}"
600 + fi
601 +
602 + find "${D}" -name '*.la' -type f -delete || die
603 +}
604 +
605 +pkg_postinst() {
606 + xdg_icon_cache_update
607 + use emacs && elisp-site-regen
608 +}
609 +
610 +pkg_postrm() {
611 + xdg_icon_cache_update
612 + use emacs && elisp-site-regen
613 +}