From 4278c74b3ad87e6b6df5b2cca8bdd906d61ff097 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 9 Jan 2020 18:36:50 +0100 Subject: [PATCH 1/5] gnu: poppler: Update to 0.84.0. * gnu/packages/pdf.scm (poppler): Update to 0.84.0. --- gnu/packages/pdf.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm index 3b6829c4bc..78f652164b 100644 --- a/gnu/packages/pdf.scm +++ b/gnu/packages/pdf.scm @@ -90,14 +90,14 @@ (define-public poppler (package (name "poppler") - (version "0.79.0") + (version "0.84.0") (source (origin (method url-fetch) (uri (string-append "https://poppler.freedesktop.org/poppler-" version ".tar.xz")) (sha256 (base32 - "1j18jlv1q6h21azb939gqjsgcbsh5qcd8dwxdmad54p5ixha91gr")))) + "0ccp2gx05cz5y04k5pgbyi4ikyq60nafa7x2yx4aaf1vfkd318f7")))) (build-system cmake-build-system) ;; FIXME: ;; use libcurl: no -- 2.24.1 From 3b1ceabd25651952aee0834985770538a313b734 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 9 Jan 2020 22:36:40 +0100 Subject: [PATCH 2/5] build-system/texlive: Update to texlive-2019.3, revision 51265. * guix/build-system/texlive.scm (%texlive-tag): Change to "2019.3". (%texlive-revision): Change to 51265. --- guix/build-system/texlive.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guix/build-system/texlive.scm b/guix/build-system/texlive.scm index ad99d1e2d0..8bbca0ccb7 100644 --- a/guix/build-system/texlive.scm +++ b/guix/build-system/texlive.scm @@ -42,8 +42,8 @@ ;; These variables specify the SVN tag and the matching SVN revision. They ;; are taken from https://www.tug.org/svn/texlive/tags/ -(define %texlive-tag "texlive-2018.2") -(define %texlive-revision 49435) +(define %texlive-tag "texlive-2019.3") +(define %texlive-revision 51265) (define (texlive-origin name version locations hash) "Return an object for a TeX Live package consisting of multiple -- 2.24.1 From 9fc158fc135ab718cb767f5eecb16cd81d4847f6 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 9 Jan 2020 22:37:10 +0100 Subject: [PATCH 3/5] gnu: texlive-bin: Update to 20190410. * gnu/packages/patches/texlive-bin-CVE-2018-17407.patch, gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch: Delete files. * gnu/packages/patches/texlive-bin-poppler-0.83.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/tex.scm (texlive-extra-src, texlive-texmf-src): Update to 20190419. (texlive-bin): Likewise. [source](patches): Update Arch patches for Poppler 0.84 compatibility. [arguments]: Remove phase 'use-code-for-even-newer-poppler'; add phase 'patch-dvisgm-build-files'. --- gnu/local.mk | 3 +- .../patches/texlive-bin-CVE-2018-17407.patch | 249 --------------- .../texlive-bin-luatex-poppler-compat.patch | 293 ------------------ .../patches/texlive-bin-poppler-0.83.patch | 52 ++++ gnu/packages/tex.scm | 48 ++- 5 files changed, 74 insertions(+), 571 deletions(-) delete mode 100644 gnu/packages/patches/texlive-bin-CVE-2018-17407.patch delete mode 100644 gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch create mode 100644 gnu/packages/patches/texlive-bin-poppler-0.83.patch diff --git a/gnu/local.mk b/gnu/local.mk index de8bb837ec..c458d5a308 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1409,8 +1409,7 @@ dist_patch_DATA = \ %D%/packages/patches/teensy-loader-cli-help.patch \ %D%/packages/patches/teeworlds-use-latest-wavpack.patch \ %D%/packages/patches/texinfo-5-perl-compat.patch \ - %D%/packages/patches/texlive-bin-CVE-2018-17407.patch \ - %D%/packages/patches/texlive-bin-luatex-poppler-compat.patch \ + %D%/packages/patches/texlive-bin-poppler-0.83.patch \ %D%/packages/patches/telegram-purple-adjust-test.patch \ %D%/packages/patches/texi2html-document-encoding.patch \ %D%/packages/patches/texi2html-i18n.patch \ diff --git a/gnu/packages/patches/texlive-bin-CVE-2018-17407.patch b/gnu/packages/patches/texlive-bin-CVE-2018-17407.patch deleted file mode 100644 index 63646d420c..0000000000 --- a/gnu/packages/patches/texlive-bin-CVE-2018-17407.patch +++ /dev/null @@ -1,249 +0,0 @@ -This patch adds support for newer versions of Poppler and some upstream -TexLive fixes, including one for CVE-2018-17407. - -It is taken from Linux From Scratch: -. - -Submitted By: Ken Moffat -Date: 2018-12-26 -Initial Package Version: 20180414 -Upstream Status: Applied -Origin: Upstream -Description: Two fixes, cherry-picked from svn plus a CVE fix. -I have removed the partial fixes for various system versions of poppler. - -r47469 Fix segfault in dvipdfm-x (XeTeX) on 1/2/4-bit transparent indexed PNGs. - -r47477 Fix a ptex regression for discontinuous kinsoku table. - -Also, via fedora (I got lost in svn) a critical fix for CVE-2018-17407 - -"A buffer overflow in the handling of Type 1 fonts allows arbitrary code -execution when a malicious font is loaded by one of the vulnerable tools: -pdflatex, pdftex, dvips, or luatex." - -diff -Naur a/texk/dvipdfm-x/pngimage.c b/texk/dvipdfm-x/pngimage.c ---- a/texk/dvipdfm-x/pngimage.c 2018-02-17 08:41:35.000000000 +0000 -+++ b/texk/dvipdfm-x/pngimage.c 2018-10-09 01:52:01.648670875 +0100 -@@ -964,12 +964,16 @@ - png_bytep trans; - int num_trans; - png_uint_32 i; -+ png_byte bpc, mask, shift; - - if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) || - !png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL)) { - WARN("%s: PNG does not have valid tRNS chunk but tRNS is requested.", PNG_DEBUG_STR); - return NULL; - } -+ bpc = png_get_bit_depth(png_ptr, info_ptr); -+ mask = 0xff >> (8 - bpc); -+ shift = 8 - bpc; - - smask = pdf_new_stream(STREAM_COMPRESS); - dict = pdf_stream_dict(smask); -@@ -981,7 +985,8 @@ - pdf_add_dict(dict, pdf_new_name("ColorSpace"), pdf_new_name("DeviceGray")); - pdf_add_dict(dict, pdf_new_name("BitsPerComponent"), pdf_new_number(8)); - for (i = 0; i < width*height; i++) { -- png_byte idx = image_data_ptr[i]; -+ /* data is packed for 1/2/4 bpc formats, msb first */ -+ png_byte idx = (image_data_ptr[bpc * i / 8] >> (shift - bpc * i % 8)) & mask; - smask_data_ptr[i] = (idx < num_trans) ? trans[idx] : 0xff; - } - pdf_add_stream(smask, (char *)smask_data_ptr, width*height); -diff -Naur a/texk/dvipsk/writet1.c b/texk/dvipsk/writet1.c ---- a/texk/dvipsk/writet1.c 2016-11-25 18:24:26.000000000 +0000 -+++ b/texk/dvipsk/writet1.c 2018-10-09 01:52:01.648670875 +0100 -@@ -1449,7 +1449,9 @@ - *(strend(t1_buf_array) - 1) = ' '; - - t1_getline(); -+ alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE); - strcat(t1_buf_array, t1_line_array); -+ alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE); - strcpy(t1_line_array, t1_buf_array); - t1_line_ptr = eol(t1_line_array); - } -diff -Naur a/texk/web2c/luatexdir/font/writet1.w b/texk/web2c/luatexdir/font/writet1.w ---- a/texk/web2c/luatexdir/font/writet1.w 2016-11-25 18:24:34.000000000 +0000 -+++ b/texk/web2c/luatexdir/font/writet1.w 2018-10-09 01:52:01.648670875 +0100 -@@ -1625,7 +1625,9 @@ - if (sscanf(p, "%i", &i) != 1) { - strcpy(t1_buf_array, t1_line_array); - t1_getline(); -+ alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE); - strcat(t1_buf_array, t1_line_array); -+ alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE); - strcpy(t1_line_array, t1_buf_array); - t1_line_ptr = eol(t1_line_array); - } -diff -Naur a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w ---- a/texk/web2c/luatexdir/image/pdftoepdf.w 2018-01-17 18:00:12.000000000 +0000 -+++ b/texk/web2c/luatexdir/image/pdftoepdf.w 2018-10-09 01:52:01.648670875 +0100 -@@ -472,10 +472,10 @@ - break; - */ - case objString: -- copyString(pdf, obj->getString()); -+ copyString(pdf, (GooString *)obj->getString()); - break; - case objName: -- copyName(pdf, obj->getName()); -+ copyName(pdf, (char *)obj->getName()); - break; - case objNull: - pdf_add_null(pdf); -diff -Naur a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc ---- a/texk/web2c/luatexdir/lua/lepdflib.cc 2018-02-14 14:44:38.000000000 +0000 -+++ b/texk/web2c/luatexdir/lua/lepdflib.cc 2018-10-09 01:52:01.649670868 +0100 -@@ -674,7 +674,7 @@ - uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \ - if (uin->pd != NULL && uin->pd->pc != uin->pc) \ - pdfdoc_changed_error(L); \ -- gs = ((in *) uin->d)->function(); \ -+ gs = (GooString *)((in *) uin->d)->function(); \ - if (gs != NULL) \ - lua_pushlstring(L, gs->getCString(), gs->getLength()); \ - else \ -@@ -1813,7 +1813,7 @@ - if (uin->pd != NULL && uin->pd->pc != uin->pc) - pdfdoc_changed_error(L); - if (((Object *) uin->d)->isString()) { -- gs = ((Object *) uin->d)->getString(); -+ gs = (GooString *)((Object *) uin->d)->getString(); - lua_pushlstring(L, gs->getCString(), gs->getLength()); - } else - lua_pushnil(L); -diff -Naur a/texk/web2c/pdftexdir/writet1.c b/texk/web2c/pdftexdir/writet1.c ---- a/texk/web2c/pdftexdir/writet1.c 2016-11-25 18:24:37.000000000 +0000 -+++ b/texk/web2c/pdftexdir/writet1.c 2018-10-09 01:52:01.649670868 +0100 -@@ -1598,7 +1598,9 @@ - *(strend(t1_buf_array) - 1) = ' '; - - t1_getline(); -+ alloc_array(t1_buf, strlen(t1_line_array) + strlen(t1_buf_array) + 1, T1_BUF_SIZE); - strcat(t1_buf_array, t1_line_array); -+ alloc_array(t1_line, strlen(t1_buf_array) + 1, T1_BUF_SIZE); - strcpy(t1_line_array, t1_buf_array); - t1_line_ptr = eol(t1_line_array); - } -diff -Naur a/texk/web2c/ptexdir/ptex_version.h b/texk/web2c/ptexdir/ptex_version.h ---- a/texk/web2c/ptexdir/ptex_version.h 2018-01-21 03:48:06.000000000 +0000 -+++ b/texk/web2c/ptexdir/ptex_version.h 2018-10-09 01:52:01.649670868 +0100 -@@ -1 +1 @@ --#define PTEX_VERSION "p3.8.0" -+#define PTEX_VERSION "p3.8.1" -diff -Naur a/texk/web2c/ptexdir/tests/free_ixsp.tex b/texk/web2c/ptexdir/tests/free_ixsp.tex ---- a/texk/web2c/ptexdir/tests/free_ixsp.tex 1970-01-01 01:00:00.000000000 +0100 -+++ b/texk/web2c/ptexdir/tests/free_ixsp.tex 2018-10-09 01:52:01.649670868 +0100 -@@ -0,0 +1,53 @@ -+%#!eptex -ini -etex -+\let\dump\relax -+\batchmode -+\input plain -+ -+\errorstopmode -+\catcode`@=11 -+\newcount\@tempcnta -+\newcount\@tempcntb -+\newcount\@tempcntc -+\mathchardef\LIM=256 -+ -+\def\MYCHAR#1{% -+ \@tempcntc=\numexpr7*#1+"101\relax -+ \@tempcnta=\@tempcntc\divide\@tempcnta 94 -+ \@tempcntb=\numexpr\@tempcntc-94*\@tempcnta+1\relax -+ \ifnum\@tempcntb<0\advance\@tempcntb94 \advance\@tempcnta-1\fi -+ \advance\@tempcnta18 % 18区以降 -+ \CNTA=\kuten\numexpr"100*\@tempcnta+\@tempcntb\relax -+} -+ -+\newcount\CNT\newcount\CNTA -+\CNT=0 -+\loop -+ \MYCHAR\CNT -+ \message{\the\CNT.} -+ \inhibitxspcode\CNTA=1\relax -+ \advance\CNT1\relax -+ \ifnum\CNT<\LIM -+\repeat -+ -+\newcount\CNTB -+ -+\loop -+ \MYCHAR\CNTB -+ \global\inhibitxspcode\CNTA=3 -+{% -+\CNT=0 -+\loop -+ \MYCHAR\CNT -+ \count@=\numexpr 1-\inhibitxspcode\CNTA\relax -+ \ifnum\count@=0\else\ifnum\CNTB=\CNT\else -+ \errmessage{<\the\CNTB, \the\CNT, \the\inhibitxspcode\CNTA>}\fi\fi -+ \advance\CNT1\relax -+ \ifnum\CNT<\LIM -+\repeat -+} -+ \MYCHAR\CNTB -+ \global\inhibitxspcode\CNTA=1\relax -+ \advance\CNTB1\relax -+ \ifnum\CNTB<\LIM -+\repeat -+\bye -diff -Naur a/texk/web2c/ptexdir/tests/free_pena.tex b/texk/web2c/ptexdir/tests/free_pena.tex ---- a/texk/web2c/ptexdir/tests/free_pena.tex 1970-01-01 01:00:00.000000000 +0100 -+++ b/texk/web2c/ptexdir/tests/free_pena.tex 2018-10-09 01:52:01.649670868 +0100 -@@ -0,0 +1,52 @@ -+%#!eptex -ini -etex -+\let\dump\relax -+\batchmode -+\input plain -+ -+\errorstopmode -+\catcode`@=11 -+\newcount\@tempcnta -+\newcount\@tempcntb -+\newcount\@tempcntc -+\mathchardef\LIM=256 -+ -+\def\MYCHAR#1{% -+ \@tempcntc=\numexpr7*#1+"101\relax -+ \@tempcnta=\@tempcntc\divide\@tempcnta 94 -+ \@tempcntb=\numexpr\@tempcntc-94*\@tempcnta+1\relax -+ \ifnum\@tempcntb<0\advance\@tempcntb94 \advance\@tempcnta-1\fi -+ \advance\@tempcnta18 % 18区以降 -+ \CNTA=\kuten\numexpr"100*\@tempcnta+\@tempcntb\relax -+} -+ -+\newcount\CNT\newcount\CNTA -+\CNT=0 -+\loop -+ \MYCHAR\CNT -+ \message{\the\CNT.} -+ \prebreakpenalty\CNTA=\numexpr\CNT+1\relax -+ \advance\CNT1\relax -+ \ifnum\CNT<\LIM -+\repeat -+ -+\newcount\CNTB -+ -+\loop -+ \MYCHAR\CNTB -+ \global\prebreakpenalty\CNTA=0 -+{% -+\CNT=0 -+\loop -+ \MYCHAR\CNT -+ \count@=\numexpr -\CNT-1+\prebreakpenalty\CNTA\relax -+ \ifnum\count@=0\else\ifnum\CNTB=\CNT\else\errmessage{<\the\CNTB, \the\CNT>}\fi\fi -+ \advance\CNT1\relax -+ \ifnum\CNT<\LIM -+\repeat -+} -+ \MYCHAR\CNTB -+ \global\prebreakpenalty\CNTA=\numexpr\CNTB+1\relax -+ \advance\CNTB1\relax -+ \ifnum\CNTB<\LIM -+\repeat -+\bye diff --git a/gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch b/gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch deleted file mode 100644 index 024ff416af..0000000000 --- a/gnu/packages/patches/texlive-bin-luatex-poppler-compat.patch +++ /dev/null @@ -1,293 +0,0 @@ -Fix LuaTeX compatibility with Poppler 0.75. - -Upstream LuaTeX have moved from Poppler to "pplib" and thus upstream -fixes are unavailable. This is based on Archs patch, with minor -tweaks to comply with texlive-bin-CVE-2018-17407.patch. -https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/texlive-bin&id=418dd6f008c3d41a461353fdb60f2d73d87c58ed - -diff --git a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w ---- a/texk/web2c/luatexdir/image/pdftoepdf.w -+++ b/texk/web2c/luatexdir/image/pdftoepdf.w -@@ -363,7 +363,7 @@ void copyReal(PDF pdf, double d) - - static void copyString(PDF pdf, GooString * string) - { -- char *p; -+ const char *p; - unsigned char c; - size_t i, l; - p = string->getCString(); -@@ -393,7 +393,7 @@ static void copyString(PDF pdf, GooString * string) - pdf->cave = true; - } - --static void copyName(PDF pdf, char *s) -+static void copyName(PDF pdf, const char *s) - { - pdf_out(pdf, '/'); - for (; *s != 0; s++) { -@@ -412,7 +412,7 @@ static void copyArray(PDF pdf, PdfDocument * pdf_doc, Array * array) - Object obj1; - pdf_begin_array(pdf); - for (i = 0, l = array->getLength(); i < l; ++i) { -- obj1 = array->getNF(i); -+ obj1 = array->getNF(i).copy(); - copyObject(pdf, pdf_doc, &obj1); - } - pdf_end_array(pdf); -@@ -425,7 +425,7 @@ static void copyDict(PDF pdf, PdfDocument * pdf_doc, Dict * dict) - pdf_begin_dict(pdf); - for (i = 0, l = dict->getLength(); i < l; ++i) { - copyName(pdf, dict->getKey(i)); -- obj1 = dict->getValNF(i); -+ obj1 = dict->getValNF(i).copy(); - copyObject(pdf, pdf_doc, &obj1); - } - pdf_end_dict(pdf); -@@ -475,7 +475,7 @@ static void copyObject(PDF pdf, PdfDocument * pdf_doc, Object * obj) - copyString(pdf, (GooString *)obj->getString()); - break; - case objName: -- copyName(pdf, (char *)obj->getName()); -+ copyName(pdf, obj->getName()); - break; - case objNull: - pdf_add_null(pdf); -@@ -531,22 +531,22 @@ static PDFRectangle *get_pagebox(Page * page, int pagebox_spec) - { - switch (pagebox_spec) { - case PDF_BOX_SPEC_MEDIA: -- return page->getMediaBox(); -+ return (PDFRectangle *) page->getMediaBox(); - break; - case PDF_BOX_SPEC_CROP: -- return page->getCropBox(); -+ return (PDFRectangle *) page->getCropBox(); - break; - case PDF_BOX_SPEC_BLEED: -- return page->getBleedBox(); -+ return (PDFRectangle *) page->getBleedBox(); - break; - case PDF_BOX_SPEC_TRIM: -- return page->getTrimBox(); -+ return (PDFRectangle *) page->getTrimBox(); - break; - case PDF_BOX_SPEC_ART: -- return page->getArtBox(); -+ return (PDFRectangle *) page->getArtBox(); - break; - default: -- return page->getMediaBox(); -+ return (PDFRectangle *) page->getMediaBox(); - break; - } - } -@@ -788,12 +788,12 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info) - Now all relevant parts of the Page dictionary are copied. Metadata validity - check is needed(as a stream it must be indirect). - */ -- obj1 = pageDict->lookupNF("Metadata"); -+ obj1 = pageDict->lookupNF("Metadata").copy(); - if (!obj1.isNull() && !obj1.isRef()) - formatted_warning("pdf inclusion","/Metadata must be indirect object"); - /* copy selected items in Page dictionary */ - for (i = 0; pagedictkeys[i] != NULL; i++) { -- obj1 = pageDict->lookupNF(pagedictkeys[i]); -+ obj1 = pageDict->lookupNF(pagedictkeys[i]).copy(); - if (!obj1.isNull()) { - pdf_add_name(pdf, pagedictkeys[i]); - /* preserves indirection */ -@@ -806,13 +806,13 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info) - PDF file, climbing up the tree until the Resources are found. - (This fixes a problem with Scribus 1.3.3.14.) - */ -- obj1 = pageDict->lookupNF("Resources"); -+ obj1 = pageDict->lookupNF("Resources").copy(); - if (obj1.isNull()) { - op1 = &pagesobj1; - op2 = &pagesobj2; - *op1 = pageDict->lookup("Parent"); - while (op1->isDict()) { -- obj1 = op1->dictLookupNF("Resources"); -+ obj1 = op1->dictLookupNF("Resources").copy(); - if (!obj1.isNull()) { - pdf_add_name(pdf, "Resources"); - copyObject(pdf, pdf_doc, &obj1); -diff --git a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc ---- a/texk/web2c/luatexdir/lua/lepdflib.cc -+++ b/texk/web2c/luatexdir/lua/lepdflib.cc -@@ -240,7 +240,7 @@ static int l_new_Attribute(lua_State * L) - if (uobj->pd != NULL && uobj->pd->pc != uobj->pc) - pdfdoc_changed_error(L); - uout = new_Attribute_userdata(L); -- uout->d = new Attribute(n, nlen, (Object *)uobj->d); -+ uout->d = new Attribute((GooString)n, (Object *)uobj->d); - uout->atype = ALLOC_LEPDF; - uout->pc = uobj->pc; - uout->pd = uobj->pd; -@@ -496,7 +496,7 @@ static int l_new_Object(lua_State * L) - double numA = lua_tonumber(L,1); - double genA = lua_tonumber(L,2); - if ( ((numA)==(int)(numA)) && ((genA)==(int)(genA)) ){ -- uout->d = new Object((int)(numA), (int)(genA)); -+ uout->d = new Object({(int)(numA), (int)(genA)}); - uout->atype = ALLOC_LEPDF; - uout->pc = 0; - uout->pd = NULL; -@@ -596,7 +596,7 @@ static int m_##in##_##function(lua_State * L) \ - uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \ - if (uin->pd != NULL && uin->pd->pc != uin->pc) \ - pdfdoc_changed_error(L); \ -- o = ((in *) uin->d)->function(); \ -+ o = (out *) ((in *) uin->d)->function(); \ - if (o != NULL) { \ - uout = new_##out##_userdata(L); \ - uout->d = o; \ -@@ -889,7 +889,7 @@ static int m_Array_getNF(lua_State * L) - if (i > 0 && i <= len) { - uout = new_Object_userdata(L); - uout->d = new Object(); -- *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1); -+ *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1).copy(); - uout->atype = ALLOC_LEPDF; - uout->pc = uin->pc; - uout->pd = uin->pd; -@@ -1125,12 +1125,12 @@ m_poppler_get_INT(Dict, getLength); - - static int m_Dict_add(lua_State * L) - { -- char *s; -+ const char *s; - udstruct *uin, *uobj; - uin = (udstruct *) luaL_checkudata(L, 1, M_Dict); - if (uin->pd != NULL && uin->pd->pc != uin->pc) - pdfdoc_changed_error(L); -- s = copyString(luaL_checkstring(L, 2)); -+ s = luaL_checkstring(L, 2); - uobj = (udstruct *) luaL_checkudata(L, 3, M_Object); - ((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d))); - return 0; -@@ -1190,7 +1190,7 @@ static int m_Dict_lookupNF(lua_State * L) - s = luaL_checkstring(L, 2); - uout = new_Object_userdata(L); - uout->d = new Object(); -- *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s); -+ *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s).copy(); - uout->atype = ALLOC_LEPDF; - uout->pc = uin->pc; - uout->pd = uin->pd; -@@ -1263,7 +1263,7 @@ static int m_Dict_getValNF(lua_State * L) - if (i > 0 && i <= len) { - uout = new_Object_userdata(L); - uout->d = new Object(); -- *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1); -+ *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1).copy(); - uout->atype = ALLOC_LEPDF; - uout->pc = uin->pc; - uout->pd = uin->pd; -@@ -1653,7 +1653,7 @@ static int m_Object_initRef(lua_State * L) - pdfdoc_changed_error(L); - num = luaL_checkint(L, 2); - gen = luaL_checkint(L, 3); -- *((Object *) uin->d) = Object(num, gen); -+ *((Object *) uin->d) = Object({num, gen}); - return 0; - } - -@@ -2011,7 +2011,7 @@ static int m_Object_arrayGetNF(lua_State * L) - if (i > 0 && i <= len) { - uout = new_Object_userdata(L); - uout->d = new Object(); -- *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1); -+ *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1).copy(); - uout->atype = ALLOC_LEPDF; - uout->pc = uin->pc; - uout->pd = uin->pd; -@@ -2051,7 +2051,7 @@ static int m_Object_dictAdd(lua_State * L) - pdfdoc_changed_error(L); - if (!((Object *) uin->d)->isDict()) - luaL_error(L, "Object is not a Dict"); -- ((Object *) uin->d)->dictAdd(copyString(s), std::move(*((Object *) uobj->d))); -+ ((Object *) uin->d)->dictAdd(s, std::move(*((Object *) uobj->d))); - return 0; - } - -@@ -2104,7 +2104,7 @@ static int m_Object_dictLookupNF(lua_State * L) - if (((Object *) uin->d)->isDict()) { - uout = new_Object_userdata(L); - uout->d = new Object(); -- *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s); -+ *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s).copy(); - uout->atype = ALLOC_LEPDF; - uout->pc = uin->pc; - uout->pd = uin->pd; -@@ -2169,7 +2169,7 @@ static int m_Object_dictGetValNF(lua_State * L) - if (i > 0 && i <= len) { - uout = new_Object_userdata(L); - uout->d = new Object(); -- *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1); -+ *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1).copy(); - uout->atype = ALLOC_LEPDF; - uout->pc = uin->pc; - uout->pd = uin->pd; -@@ -2470,7 +2470,7 @@ static int m_PDFDoc_getFileName(lua_State * L) - uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc); - if (uin->pd != NULL && uin->pd->pc != uin->pc) - pdfdoc_changed_error(L); -- gs = ((PdfDocument *) uin->d)->doc->getFileName(); -+ gs = (GooString *) ((PdfDocument *) uin->d)->doc->getFileName(); - if (gs != NULL) - lua_pushlstring(L, gs->getCString(), gs->getLength()); - else -@@ -2559,7 +2559,7 @@ static int m_PDFDoc_readMetadata(lua_State * L) - if (uin->pd != NULL && uin->pd->pc != uin->pc) - pdfdoc_changed_error(L); - if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) { -- gs = ((PdfDocument *) uin->d)->doc->readMetadata(); -+ gs = (GooString *) ((PdfDocument *) uin->d)->doc->readMetadata(); - if (gs != NULL) - lua_pushlstring(L, gs->getCString(), gs->getLength()); - else -@@ -2577,7 +2577,7 @@ static int m_PDFDoc_getStructTreeRoot(lua_State * L) - if (uin->pd != NULL && uin->pd->pc != uin->pc) - pdfdoc_changed_error(L); - if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) { -- obj = ((PdfDocument *) uin->d)->doc->getStructTreeRoot(); -+ obj = (StructTreeRoot *) ((PdfDocument *) uin->d)->doc->getStructTreeRoot(); - uout = new_StructTreeRoot_userdata(L); - uout->d = obj; - uout->pc = uin->pc; ---- texlive-source/texk/web2c/luatexdir/lua/lepdflib.cc.orig 2019-04-24 09:41:05.090522664 +0000 -+++ texlive-source/texk/web2c/luatexdir/lua/lepdflib.cc 2019-04-24 09:43:37.119184926 +0000 -@@ -994,7 +994,8 @@ - pdfdoc_changed_error(L); - num = luaL_checkint(L, 2); - gen = luaL_checkint(L, 3); -- i = ((Catalog *) uin->d)->findPage(num, gen); -+ Ref numgen = {num, gen}; -+ i = ((Catalog *) uin->d)->findPage(numgen); - if (i > 0) - lua_pushinteger(L, i); - else -@@ -2596,8 +2597,9 @@ - pdfdoc_changed_error(L); - num = luaL_checkint(L, 2); - gen = luaL_checkint(L, 3); -+ Ref numgen = {num, gen}; - if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) { -- i = ((PdfDocument *) uin->d)->doc->findPage(num, gen); -+ i = ((PdfDocument *) uin->d)->doc->findPage(numgen); - if (i > 0) - lua_pushinteger(L, i); - else ---- texlive-source/texk/web2c/luatexdir/image/pdftoepdf.w.orig 2019-04-24 09:56:38.406498975 +0000 -+++ texlive-source/texk/web2c/luatexdir/image/pdftoepdf.w 2019-04-24 09:56:57.020081327 +0000 -@@ -630,7 +630,7 @@ - if (link == NULL || !link->isOk()) - formatted_error("pdf inclusion","invalid destination '%s'",img_pagename(idict)); - Ref ref = link->getPageRef(); -- img_pagenum(idict) = catalog->findPage(ref.num, ref.gen); -+ img_pagenum(idict) = catalog->findPage(ref); - if (img_pagenum(idict) == 0) - formatted_error("pdf inclusion","destination is not a page '%s'",img_pagename(idict)); - delete link; diff --git a/gnu/packages/patches/texlive-bin-poppler-0.83.patch b/gnu/packages/patches/texlive-bin-poppler-0.83.patch new file mode 100644 index 0000000000..5e57e3efac --- /dev/null +++ b/gnu/packages/patches/texlive-bin-poppler-0.83.patch @@ -0,0 +1,52 @@ +Fix build with Poppler 0.83 and later. + +Taken from Arch Linux, but adjusted to patch the versioned Poppler +files, as upstream applies it after copying them in place. +https://git.archlinux.org/svntogit/packages.git/tree/trunk/texlive-poppler-0.83.patch?h=packages/texlive-bin + +diff -ru texlive-source-orig/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc texlive-source/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc +--- texlive-source-orig/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc ++++ texlive-source/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc +@@ -723,7 +723,7 @@ + #endif + // initialize + if (!isInit) { +- globalParams = new GlobalParams(); ++ globalParams.reset(new GlobalParams()); + globalParams->setErrQuiet(false); + isInit = true; + } +@@ -1108,6 +1108,5 @@ + delete_document(p); + } + // see above for globalParams +- delete globalParams; + } + } +diff -ru texlive-source-orig/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc texlive-source/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc +--- texlive-source-orig/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc ++++ texlive-source/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc +@@ -79,7 +79,7 @@ + exit(1); + } + fileName = new GString(argv[1]); +- globalParams = new GlobalParams(); ++ globalParams.reset(new GlobalParams()); + doc = new PDFDoc(fileName); + if (!doc->isOk()) { + fprintf(stderr, "Invalid PDF file\n"); +@@ -100,7 +100,7 @@ + if (objnum == 0) { + srcStream = catalogDict.dictLookup("SourceObject"); + static char const_SourceFile[] = "SourceFile"; +- if (!srcStream.isStream(const_SourceFile)) { ++ if (!srcStream.isDict(const_SourceFile)) { + fprintf(stderr, "No SourceObject found\n"); + exit(1); + } +@@ -202,5 +202,4 @@ + fprintf(stderr, "Cross-reference table extracted to %s\n", outname); + fclose(outfile); + delete doc; +- delete globalParams; + } diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm index e4346d1232..4ea40126ae 100644 --- a/gnu/packages/tex.scm +++ b/gnu/packages/tex.scm @@ -227,29 +227,29 @@ copied to their outputs; otherwise the TEXLIVE-BUILD-SYSTEM is used." (define texlive-extra-src (origin (method url-fetch) - (uri "ftp://tug.org/historic/systems/texlive/2018/texlive-20180414-extra.tar.xz") + (uri "ftp://tug.org/historic/systems/texlive/2019/texlive-20190410-extra.tar.xz") (sha256 (base32 - "0a83kymxc8zmlxjb0y1gf6mx7qnf0hxffwkivwh5yh138y2rfhsv")))) + "13ncf2an4nlqv18lki6y2p6pcsgs1i54zqkhfwprax5j53bk70j8")))) (define texlive-texmf-src (origin (method url-fetch) - (uri "ftp://tug.org/historic/systems/texlive/2018/texlive-20180414-texmf.tar.xz") + (uri "ftp://tug.org/historic/systems/texlive/2019/texlive-20190410-texmf.tar.xz") (sha256 (base32 - "1b8zigzg8raxkhhzphcmynf84rbdbj2ym2qkz24v8n0qx82zmqms")))) + "00n4qh9fj8v9zzy3y488hpfq1g3dnnh72y4yjsaikfcqpi59gv62")))) (define-public texlive-bin (package (name "texlive-bin") - (version "20180414") + (version "20190410") (source (origin (method url-fetch) - (uri (string-append "ftp://tug.org/historic/systems/texlive/2018/" + (uri (string-append "ftp://tug.org/historic/systems/texlive/2019/" "texlive-" version "-source.tar.xz")) (sha256 (base32 - "0khyi6h015r2zfqgg0a44a2j7vmr1cy42knw7jbss237yvakc07y")) + "1dfps39q6bdr1zsbp9p74mvalmy3bycihv19sb9c6kg30kprz8nj")) (patches (let ((arch-patch (lambda (name revision hash) @@ -260,14 +260,13 @@ copied to their outputs; otherwise the TEXLIVE-BUILD-SYSTEM is used." "&id=" revision)) (file-name (string-append "texlive-bin-" name)) (sha256 (base32 hash))))) - (arch-revision "c4b99aba97213ea554b6592a4916d3c7394a6d7b")) - (append (search-patches "texlive-bin-CVE-2018-17407.patch" - "texlive-bin-luatex-poppler-compat.patch") - (list - (arch-patch "pdftex-poppler0.76.patch" arch-revision - "15ypbh21amfsdxy7ca825x28lkmmkklxk1w660gpgvzdi7s70h0b") - (arch-patch "xetex-poppler-fixes.patch" arch-revision - "1jj1p5zkjljb7id9pjv29cw0cf8mwrgrh4ackgzz9c200vaqpsvx"))))))) + (arch-revision "49d7fe25e5ea63f136ebc20270c1d8fc9b00041c")) + (list + (arch-patch "pdftex-poppler0.76.patch" arch-revision + "03vc88dz37mjjyaspzv0fik2fp5gp8qv82114869akd1dhszbaax") + (search-patch "texlive-bin-poppler-0.83.patch") + (arch-patch "texlive-poppler-0.84.patch" arch-revision + "1ia6cr99krk4ipx4hdi2qdb98bh2h26mckjlpxdzrjnfhlnghksa")))))) (build-system gnu-build-system) (inputs `(("texlive-extra-src" ,texlive-extra-src) @@ -284,7 +283,7 @@ copied to their outputs; otherwise the TEXLIVE-BUILD-SYSTEM is used." "-checkout")) (sha256 (base32 - "0wrjls1y9b4k1z10l9l8w2l3yjcw7v7by2y16kchdpkiyldlkry6")))) + "1cj04svl8bpfwjr4gqfcc04rmklz3aggrxvgj7q5bxrh7c7g18xh")))) ("cairo" ,cairo) ("fontconfig" ,fontconfig) ("fontforge" ,fontforge) @@ -362,18 +361,13 @@ copied to their outputs; otherwise the TEXLIVE-BUILD-SYSTEM is used." (copy-file "texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc" "texk/web2c/pdftexdir/pdftosrc.cc") #t)) - (add-after 'use-code-for-new-poppler 'use-code-for-even-newer-poppler + (add-after 'unpack 'patch-dvisvgm-build-files (lambda _ - ;; Adjust for deprecated types in Poppler 0.73 and later. - (substitute* (append - (find-files "texk/web2c/luatexdir/" "\\.(cc|w)$") - '("texk/web2c/pdftexdir/pdftosrc.cc")) - (("GBool") "bool") - (("gFalse") "false") - (("gTrue") "true") - (("getCString") "c_str") - (("Guint") "unsigned int") - (("Guchar") "unsigned char")) + ;; XXX: Ghostscript is detected, but HAVE_LIBGS is never set, so + ;; the appropriate linker flags are not added. + (substitute* "texk/dvisvgm/configure" + (("^have_libgs=yes" all) + (string-append all "\nHAVE_LIBGS=1"))) #t)) (add-after 'unpack 'disable-failing-test (lambda _ -- 2.24.1 From 8300b90d94a02c17e65a81ac51add5f511a28d04 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 9 Jan 2020 22:38:01 +0100 Subject: [PATCH 4/5] gnu: texlive-bin: Do not build static libraries. * gnu/packages/tex.scm (texlive-bin)[arguments]: Add "--disable-static" in #:configure-flags. --- gnu/packages/tex.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm index 4ea40126ae..442baf6ed1 100644 --- a/gnu/packages/tex.scm +++ b/gnu/packages/tex.scm @@ -314,7 +314,8 @@ copied to their outputs; otherwise the TEXLIVE-BUILD-SYSTEM is used." (arguments `(#:out-of-source? #t #:configure-flags - `("--disable-native-texlive-build" + '("--disable-static" + "--disable-native-texlive-build" "--with-system-cairo" "--with-system-freetype2" "--with-system-gd" -- 2.24.1 From 0b1558e9f388a3d7787d0ea629ce685468e73e86 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 9 Jan 2020 22:38:35 +0100 Subject: [PATCH 5/5] gnu: texlive-bin: Purge unused bundled software from the source. * gnu/packages/tex.scm (texlive-bin)[source](modules, snippet): New fields. --- gnu/packages/tex.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm index 442baf6ed1..b3703d1c4f 100644 --- a/gnu/packages/tex.scm +++ b/gnu/packages/tex.scm @@ -266,7 +266,22 @@ copied to their outputs; otherwise the TEXLIVE-BUILD-SYSTEM is used." "03vc88dz37mjjyaspzv0fik2fp5gp8qv82114869akd1dhszbaax") (search-patch "texlive-bin-poppler-0.83.patch") (arch-patch "texlive-poppler-0.84.patch" arch-revision - "1ia6cr99krk4ipx4hdi2qdb98bh2h26mckjlpxdzrjnfhlnghksa")))))) + "1ia6cr99krk4ipx4hdi2qdb98bh2h26mckjlpxdzrjnfhlnghksa")))) + (modules '((guix build utils) + (ice-9 ftw))) + (snippet + '(begin + (with-directory-excursion "libs" + (let ((preserved-directories '("." ".." "lua53" "luajit"))) + ;; Delete bundled software, except Lua which cannot easily be + ;; used as an external dependency. + (for-each delete-file-recursively + (scandir "." + (lambda (file) + (and (not (member file preserved-directories)) + (eq? 'directory (stat:type (stat file))))))))) + ;; TODO: Unbundle stuff in texk/dvisvgm/dvisvgm-src/libs too. + #t)))) (build-system gnu-build-system) (inputs `(("texlive-extra-src" ,texlive-extra-src) -- 2.24.1