summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/abiword-black-drawing-with-gtk322.patch49
-rw-r--r--gnu/packages/patches/abiword-explictly-cast-bools.patch14
-rw-r--r--gnu/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch514
-rw-r--r--gnu/packages/patches/cool-retro-term-dont-check-uninit-member.patch33
-rw-r--r--gnu/packages/patches/cool-retro-term-fix-array-size.patch25
-rw-r--r--gnu/packages/patches/cool-retro-term-memory-leak-1.patch32
-rw-r--r--gnu/packages/patches/cool-retro-term-remove-non-free-fonts.patch205
-rw-r--r--gnu/packages/patches/dvd+rw-tools-add-include.patch14
-rw-r--r--gnu/packages/patches/elixir-disable-failing-tests.patch145
-rw-r--r--gnu/packages/patches/gnome-shell-CVE-2017-8288.patch54
-rw-r--r--gnu/packages/patches/icecat-bug-1299500-pt10.patch1639
-rw-r--r--gnu/packages/patches/libsndfile-CVE-2017-8361-8363-8365.patch77
-rw-r--r--gnu/packages/patches/libsndfile-CVE-2017-8362.patch61
-rw-r--r--gnu/packages/patches/libtiff-CVE-2017-7593.patch113
-rw-r--r--gnu/packages/patches/libtiff-CVE-2017-7594.patch54
-rw-r--r--gnu/packages/patches/libtiff-multiple-UBSAN-crashes.patch449
-rw-r--r--gnu/packages/patches/libtirpc-CVE-2017-8779.patch263
-rw-r--r--gnu/packages/patches/lierolibre-check-unaligned-access.patch30
-rw-r--r--gnu/packages/patches/lierolibre-is-free-software.patch38
-rw-r--r--gnu/packages/patches/lierolibre-newer-libconfig.patch190
-rw-r--r--gnu/packages/patches/lierolibre-remove-arch-warning.patch30
-rw-r--r--gnu/packages/patches/lierolibre-try-building-other-arch.patch56
-rw-r--r--gnu/packages/patches/llvm-3.5-fix-clang-build-with-gcc5.patch35
-rw-r--r--gnu/packages/patches/lvm2-static-link.patch4
-rw-r--r--gnu/packages/patches/lxterminal-CVE-2016-10369.patch37
-rw-r--r--gnu/packages/patches/miniupnpc-CVE-2017-8798.patch55
-rw-r--r--gnu/packages/patches/mozjs38-pkg-config-version.patch24
-rw-r--r--gnu/packages/patches/mozjs38-shell-version.patch67
-rw-r--r--gnu/packages/patches/mozjs38-tracelogger.patch608
-rw-r--r--gnu/packages/patches/mozjs38-version-detection.patch180
-rw-r--r--gnu/packages/patches/pcre2-CVE-2017-8786.patch155
-rw-r--r--gnu/packages/patches/perl-net-dns-resolver-programmable-fix.patch (renamed from gnu/packages/patches/perl-net-dns-resolver-programmable-Fix-broken-interface.patch)0
-rw-r--r--gnu/packages/patches/proot-test-fhs.patch98
-rw-r--r--gnu/packages/patches/reptyr-fix-gcc-7.patch38
-rw-r--r--gnu/packages/patches/rpcbind-CVE-2017-8779.patch29
35 files changed, 3706 insertions, 1709 deletions
diff --git a/gnu/packages/patches/abiword-black-drawing-with-gtk322.patch b/gnu/packages/patches/abiword-black-drawing-with-gtk322.patch
new file mode 100644
index 0000000000..88a5ca4c38
--- /dev/null
+++ b/gnu/packages/patches/abiword-black-drawing-with-gtk322.patch
@@ -0,0 +1,49 @@
+commit 2ee38d1881aeea27bb49acc450631d813d1f28ba
+Author: Hubert Figuière <hub@figuiere.net>
+Date: Wed Dec 7 09:44:01 2016 -0500
+
+ Bug 13815 - draw event should return TRUE
+
+ This fix the black drawing regression witj Gtk3.22
+
+diff --git a/src/af/xap/gtk/xap_UnixFrameImpl.cpp b/src/af/xap/gtk/xap_UnixFrameImpl.cpp
+index 780000e..10f8e00 100644
+--- a/src/af/xap/gtk/xap_UnixFrameImpl.cpp
++++ b/src/af/xap/gtk/xap_UnixFrameImpl.cpp
+@@ -1208,9 +1208,9 @@ gint XAP_UnixFrameImpl::_fe::delete_event(GtkWidget * w, GdkEvent * /*event*/, g
+ }
+
+ #if GTK_CHECK_VERSION(3,0,0)
+-gint XAP_UnixFrameImpl::_fe::draw(GtkWidget * w, cairo_t * cr)
++gboolean XAP_UnixFrameImpl::_fe::draw(GtkWidget * w, cairo_t * cr)
+ #else
+-gint XAP_UnixFrameImpl::_fe::expose(GtkWidget * w, GdkEventExpose* pExposeEvent)
++gboolean XAP_UnixFrameImpl::_fe::expose(GtkWidget * w, GdkEventExpose* pExposeEvent)
+ #endif
+ {
+ XAP_UnixFrameImpl * pUnixFrameImpl = static_cast<XAP_UnixFrameImpl *>(g_object_get_data(G_OBJECT(w), "user_data"));
+@@ -1243,7 +1243,7 @@ gint XAP_UnixFrameImpl::_fe::expose(GtkWidget * w, GdkEventExpose* pExposeEvent)
+ pView->draw(&rClip);
+ #endif
+ }
+- return FALSE;
++ return TRUE;
+ }
+
+ static bool bScrollWait = false;
+diff --git a/src/af/xap/gtk/xap_UnixFrameImpl.h b/src/af/xap/gtk/xap_UnixFrameImpl.h
+index 30ee5d8..a0ff57f 100644
+--- a/src/af/xap/gtk/xap_UnixFrameImpl.h
++++ b/src/af/xap/gtk/xap_UnixFrameImpl.h
+@@ -152,9 +152,9 @@ protected:
+ static gint key_release_event(GtkWidget* w, GdkEventKey* e);
+ static gint delete_event(GtkWidget * w, GdkEvent * /*event*/, gpointer /*data*/);
+ #if GTK_CHECK_VERSION(3,0,0)
+- static gint draw(GtkWidget * w, cairo_t * cr);
++ static gboolean draw(GtkWidget * w, cairo_t * cr);
+ #else
+- static gint expose(GtkWidget * w, GdkEventExpose* pExposeEvent);
++ static gboolean expose(GtkWidget * w, GdkEventExpose* pExposeEvent);
+ #endif
+ static gint do_ZoomUpdate( gpointer /* xap_UnixFrame * */ p);
+ static void vScrollChanged(GtkAdjustment * w, gpointer /*data*/);
diff --git a/gnu/packages/patches/abiword-explictly-cast-bools.patch b/gnu/packages/patches/abiword-explictly-cast-bools.patch
index 7927a180ba..97ae6653c2 100644
--- a/gnu/packages/patches/abiword-explictly-cast-bools.patch
+++ b/gnu/packages/patches/abiword-explictly-cast-bools.patch
@@ -2,18 +2,18 @@ As of JPEG-9, the type 'boolean' is an enumeration, but since glib defines
TRUE and FALSE as numeric constants and this is C++, they need to be explicitly
casted.
---- a/src/af/util/xp/ut_jpeg.cpp 2009-07-08 19:33:53.000000000 +0200
-+++ b/src/af/util/xp/ut_jpeg.cpp 2014-09-06 19:55:55.876997404 +0200
-@@ -102,7 +102,7 @@
+--- a/src/af/util/xp/ut_jpeg.cpp
++++ b/src/af/util/xp/ut_jpeg.cpp
+@@ -102,7 +102,7 @@ static boolean _jpegFillInputBuffer (j_decompress_ptr cinfo)
src->pub.next_input_byte = src->sourceBuf->getPointer (src->pos);
src->pub.bytes_in_buffer = src->sourceBuf->getLength ();
-
-- return TRUE;
+
+- return 1; // boolean is a libjpeg type that is an int.
+ return (boolean)TRUE;
}
/*
-@@ -161,7 +161,7 @@
+@@ -161,7 +161,7 @@ bool UT_JPEG_getDimensions(const UT_ByteBuf* pBB, UT_sint32& iImageWidth,
/* set the data source */
_JPEG_ByteBufSrc (&cinfo, pBB);
@@ -22,7 +22,7 @@ casted.
jpeg_start_decompress(&cinfo);
iImageWidth = cinfo.output_width;
iImageHeight = cinfo.output_height;
-@@ -189,7 +189,7 @@
+@@ -189,7 +189,7 @@ bool UT_JPEG_getRGBData(const UT_ByteBuf* pBB, UT_Byte* pDest, UT_sint32 iDestRo
/* set the data source */
_JPEG_ByteBufSrc (&cinfo, pBB);
diff --git a/gnu/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch b/gnu/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch
new file mode 100644
index 0000000000..9c817d4198
--- /dev/null
+++ b/gnu/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch
@@ -0,0 +1,514 @@
+Patch for version 3.01, taken from upstream at
+https://sourceforge.net/projects/cdrtools/files/cdrtools-3.01-fix-20151126-mkisofs-isoinfo.patch
+
+--- cdrtools-3.01.orig/mkisofs/diag/isoinfo.c 2015-07-22 20:36:45.000000000 +0000
++++ cdrtools-3.01/mkisofs/diag/isoinfo.c 2015-11-17 19:35:40.000000000 +0000
+@@ -1,8 +1,8 @@
+-/* @(#)isoinfo.c 1.95 15/07/22 joerg */
++/* @(#)isoinfo.c 1.100 15/11/17 joerg */
+ #include <schily/mconfig.h>
+ #ifndef lint
+ static UConst char sccsid[] =
+- "@(#)isoinfo.c 1.95 15/07/22 joerg";
++ "@(#)isoinfo.c 1.100 15/11/17 joerg";
+ #endif
+ /*
+ * File isodump.c - dump iso9660 directory information.
+@@ -148,8 +148,10 @@ LOCAL char er_id[256];
+ LOCAL int su_version = 0;
+ LOCAL int rr_version = 0;
+ LOCAL int aa_version = 0;
++LOCAL int cl_extent = 0;
+ LOCAL int ucs_level = 0;
+ LOCAL BOOL iso9660_inodes = FALSE;
++LOCAL uid_t myuid;
+
+ #ifdef USE_FIND
+ LOCAL findn_t *find_node; /* syntaxtree from find_parse() */
+@@ -208,6 +210,9 @@ LOCAL void extract __PR((char *rootname
+ LOCAL void extract_file __PR((int f,
+ struct iso_directory_record * idr,
+ char *fname));
++LOCAL void parse_cl_dir __PR((struct iso_directory_record *idr,
++ int extent));
++LOCAL BOOL parse_de __PR((struct iso_directory_record *idr));
+ LOCAL void parse_dir __PR((char * rootname, int extent, int len));
+ LOCAL void usage __PR((int excode));
+ EXPORT int main __PR((int argc, char *argv[]));
+@@ -459,7 +464,6 @@ parse_rr(pnt, len, cont_flag)
+ int slen;
+ int xlen;
+ int ncount;
+- int cl_extent;
+ int pl_extent;
+ int cont_extent, cont_offset, cont_size;
+ int flag1, flag2;
+@@ -469,7 +473,7 @@ parse_rr(pnt, len, cont_flag)
+
+ symlinkname[0] = 0;
+
+- cont_extent = cont_offset = cont_size = 0;
++ cl_extent = cont_extent = cont_offset = cont_size = 0;
+
+ ncount = 0;
+ flag1 = -1;
+@@ -714,6 +718,7 @@ struct todo
+ };
+
+ LOCAL struct todo *todo_idr = NULL;
++LOCAL struct todo **todo_pp = &todo_idr;
+
+ LOCAL char *months[12] = {"Jan", "Feb", "Mar", "Apr",
+ "May", "Jun", "Jul",
+@@ -962,8 +967,14 @@ static BOOL isfirst = TRUE;
+ close(f);
+ return;
+ setmode:
+- fchmodat(AT_FDCWD, fname, fstat_buf.st_mode, AT_SYMLINK_NOFOLLOW);
+ fchownat(AT_FDCWD, fname, fstat_buf.st_uid, fstat_buf.st_gid, AT_SYMLINK_NOFOLLOW);
++ if (myuid != 0 && S_ISDIR(fstat_buf.st_mode)) {
++ /*
++ * Temporary hack until we have a dirstack like star.
++ */
++ fstat_buf.st_mode |= S_IWUSR;
++ }
++ fchmodat(AT_FDCWD, fname, fstat_buf.st_mode, AT_SYMLINK_NOFOLLOW);
+ times[0].tv_sec = fstat_buf.st_atime;
+ times[0].tv_nsec = stat_ansecs(&fstat_buf);
+ times[1].tv_sec = fstat_buf.st_mtime;
+@@ -1001,6 +1012,143 @@ extract_file(f, idr, fname)
+ }
+ }
+
++
++LOCAL void
++parse_cl_dir(idr, extent)
++ struct iso_directory_record *idr;
++ int extent;
++{
++ char cl_name_buf[256*3];
++
++ strlcpy(cl_name_buf, name_buf, sizeof (cl_name_buf));
++#ifdef USE_SCG
++ readsecs(extent - sector_offset, idr, 1);
++#else
++ lseek(fileno(infile), ((off_t)(extent - sector_offset)) << 11, SEEK_SET);
++ read(fileno(infile), idr, 2048);
++#endif
++
++ if (parse_de(idr) && use_rock)
++ dump_rr(idr);
++ strlcpy(name_buf, cl_name_buf, sizeof (name_buf));
++}
++
++LOCAL BOOL
++parse_de(idr)
++ struct iso_directory_record *idr;
++{
++ unsigned char uc;
++
++ if (idr->length[0] == 0)
++ return (FALSE);
++ memset(&fstat_buf, 0, sizeof (fstat_buf));
++ found_rr = 0;
++ name_buf[0] = xname[0] = 0;
++ fstat_buf.st_size = (off_t)(unsigned)isonum_733((unsigned char *)idr->size);
++ if (idr->flags[0] & 2)
++ fstat_buf.st_mode |= S_IFDIR;
++ else
++ fstat_buf.st_mode |= S_IFREG;
++ if (idr->name_len[0] == 1 && idr->name[0] == 0)
++ strcpy(name_buf, ".");
++ else if (idr->name_len[0] == 1 && idr->name[0] == 1)
++ strcpy(name_buf, "..");
++ else {
++ switch (ucs_level) {
++ case 3:
++ case 2:
++ case 1:
++ /*
++ * Unicode name. Convert as best we can.
++ */
++ {
++ int j;
++ name_buf[0] = '\0';
++#ifdef USE_ICONV
++ if (use_iconv(unls)) {
++ int u;
++ char *to = name_buf;
++
++ for (j = 0, u = 0; j < (int)idr->name_len[0] / 2; j++) {
++ char *ibuf = (char *)&idr->name[j*2];
++ size_t isize = 2; /* UCS-2 character size */
++ size_t osize = 4;
++
++ if (iconv(unls->sic_uni2cd, (__IC_CONST char **)&ibuf, &isize,
++ (char **)&to, &osize) == -1) {
++ int err = geterrno();
++
++ if ((err == EINVAL || err == EILSEQ) &&
++ osize == 4) {
++ *to = '_';
++ u += 1;
++ to++;
++ }
++ } else {
++ u += 4 - osize;
++ to = &name_buf[u];
++ }
++ }
++ j = u;
++ } else
++#endif
++ for (j = 0; j < (int)idr->name_len[0] / 2; j++) {
++ UInt16_t unichar;
++
++ unichar = (idr->name[j*2] & 0xFF) * 256 +
++ (idr->name[j*2+1] & 0xFF);
++
++ /*
++ * Get the backconverted char
++ */
++ if (unls)
++ uc = sic_uni2c(unls, unichar);
++ else
++ uc = unichar > 255 ? '_' : unichar;
++
++ name_buf[j] = uc ? uc : '_';
++ }
++ name_buf[j] = '\0';
++ }
++ break;
++ case 0:
++ /*
++ * Normal non-Unicode name.
++ */
++ strncpy(name_buf, idr->name, idr->name_len[0]);
++ name_buf[idr->name_len[0]] = 0;
++ break;
++ default:
++ /*
++ * Don't know how to do these yet. Maybe they are the same
++ * as one of the above.
++ */
++ exit(1);
++ }
++ }
++ memcpy(date_buf, idr->date, 9);
++ /*
++ * Always first set up time stamps and file modes from
++ * ISO-9660. This is used as a fallback in case that
++ * there is no related Rock Ridge based data.
++ */
++ fstat_buf.st_atime =
++ fstat_buf.st_mtime =
++ fstat_buf.st_ctime = iso9660_time(date_buf, NULL, FALSE);
++ fstat_buf.st_mode |= S_IRUSR|S_IXUSR |
++ S_IRGRP|S_IXGRP |
++ S_IROTH|S_IXOTH;
++ fstat_buf.st_nlink = 1;
++ fstat_buf.st_ino = 0;
++ fstat_buf.st_uid = 0;
++ fstat_buf.st_gid = 0;
++ if (iso9660_inodes) {
++ fstat_buf.st_ino = (unsigned long)
++ isonum_733((unsigned char *)idr->extent);
++ }
++ return (TRUE);
++}
++
+ LOCAL void
+ parse_dir(rootname, extent, len)
+ char *rootname;
+@@ -1012,12 +1160,13 @@ parse_dir(rootname, extent, len)
+ struct iso_directory_record * idr;
+ struct iso_directory_record didr;
+ struct stat dstat;
+- unsigned char uc;
++ unsigned char cl_buffer[2048];
+ unsigned char flags = 0;
+ Llong size = 0;
+ int sextent = 0;
+ int rlen;
+ int blen;
++ int rr_flags = 0;
+ static char *n = 0;
+ static int nlen = 0;
+
+@@ -1039,115 +1188,23 @@ static int nlen = 0;
+ i = 0;
+ while (1 == 1) {
+ idr = (struct iso_directory_record *) &buffer[i];
+- if (idr->length[0] == 0) break;
+- memset(&fstat_buf, 0, sizeof (fstat_buf));
+- found_rr = 0;
+- name_buf[0] = xname[0] = 0;
+- fstat_buf.st_size = (off_t)(unsigned)isonum_733((unsigned char *)idr->size);
+- if (idr->flags[0] & 2)
+- fstat_buf.st_mode |= S_IFDIR;
+- else
+- fstat_buf.st_mode |= S_IFREG;
+- if (idr->name_len[0] == 1 && idr->name[0] == 0)
+- strcpy(name_buf, ".");
+- else if (idr->name_len[0] == 1 && idr->name[0] == 1)
+- strcpy(name_buf, "..");
+- else {
+- switch (ucs_level) {
+- case 3:
+- case 2:
+- case 1:
+- /*
+- * Unicode name. Convert as best we can.
+- */
+- {
+- int j;
+-
+- name_buf[0] = '\0';
+-#ifdef USE_ICONV
+- if (use_iconv(unls)) {
+- int u;
+- char *to = name_buf;
+-
+- for (j = 0, u = 0; j < (int)idr->name_len[0] / 2; j++) {
+- char *ibuf = (char *)&idr->name[j*2];
+- size_t isize = 2; /* UCS-2 character size */
+- size_t osize = 4;
+-
+- if (iconv(unls->sic_uni2cd, (__IC_CONST char **)&ibuf, &isize,
+- (char **)&to, &osize) == -1) {
+- int err = geterrno();
+-
+- if ((err == EINVAL || err == EILSEQ) &&
+- osize == 4) {
+- *to = '_';
+- u += 1;
+- to++;
+- }
+- } else {
+- u += 4 - osize;
+- to = &name_buf[u];
+- }
+- }
+- j = u;
+- } else
+-#endif
+- for (j = 0; j < (int)idr->name_len[0] / 2; j++) {
+- UInt16_t unichar;
+-
+- unichar = (idr->name[j*2] & 0xFF) * 256 +
+- (idr->name[j*2+1] & 0xFF);
+-
+- /*
+- * Get the backconverted char
+- */
+- if (unls)
+- uc = sic_uni2c(unls, unichar);
+- else
+- uc = unichar > 255 ? '_' : unichar;
++ if (idr->length[0] == 0)
++ break;
++ parse_de(idr);
++ if (use_rock) {
++ rr_flags = dump_rr(idr);
+
+- name_buf[j] = uc ? uc : '_';
+- }
+- name_buf[j] = '\0';
+- }
+- break;
+- case 0:
++ if (rr_flags & RR_FLAG_CL) {
+ /*
+- * Normal non-Unicode name.
++ * Need to reparse the child link
++ * but note that we parse "CL/."
++ * so we get no usable file name.
+ */
+- strncpy(name_buf, idr->name, idr->name_len[0]);
+- name_buf[idr->name_len[0]] = 0;
+- break;
+- default:
+- /*
+- * Don't know how to do these yet. Maybe they are the same
+- * as one of the above.
+- */
+- exit(1);
+- }
++ idr = (struct iso_directory_record *) cl_buffer;
++ parse_cl_dir(idr, cl_extent);
++ } else if (rr_flags & RR_FLAG_RE)
++ goto cont; /* skip rr_moved */
+ }
+- memcpy(date_buf, idr->date, 9);
+- /*
+- * Always first set up time stamps and file modes from
+- * ISO-9660. This is used as a fallback in case that
+- * there is no related Rock Ridge based data.
+- */
+- fstat_buf.st_atime =
+- fstat_buf.st_mtime =
+- fstat_buf.st_ctime = iso9660_time(date_buf, NULL, FALSE);
+- fstat_buf.st_mode |= S_IRUSR|S_IXUSR |
+- S_IRGRP|S_IXGRP |
+- S_IROTH|S_IXOTH;
+- fstat_buf.st_nlink = 1;
+- fstat_buf.st_ino = 0;
+- fstat_buf.st_uid = 0;
+- fstat_buf.st_gid = 0;
+- if (iso9660_inodes) {
+- fstat_buf.st_ino = (unsigned long)
+- isonum_733((unsigned char *)idr->extent);
+- }
+- if (use_rock)
+- dump_rr(idr);
+ if (Xtract &&
+ (idr->flags[0] & 2) != 0 &&
+ idr->name_len[0] == 1 &&
+@@ -1170,30 +1227,30 @@ static int nlen = 0;
+ n[rlen] = '\0';
+
+ if ((idr->flags[0] & 2) != 0 &&
+- (idr->name_len[0] != 1 ||
++ ((rr_flags & RR_FLAG_CL) ||
++ idr->name_len[0] != 1 ||
+ (idr->name[0] != 0 && idr->name[0] != 1))) {
+ /*
+ * This is a plain directory (neither "xxx/."
+ * nor "xxx/..").
+ * Add this directory to the todo list.
+ */
+- td = todo_idr;
+- if (td != NULL) {
+- while (td->next != NULL)
+- td = td->next;
+- td->next = (struct todo *) malloc(sizeof (*td));
+- td = td->next;
+- } else {
+- todo_idr = td = (struct todo *) malloc(sizeof (*td));
+- }
++ td = (struct todo *) malloc(sizeof (*td));
++ if (td == NULL)
++ comerr(_("No memory.\n"));
+ td->next = NULL;
+ td->extent = isonum_733((unsigned char *)idr->extent);
+ td->length = isonum_733((unsigned char *)idr->size);
+ td->name = (char *) malloc(strlen(rootname)
+ + strlen(name_buf) + 2);
++ if (td->name == NULL)
++ comerr(_("No memory.\n"));
+ strcpy(td->name, rootname);
+ strcat(td->name, name_buf);
+ strcat(td->name, "/");
++
++ *todo_pp = td;
++ todo_pp = &td->next;
+ } else {
+ if (xtract && strcmp(xtract, n) == 0) {
+ extract_file(STDOUT_FILENO, idr, "stdout");
+@@ -1253,6 +1310,7 @@ static int nlen = 0;
+ if ((idr->flags[0] & ISO_MULTIEXTENT) == 0)
+ size = 0;
+ }
++ cont:
+ i += buffer[i];
+ if (i > 2048 - offsetof(struct iso_directory_record, name[0])) break;
+ }
+@@ -1381,12 +1439,13 @@ main(argc, argv)
+ usage(0);
+ if (prvers) {
+ printf(_("isoinfo %s (%s-%s-%s) Copyright (C) 1993-1999 %s (C) 1999-2015 %s\n"),
+- VERSION,
++ "3.02a02",
+ HOST_CPU, HOST_VENDOR, HOST_OS,
+ _("Eric Youngdale"),
+ _("Joerg Schilling"));
+ exit(0);
+ }
++ myuid = getuid();
+ #ifdef USE_FIND
+ if (do_find) {
+ finda_t fa;
+--- cdrtools-3.01.orig/mkisofs/udf.c 2013-04-24 20:45:18.000000000 +0000
++++ cdrtools-3.01/mkisofs/udf.c 2015-11-25 22:07:30.000000000 +0000
+@@ -1,15 +1,15 @@
+-/* @(#)udf.c 1.42 13/04/24 Copyright 2001-2013 J. Schilling */
++/* @(#)udf.c 1.43 15/11/25 Copyright 2001-2015 J. Schilling */
+ #include <schily/mconfig.h>
+ #ifndef lint
+ static UConst char sccsid[] =
+- "@(#)udf.c 1.42 13/04/24 Copyright 2001-2013 J. Schilling";
++ "@(#)udf.c 1.43 15/11/25 Copyright 2001-2015 J. Schilling";
+ #endif
+ /*
+ * udf.c - UDF support for mkisofs
+ *
+ * Written by Ben Rudiak-Gould (2001).
+ *
+- * Copyright 2001-2013 J. Schilling.
++ * Copyright 2001-2015 J. Schilling.
+ */
+ /*
+ * This program is free software; you can redistribute it and/or modify
+@@ -98,7 +98,7 @@ static UConst char sccsid[] =
+ extern int use_sparcboot;
+
+ extern struct directory *root;
+-extern time_t begun;
++extern struct timeval tv_begun;
+
+ static unsigned lba_main_seq;
+ static unsigned lba_main_seq_copy;
+@@ -110,7 +110,7 @@ static unsigned lba_end_anchor_vol_desc;
+ static unsigned num_udf_files;
+ static unsigned num_udf_directories;
+
+-static unsigned volume_set_id[2];
++static unsigned volume_set_id[2] = { 0, 0 };
+
+ #define UDF_MAIN_SEQ_LENGTH (16)
+ #define UDF_INTEG_SEQ_LENGTH (2)
+@@ -723,7 +723,7 @@ set_primary_vol_desc(buf, lba)
+ /*pvd->volume_abstract;*/
+ /*pvd->volume_copyright_notice;*/
+ /*pvd->application_ident;*/
+- set_timestamp_from_time_t(&pvd->recording_date_and_time, begun);
++ set_timestamp_from_time_t(&pvd->recording_date_and_time, tv_begun.tv_sec);
+ set_impl_ident(&pvd->impl_ident);
+ set_tag(&pvd->desc_tag, UDF_TAGID_PRIMARY_VOLUME_DESC, lba, 512);
+ }
+@@ -831,7 +831,7 @@ set_logical_vol_integrity_desc(buf, lba)
+ udf_logical_volume_integrity_desc *lvid =
+ (udf_logical_volume_integrity_desc *)buf;
+
+- set_timestamp_from_time_t(&lvid->recording_date, begun);
++ set_timestamp_from_time_t(&lvid->recording_date, tv_begun.tv_sec);
+ set32(&lvid->integrity_type, UDF_INTEGRITY_TYPE_CLOSE);
+ /*lvid->next_integrity_extent;*/
+ set64(&lvid->logical_volume_contents_use.unique_id,
+@@ -859,7 +859,7 @@ set_file_set_desc(buf, rba)
+ {
+ udf_file_set_desc *fsd = (udf_file_set_desc *)buf;
+
+- set_timestamp_from_time_t(&fsd->recording_date_and_time, begun);
++ set_timestamp_from_time_t(&fsd->recording_date_and_time, tv_begun.tv_sec);
+ set16(&fsd->interchange_level, 3);
+ set16(&fsd->maximum_interchange_level, 3);
+ set32(&fsd->character_set_list, 1);
+@@ -1986,8 +1986,10 @@ udf_main_seq_write(out)
+ * volume_set_id needs to be set to a (64-bit) "unique" number.
+ * This will have to do for now.
+ */
+- volume_set_id[0] = begun;
+- volume_set_id[1] = (unsigned)clock(); /* XXX Maybe non-portable */
++ if (volume_set_id[0] == 0) {
++ volume_set_id[0] = tv_begun.tv_sec;
++ volume_set_id[1] = (unsigned)tv_begun.tv_usec;
++ }
+
+ memset(buf, 0, sizeof (buf));
+ set_primary_vol_desc(buf, last_extent_written++);
+--- cdrtools-3.01.orig/mkisofs/mkisofs.c 2015-01-01 14:19:51.000000000 +0000
++++ cdrtools-3.01/mkisofs/mkisofs.c
+@@ -69 +69 @@ int path_ind;
+-char version_string[] = VERSION;
++char version_string[] = "3.01-fix-20151126";
diff --git a/gnu/packages/patches/cool-retro-term-dont-check-uninit-member.patch b/gnu/packages/patches/cool-retro-term-dont-check-uninit-member.patch
new file mode 100644
index 0000000000..c6e1d27315
--- /dev/null
+++ b/gnu/packages/patches/cool-retro-term-dont-check-uninit-member.patch
@@ -0,0 +1,33 @@
+From 126a97d1f22f7d784d392b2b7d5aadf0a4e18c0d Mon Sep 17 00:00:00 2001
+From: Petter <petter@mykolab.ch>
+Date: Thu, 27 Apr 2017 20:28:02 +0200
+Subject: [PATCH] Avoid checking uninitialized member + simplify condition
+
+---
+ qmltermwidget/lib/TerminalDisplay.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/qmltermwidget/lib/TerminalDisplay.cpp b/qmltermwidget/lib/TerminalDisplay.cpp
+index 189a609..36d2cd2 100644
+--- a/qmltermwidget/lib/TerminalDisplay.cpp
++++ b/qmltermwidget/lib/TerminalDisplay.cpp
+@@ -325,6 +325,7 @@ TerminalDisplay::TerminalDisplay(QQuickItem *parent)
+ ,_terminalSizeHint(false)
+ ,_terminalSizeStartup(true)
+ ,_bidiEnabled(false)
++,_mouseMarks(false)
+ ,_actSel(0)
+ ,_wordSelectionMode(false)
+ ,_lineSelectionMode(false)
+@@ -1846,7 +1847,7 @@ void TerminalDisplay::mousePressEvent(QMouseEvent* ev)
+ }
+ else if ( ev->button() == Qt::MidButton )
+ {
+- if ( _mouseMarks || (!_mouseMarks && (ev->modifiers() & Qt::ShiftModifier)) )
++ if ( _mouseMarks || (ev->modifiers() & Qt::ShiftModifier) )
+ emitSelection(true,ev->modifiers() & Qt::ControlModifier);
+ else
+ emit mouseSignal( 1, charColumn +1, charLine +1 +_scrollBar->value() -_scrollBar->maximum() , 0);
+--
+2.12.2
+
diff --git a/gnu/packages/patches/cool-retro-term-fix-array-size.patch b/gnu/packages/patches/cool-retro-term-fix-array-size.patch
new file mode 100644
index 0000000000..04a2a27971
--- /dev/null
+++ b/gnu/packages/patches/cool-retro-term-fix-array-size.patch
@@ -0,0 +1,25 @@
+From c91d7ae5dbb00c8392a9f93283dc56c3e296cccd Mon Sep 17 00:00:00 2001
+From: Petter <petter@mykolab.ch>
+Date: Thu, 27 Apr 2017 20:19:21 +0200
+Subject: [PATCH] Fix size of the array passed to memset()
+
+---
+ qmltermwidget/lib/History.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/qmltermwidget/lib/History.cpp b/qmltermwidget/lib/History.cpp
+index 0f9c13f..ab6f7be 100644
+--- a/qmltermwidget/lib/History.cpp
++++ b/qmltermwidget/lib/History.cpp
+@@ -515,7 +515,7 @@ void HistoryScrollBlockArray::addCells(const Character a[], int count)
+ // put cells in block's data
+ assert((count * sizeof(Character)) < ENTRIES);
+
+- memset(b->data, 0, ENTRIES);
++ memset(b->data, 0, sizeof(b->data));
+
+ memcpy(b->data, a, count * sizeof(Character));
+ b->size = count * sizeof(Character);
+--
+2.12.2
+
diff --git a/gnu/packages/patches/cool-retro-term-memory-leak-1.patch b/gnu/packages/patches/cool-retro-term-memory-leak-1.patch
new file mode 100644
index 0000000000..f3fbac17de
--- /dev/null
+++ b/gnu/packages/patches/cool-retro-term-memory-leak-1.patch
@@ -0,0 +1,32 @@
+From 08628fda19128b75248548357e416bc373f14f91 Mon Sep 17 00:00:00 2001
+From: Yen Chi Hsuan <yan12125@gmail.com>
+Date: Sat, 18 Mar 2017 02:50:34 +0800
+Subject: [PATCH] Fix memory leak in hotspot (URLs & emails) detection
+
+---
+ qmltermwidget/lib/Filter.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/qmltermwidget/lib/Filter.cpp b/qmltermwidget/lib/Filter.cpp
+index 5ca7bee..2e8d2fb 100644
+--- a/qmltermwidget/lib/Filter.cpp
++++ b/qmltermwidget/lib/Filter.cpp
+@@ -26,6 +26,7 @@
+ // Qt
+ #include <QAction>
+ #include <QApplication>
++#include <QtAlgorithms>
+ #include <QClipboard>
+ #include <QString>
+ #include <QTextStream>
+@@ -194,6 +195,7 @@ Filter::~Filter()
+ }
+ void Filter::reset()
+ {
++ qDeleteAll(_hotspotList);
+ _hotspots.clear();
+ _hotspotList.clear();
+ }
+--
+2.12.2
+
diff --git a/gnu/packages/patches/cool-retro-term-remove-non-free-fonts.patch b/gnu/packages/patches/cool-retro-term-remove-non-free-fonts.patch
new file mode 100644
index 0000000000..7a033df413
--- /dev/null
+++ b/gnu/packages/patches/cool-retro-term-remove-non-free-fonts.patch
@@ -0,0 +1,205 @@
+From 96ceffdfdcedd3ae33c46b11357aa2518e0a6152 Mon Sep 17 00:00:00 2001
+From: Petter <petter@mykolab.ch>
+Date: Thu, 27 Apr 2017 18:55:10 +0200
+Subject: [PATCH] Remove non-free fonts from settings menu
+
+--- a/app/qml/ApplicationSettings.qml
++++ b/app/qml/ApplicationSettings.qml
+@@ -409,7 +409,7 @@
+ obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"TERMINUS_SCALED","fontColor":"#0ccc68","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.2,"horizontalSync":0.16,"jitter":0.18,"burnIn":0.45,"staticNoise":0.1,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+ }
+- ListElement{
++ /*ListElement{
+ text: "Default Scanlines"
+ obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.1,"contrast":0.85,"fontName":"COMMODORE_PET","fontColor":"#00ff5b","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.2,"horizontalSync":0.14,"jitter":0.11,"burnIn":0.4,"staticNoise":0.05,"rasterization":1,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+@@ -433,7 +433,7 @@
+ text: "IBM Dos"
+ obj_string: '{"ambientLight":0.16,"backgroundColor":"#000000","bloom":0.4,"brightness":0.5,"flickering":0.07,"contrast":0.85,"fontName":"IBM_DOS","fontColor":"#ffffff","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0.13,"horizontalSync":0,"jitter":0.16,"burnIn":0.3,"staticNoise":0.03,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":1,"saturationColor":0,"rbgShift":0.35,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+ builtin: true
+- }
++ }*/
+ ListElement{
+ text: "IBM 3278"
+ obj_string: '{"ambientLight":0.1,"backgroundColor":"#000000","bloom":0.15,"brightness":0.5,"flickering":0,"contrast":0.85,"fontName":"IBM_3278","fontColor":"#0ccc68","frameName":"SIMPLE_WHITE_FRAME","glowingLine":0,"horizontalSync":0,"jitter":0,"burnIn":0.6,"staticNoise":0,"rasterization":0,"screenCurvature":0.1,"windowOpacity":1,"chromaColor":0,"saturationColor":0,"rbgShift":0,"fontWidth":1.0,"useCustomCommand":false,"customCommand":""}'
+diff --git a/app/qml/FontPixels.qml b/app/qml/FontPixels.qml
+index 6ff85da..6f0d0ba 100644
+--- a/app/qml/FontPixels.qml
++++ b/app/qml/FontPixels.qml
+@@ -32,7 +32,7 @@ QtObject{
+ property bool lowResolutionFont: true
+
+ property ListModel fontlist: ListModel{
+- ListElement{
++ /*ListElement{
+ name: "COMMODORE_PET"
+ text: "Commodore PET (1977)"
+ source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
+@@ -40,7 +40,7 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.8
+- }
++ }*/
+ ListElement{
+ name: "PROGGY_TINY"
+ text: "Proggy Tiny (Modern)"
+@@ -68,7 +68,7 @@ QtObject{
+ baseScaling: 3.0
+ fontWidth: 1.0
+ }
+- ListElement{
++ /*ListElement{
+ name: "APPLE_II"
+ text: "Apple ][ (1977)"
+ source: "fonts/1977-apple2/PrintChar21.ttf"
+@@ -76,8 +76,8 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.9
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "ATARI_400"
+ text: "Atari 400-800 (1979)"
+ source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
+@@ -85,8 +85,8 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.8
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "COMMODORE_64"
+ text: "Commodore 64 (1982)"
+ source: "fonts/1982-commodore64/C64_Pro_Mono_v1.0-STYLE.ttf"
+@@ -94,6 +94,6 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.8
+- }
++ }*/
+ }
+ }
+diff --git a/app/qml/FontScanlines.qml b/app/qml/FontScanlines.qml
+index eebf00b..410d7b6 100644
+--- a/app/qml/FontScanlines.qml
++++ b/app/qml/FontScanlines.qml
+@@ -32,7 +32,7 @@ QtObject{
+ property bool lowResolutionFont: true
+
+ property ListModel fontlist: ListModel{
+- ListElement{
++ /*ListElement{
+ name: "COMMODORE_PET"
+ text: "Commodore PET (1977)"
+ source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
+@@ -40,7 +40,7 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.7
+- }
++ }*/
+ ListElement{
+ name: "PROGGY_TINY"
+ text: "Proggy Tiny (Modern)"
+@@ -68,7 +68,7 @@ QtObject{
+ baseScaling: 3.0
+ fontWidth: 1.0
+ }
+- ListElement{
++ /*ListElement{
+ name: "APPLE_II"
+ text: "Apple ][ (1977)"
+ source: "fonts/1977-apple2/PrintChar21.ttf"
+@@ -76,8 +76,8 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.8
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "ATARI_400"
+ text: "Atari 400-800 (1979)"
+ source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
+@@ -85,8 +85,8 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.7
+- }
+- ListElement{
++ }*/
++ /*ListElement{
+ name: "COMMODORE_64"
+ text: "Commodore 64 (1982)"
+ source: "fonts/1982-commodore64/C64_Pro_Mono_v1.0-STYLE.ttf"
+@@ -94,6 +94,6 @@ QtObject{
+ pixelSize: 8
+ baseScaling: 4.0
+ fontWidth: 0.7
+- }
++ }*/
+ }
+ }
+diff --git a/app/qml/Fonts.qml b/app/qml/Fonts.qml
+index ad20844..882808a 100644
+--- a/app/qml/Fonts.qml
++++ b/app/qml/Fonts.qml
+@@ -80,7 +80,7 @@
+ fontWidth: 1.0
+ lowResolutionFont: true
+ }
+- ListElement{
++ /*ListElement{
+ name: "COMMODORE_PET_SCALED"
+ text: "Commodore PET (1977)"
+ source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
+@@ -89,7 +89,7 @@
+ baseScaling: 3.5
+ fontWidth: 0.7
+ lowResolutionFont: true
+- }
++ }*/
+ ListElement{
+ name: "PROGGY_TINY_SCALED"
+ text: "Proggy Tiny (Modern)"
+@@ -100,7 +100,7 @@
+ fontWidth: 0.9
+ lowResolutionFont: true
+ }
+- ListElement{
++ /*ListElement{
+ name: "APPLE_II_SCALED"
+ text: "Apple ][ (1977)"
+ source: "fonts/1977-apple2/PrintChar21.ttf"
+@@ -149,7 +149,7 @@
+ baseScaling: 2.0
+ fontWidth: 1.0
+ lowResolutionFont: true
+- }
++ }*/
+ ListElement{
+ name: "HERMIT"
+ text: "HD: Hermit (Modern)"
+@@ -177,7 +177,7 @@
+ fontWidth: 1.0
+ lowResolutionFont: false
+ }
+- ListElement{
++ /*ListElement{
+ name: "MONACO"
+ text: "HD: Monaco (Modern)"
+ source: "fonts/modern-monaco/monaco.ttf"
+@@ -185,7 +185,7 @@
+ pixelSize: 30
+ fontWidth: 1.0
+ lowResolutionFont: false
+- }
++ }*/
+ ListElement{
+ name: "INCONSOLATA"
+ text: "HD: Inconsolata (Modern)"
diff --git a/gnu/packages/patches/dvd+rw-tools-add-include.patch b/gnu/packages/patches/dvd+rw-tools-add-include.patch
new file mode 100644
index 0000000000..800f8f30ba
--- /dev/null
+++ b/gnu/packages/patches/dvd+rw-tools-add-include.patch
@@ -0,0 +1,14 @@
+Without <limits.h>, INT_MAX is not defined.
+
+diff --git a/transport.hxx b/transport.hxx
+index 35a57a7..838add6 100644
+--- a/transport.hxx
++++ b/transport.hxx
+@@ -11,6 +11,7 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <string.h>
++#include <limits.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
diff --git a/gnu/packages/patches/elixir-disable-failing-tests.patch b/gnu/packages/patches/elixir-disable-failing-tests.patch
index 0c67562f8d..547598b292 100644
--- a/gnu/packages/patches/elixir-disable-failing-tests.patch
+++ b/gnu/packages/patches/elixir-disable-failing-tests.patch
@@ -16,7 +16,7 @@ index 3ffd56c..1232d19 100644
@@ -39,6 +39,7 @@ end
defmodule Kernel.CLI.OptionParsingTest do
use ExUnit.Case, async: true
-
+
+ @tag :skip
test "properly parses paths" do
root = fixture_path("../../..") |> to_charlist
@@ -24,7 +24,7 @@ index 3ffd56c..1232d19 100644
@@ -57,6 +58,7 @@ end
defmodule Kernel.CLI.AtExitTest do
use ExUnit.Case, async: true
-
+
+ @tag :skip
test "invokes at_exit callbacks" do
assert elixir(fixture_path("at_exit.exs") |> to_charlist) ==
@@ -32,7 +32,7 @@ index 3ffd56c..1232d19 100644
@@ -66,6 +68,7 @@ end
defmodule Kernel.CLI.ErrorTest do
use ExUnit.Case, async: true
-
+
+ @tag :skip
test "properly format errors" do
assert :string.str('** (throw) 1', elixir('-e "throw 1"')) == 0
@@ -40,7 +40,7 @@ index 3ffd56c..1232d19 100644
@@ -86,6 +89,7 @@ defmodule Kernel.CLI.CompileTest do
{:ok, [tmp_dir_path: tmp_dir_path, beam_file_path: beam_file_path, fixture: fixture]}
end
-
+
+ @tag :skip
test "compiles code", context do
assert elixirc('#{context[:fixture]} -o #{context[:tmp_dir_path]}') == ''
@@ -48,7 +48,7 @@ index 3ffd56c..1232d19 100644
@@ -96,6 +100,7 @@ defmodule Kernel.CLI.CompileTest do
Code.delete_path context[:tmp_dir_path]
end
-
+
+ @tag :skip
test "fails on missing patterns", context do
output = elixirc('#{context[:fixture]} non_existing.ex -o #{context[:tmp_dir_path]}')
@@ -56,11 +56,11 @@ index 3ffd56c..1232d19 100644
@@ -103,6 +108,7 @@ defmodule Kernel.CLI.CompileTest do
refute File.exists?(context[:beam_file_path]), "expected the sample to not be compiled"
end
-
+
+ @tag :skip
test "fails on missing write access to .beam file", context do
compilation_args = '#{context[:fixture]} -o #{context[:tmp_dir_path]}'
-
+
diff --git a/lib/elixir/test/elixir/kernel/dialyzer_test.exs b/lib/elixir/test/elixir/kernel/dialyzer_test.exs
index 801d852..40fc5bc 100644
--- a/lib/elixir/test/elixir/kernel/dialyzer_test.exs
@@ -68,19 +68,19 @@ index 801d852..40fc5bc 100644
@@ -60,16 +60,19 @@ defmodule Kernel.DialyzerTest do
assert_dialyze_no_warnings! context
end
-
+
+ @tag :skip
test "no warnings on rewrites", context do
copy_beam! context, Dialyzer.Rewrite
assert_dialyze_no_warnings! context
end
-
+
+ @tag :skip
test "no warnings on raise", context do
copy_beam! context, Dialyzer.Raise
assert_dialyze_no_warnings! context
end
-
+
+ @tag :skip
test "no warnings on macrocallback", context do
copy_beam! context, Dialyzer.Macrocallback
@@ -94,7 +94,7 @@ index aafa559..0f9c178 100644
assert System.endianness == System.compiled_endianness
end
-
-+
++
+ @tag :skip
test "argv/0" do
list = elixir('-e "IO.inspect System.argv" -- -o opt arg1 arg2 --long-opt 10')
@@ -106,7 +106,7 @@ index fff3351..d6ed1b3 100644
@@ -244,6 +244,7 @@ defmodule Mix.DepTest do
end
end
-
+
+ @tag :skip
test "remote converger" do
deps = [{:deps_repo, "0.1.0", path: "custom/deps_repo"},
@@ -114,39 +114,12 @@ index fff3351..d6ed1b3 100644
@@ -301,6 +302,7 @@ defmodule Mix.DepTest do
end
end
-
+
+ @tag :skip
test "remote converger is not invoked if deps diverge" do
deps = [{:deps_repo, "0.1.0", path: "custom/deps_repo"},
{:git_repo, "0.2.0", git: MixTest.Case.fixture_path("git_repo"), only: :test}]
-diff --git a/lib/mix/test/mix/rebar_test.exs b/lib/mix/test/mix/rebar_test.exs
-index d2dd098..12cef15 100644
---- a/lib/mix/test/mix/rebar_test.exs
-+++ b/lib/mix/test/mix/rebar_test.exs
-@@ -120,6 +120,7 @@ defmodule Mix.RebarTest do
- assert Enum.all?(deps, &(&1.manager == :rebar3))
- end
-
-+ @tag :skip
- test "Rebar overrides" do
- Mix.Project.push(RebarOverrideAsDep)
-
-@@ -150,6 +151,7 @@ defmodule Mix.RebarTest do
- end
- end
-
-+ @tag :skip
- test "get and compile dependencies for Rebar" do
- Mix.Project.push(RebarAsDep)
-
-@@ -180,6 +182,7 @@ defmodule Mix.RebarTest do
- end
- end
-
-+ @tag :skip
- test "get and compile dependencies for rebar3" do
- Mix.Project.push(Rebar3AsDep)
-
+
diff --git a/lib/mix/test/mix/shell/io_test.exs b/lib/mix/test/mix/shell/io_test.exs
index 9bfb6b4..d982ef3 100644
--- a/lib/mix/test/mix/shell/io_test.exs
@@ -154,11 +127,11 @@ index 9bfb6b4..d982ef3 100644
@@ -29,6 +29,7 @@ defmodule Mix.Shell.IOTest do
assert capture_io("", fn -> refute yes?("Ok?") end)
end
-
+
+ @tag :skip
test "runs a given command" do
assert capture_io("", fn -> assert cmd("echo hello") == 0 end) == "hello\n"
-
+
diff --git a/lib/mix/test/mix/shell/quiet_test.exs b/lib/mix/test/mix/shell/quiet_test.exs
index 626429b..99fab35 100644
--- a/lib/mix/test/mix/shell/quiet_test.exs
@@ -166,11 +139,11 @@ index 626429b..99fab35 100644
@@ -29,6 +29,7 @@ defmodule Mix.Shell.QuietTest do
assert capture_io("", fn -> refute yes?("Ok?") end)
end
-
+
+ @tag :skip
test "runs a given command" do
assert capture_io("", fn -> assert cmd("echo hello") == 0 end) == ""
-
+
diff --git a/lib/mix/test/mix/tasks/cmd_test.exs b/lib/mix/test/mix/tasks/cmd_test.exs
index db4bf06..4d441f7 100644
--- a/lib/mix/test/mix/tasks/cmd_test.exs
@@ -178,7 +151,7 @@ index db4bf06..4d441f7 100644
@@ -3,6 +3,7 @@ Code.require_file "../../test_helper.exs", __DIR__
defmodule Mix.Tasks.CmdTest do
use MixTest.Case
-
+
+ @tag :skip
test "runs the command for each app" do
in_fixture "umbrella_dep/deps/umbrella", fn ->
@@ -190,19 +163,19 @@ index 4f09ff3..c371997 100644
@@ -29,6 +29,7 @@ defmodule Mix.Tasks.Deps.TreeTest do
end
end
-
+
+ @tag :skip
test "shows the dependency tree", context do
Mix.Project.push ConvergedDepsApp
-
+
@@ -109,6 +110,7 @@ defmodule Mix.Tasks.Deps.TreeTest do
end
end
-
+
+ @tag :skip
test "shows the dependency tree in DOT graph format", context do
Mix.Project.push ConvergedDepsApp
-
+
diff --git a/lib/mix/test/mix/tasks/deps_test.exs b/lib/mix/test/mix/tasks/deps_test.exs
index b061777..cc45cf8 100644
--- a/lib/mix/test/mix/tasks/deps_test.exs
@@ -210,43 +183,43 @@ index b061777..cc45cf8 100644
@@ -96,6 +96,7 @@
end
end
-
+
+ @tag :skip
test "prints list of dependencies and their lock status" do
Mix.Project.push DepsApp
-
+
@@ -409,6 +409,7 @@ defmodule Mix.Tasks.DepsTest do
end
end
-
+
+ @tag :skip
test "fails on diverged dependencies by requirement" do
Mix.Project.push ConvergedDepsApp
-
+
@@ -440,6 +441,7 @@ defmodule Mix.Tasks.DepsTest do
end
end
-
+
+ @tag :skip
test "fails on diverged dependencies even when optional" do
Mix.Project.push ConvergedDepsApp
-
+
@@ -469,6 +471,7 @@ defmodule Mix.Tasks.DepsTest do
end
end
-
+
+ @tag :skip
test "works with converged dependencies" do
Mix.Project.push ConvergedDepsApp
-
+
@@ -491,6 +494,7 @@ defmodule Mix.Tasks.DepsTest do
purge [GitRepo, GitRepo.Mixfile]
end
-
+
+ @tag :skip
test "works with overridden dependencies" do
Mix.Project.push OverriddenDepsApp
-
+
diff --git a/lib/mix/test/mix/umbrella_test.exs b/lib/mix/test/mix/umbrella_test.exs
index 69f9428..406668a 100644
--- a/lib/mix/test/mix/umbrella_test.exs
@@ -254,8 +227,58 @@ index 69f9428..406668a 100644
@@ -98,6 +98,7 @@ defmodule Mix.UmbrellaTest do
end
end
-
+
+ @tag :skip
test "loads umbrella child dependencies in all environments" do
in_fixture "umbrella_dep/deps/umbrella", fn ->
Mix.Project.in_project :umbrella, ".", fn _ ->
+
+diff --git a/lib/elixir/test/elixir/kernel/dialyzer_test.exs b/lib/elixir/test/elixir/kernel/dialyzer_test.exs
+index 792222c..e90beb9 100644
+--- a/lib/elixir/test/elixir/kernel/dialyzer_test.exs
++++ b/lib/elixir/test/elixir/kernel/dialyzer_test.exs
+@@ -54,6 +54,7 @@ defmodule Kernel.DialyzerTest do
+ {:ok, [outdir: dir, dialyzer: dialyzer]}
+ end
+
++ @tag :skip
+ test "no warnings on valid remote calls", context do
+ copy_beam! context, Dialyzer.RemoteCall
+ assert_dialyze_no_warnings! context
+@@ -78,11 +79,13 @@ defmodule Kernel.DialyzerTest do
+ assert_dialyze_no_warnings! context
+ end
+
++ @tag :skip
+ test "no warnings on struct update", context do
+ copy_beam! context, Dialyzer.StructUpdate
+ assert_dialyze_no_warnings! context
+ end
+
++ @tag :skip
+ test "no warnings on protocol calls with opaque types", context do
+ copy_beam! context, Dialyzer.ProtocolOpaque
+ copy_beam! context, Dialyzer.ProtocolOpaque.Entity
+@@ -90,6 +93,7 @@ defmodule Kernel.DialyzerTest do
+ assert_dialyze_no_warnings! context
+ end
+
++ @tag :skip
+ test "no warnings on and/2 and or/2", context do
+ copy_beam! context, Dialyzer.BooleanCheck
+ assert_dialyze_no_warnings! context
+
+diff --git a/Makefile b/Makefile
+index 2fc4f9a..aef8366 100644
+--- a/Makefile
++++ b/Makefile
+@@ -201,7 +201,7 @@ $(TEST_EBIN)/%.beam: $(TEST_ERL)/%.erl
+ $(Q) mkdir -p $(TEST_EBIN)
+ $(Q) $(ERLC) -o $(TEST_EBIN) $<
+
+-test_elixir: test_stdlib test_ex_unit test_logger test_mix test_eex test_iex
++test_elixir: test_stdlib test_ex_unit test_logger test_eex test_iex
+
+ test_stdlib: compile
+ @ echo "==> elixir (exunit)"
+
diff --git a/gnu/packages/patches/gnome-shell-CVE-2017-8288.patch b/gnu/packages/patches/gnome-shell-CVE-2017-8288.patch
new file mode 100644
index 0000000000..5d8e31563f
--- /dev/null
+++ b/gnu/packages/patches/gnome-shell-CVE-2017-8288.patch
@@ -0,0 +1,54 @@
+Fix CVE-2017-8288:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8288
+http://seclists.org/oss-sec/2017/q2/136
+
+Patch copied from upstream source repository:
+
+https://git.gnome.org/browse/gnome-shell/commit/?id=ff425d1db7082e2755d2a405af53861552acf2a1
+
+From ff425d1db7082e2755d2a405af53861552acf2a1 Mon Sep 17 00:00:00 2001
+From: Emilio Pozuelo Monfort <pochu27@gmail.com>
+Date: Tue, 25 Apr 2017 17:27:42 +0200
+Subject: extensionSystem: handle reloading broken extensions
+
+Some extensions out there may fail to reload. When that happens,
+we need to catch any exceptions so that we don't leave things in
+a broken state that could lead to leaving extensions enabled in
+the screen shield.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=781728
+---
+ js/ui/extensionSystem.js | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
+index a4dc29e..fc352b8 100644
+--- a/js/ui/extensionSystem.js
++++ b/js/ui/extensionSystem.js
+@@ -282,12 +282,20 @@ function _onVersionValidationChanged() {
+ // temporarily disable them all
+ enabledExtensions = [];
+ for (let uuid in ExtensionUtils.extensions)
+- reloadExtension(ExtensionUtils.extensions[uuid]);
++ try {
++ reloadExtension(ExtensionUtils.extensions[uuid]);
++ } catch(e) {
++ logExtensionError(uuid, e);
++ }
+ enabledExtensions = getEnabledExtensions();
+
+ if (Main.sessionMode.allowExtensions) {
+ enabledExtensions.forEach(function(uuid) {
+- enableExtension(uuid);
++ try {
++ enableExtension(uuid);
++ } catch(e) {
++ logExtensionError(uuid, e);
++ }
+ });
+ }
+ }
+--
+cgit v0.12
+
diff --git a/gnu/packages/patches/icecat-bug-1299500-pt10.patch b/gnu/packages/patches/icecat-bug-1299500-pt10.patch
deleted file mode 100644
index 406738b8a5..0000000000
--- a/gnu/packages/patches/icecat-bug-1299500-pt10.patch
+++ /dev/null
@@ -1,1639 +0,0 @@
-Based on the following HG changeset, but adapted to GNU IceCat and
-also assumes that the dom/devicestorage subtree is deleted by our
-snippet. Note that the other parts of this patchset are downloaded
-directly from the upstream mozilla-esr52 mercurial repository.
-
-# HG changeset patch
-# User Andrea Marchesini <amarchesini@mozilla.com>
-# Date 1489000545 -3600
-# Node ID 08f2bc167ae82a6f86e427283d8b972ba794b846
-# Parent d63f3b14e5718b62c0adad2eab81b785250f3d4a
-Bug 1299500 - Get rid of DeviceStorage API - part 10 - DeviceStorage, r=ehsan, r=billm, a=jcristau
-
-diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
---- a/dom/bindings/Bindings.conf
-+++ b/dom/bindings/Bindings.conf
-@@ -228,21 +228,16 @@ DOMInterfaces = {
- 'DeviceAcceleration': {
- 'headerFile': 'mozilla/dom/DeviceMotionEvent.h',
- },
-
- 'DeviceRotationRate': {
- 'headerFile': 'mozilla/dom/DeviceMotionEvent.h',
- },
-
--'DeviceStorage': {
-- 'nativeType': 'nsDOMDeviceStorage',
-- 'headerFile': 'DeviceStorage.h',
--},
--
- 'Document': {
- 'nativeType': 'nsIDocument',
- 'binaryNames': {
- 'documentURI': 'documentURIFromJS',
- 'URL': 'documentURIFromJS'
- }
- },
-
-diff --git a/dom/filesystem/DeviceStorageFileSystem.cpp b/dom/filesystem/DeviceStorageFileSystem.cpp
---- a/dom/filesystem/DeviceStorageFileSystem.cpp
-+++ b/dom/filesystem/DeviceStorageFileSystem.cpp
-@@ -1,26 +1,24 @@
- /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
- /* vim: set ts=8 sts=2 et sw=2 tw=80: */
- /* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- #include "mozilla/dom/DeviceStorageFileSystem.h"
-
--#include "DeviceStorage.h"
- #include "mozilla/Preferences.h"
- #include "mozilla/dom/Directory.h"
- #include "mozilla/dom/File.h"
- #include "mozilla/dom/FileSystemUtils.h"
- #include "mozilla/ipc/BackgroundParent.h"
- #include "mozilla/Unused.h"
- #include "nsCOMPtr.h"
- #include "nsDebug.h"
--#include "nsDeviceStorage.h"
- #include "nsIFile.h"
- #include "nsPIDOMWindow.h"
- #include "nsGlobalWindow.h"
-
- using namespace mozilla::ipc;
-
- namespace mozilla {
- namespace dom {
-@@ -37,44 +35,16 @@ DeviceStorageFileSystem::DeviceStorageFi
- if (mozilla::Preferences::GetBool("device.storage.prompt.testing", false)) {
- mPermissionCheckType = ePermissionCheckNotRequired;
- } else {
- mPermissionCheckType = ePermissionCheckRequired;
- }
- } else {
- AssertIsOnBackgroundThread();
- }
--
-- // Get the permission name required to access the file system.
-- DebugOnly<nsresult> rv =
-- DeviceStorageTypeChecker::GetPermissionForType(mStorageType, mPermission);
-- NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "GetPermissionForType failed");
--
-- // Get the local path of the file system root.
-- nsCOMPtr<nsIFile> rootFile;
-- DeviceStorageFile::GetRootDirectoryForType(aStorageType,
-- aStorageName,
-- getter_AddRefs(rootFile));
--
-- Unused <<
-- NS_WARN_IF(!rootFile ||
-- NS_FAILED(rootFile->GetPath(mLocalOrDeviceStorageRootPath)));
--
-- if (!XRE_IsParentProcess()) {
-- return;
-- }
--
-- // DeviceStorageTypeChecker is a singleton object and must be initialized on
-- // the main thread. We initialize it here so that we can use it on the worker
-- // thread.
-- if (NS_IsMainThread()) {
-- DebugOnly<DeviceStorageTypeChecker*> typeChecker =
-- DeviceStorageTypeChecker::CreateOrGet();
-- MOZ_ASSERT(typeChecker);
-- }
- }
-
- DeviceStorageFileSystem::~DeviceStorageFileSystem()
- {
- AssertIsOnOwningThread();
- }
-
- already_AddRefed<FileSystemBase>
-diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp
---- a/dom/ipc/ContentChild.cpp
-+++ b/dom/ipc/ContentChild.cpp
-@@ -168,44 +168,41 @@
- #include "mozilla/X11Util.h"
- #endif
-
- #ifdef ACCESSIBILITY
- #include "nsAccessibilityService.h"
- #endif
-
- #include "mozilla/dom/File.h"
--#include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h"
- #include "mozilla/dom/PPresentationChild.h"
- #include "mozilla/dom/PresentationIPCService.h"
- #include "mozilla/ipc/InputStreamUtils.h"
-
- #ifdef MOZ_WEBSPEECH
- #include "mozilla/dom/PSpeechSynthesisChild.h"
- #endif
-
- #include "ProcessUtils.h"
- #include "URIUtils.h"
- #include "nsContentUtils.h"
- #include "nsIPrincipal.h"
--#include "nsDeviceStorage.h"
- #include "DomainPolicy.h"
- #include "mozilla/dom/ipc/StructuredCloneData.h"
- #include "mozilla/dom/time/DateCacheCleaner.h"
- #include "mozilla/net/NeckoMessageUtils.h"
- #include "mozilla/widget/PuppetBidiKeyboard.h"
- #include "mozilla/RemoteSpellCheckEngineChild.h"
- #include "GMPServiceChild.h"
- #include "gfxPlatform.h"
- #include "nscore.h" // for NS_FREE_PERMANENT_DATA
- #include "VRManagerChild.h"
-
- using namespace mozilla;
- using namespace mozilla::docshell;
--using namespace mozilla::dom::devicestorage;
- using namespace mozilla::dom::ipc;
- using namespace mozilla::dom::workers;
- using namespace mozilla::media;
- using namespace mozilla::embedding;
- using namespace mozilla::gmp;
- using namespace mozilla::hal_sandbox;
- using namespace mozilla::ipc;
- using namespace mozilla::layers;
-@@ -1806,29 +1803,16 @@ ContentChild::GetCPOWManager()
- }
-
- bool
- ContentChild::RecvPTestShellConstructor(PTestShellChild* actor)
- {
- return true;
- }
-
--PDeviceStorageRequestChild*
--ContentChild::AllocPDeviceStorageRequestChild(const DeviceStorageParams& aParams)
--{
-- return new DeviceStorageRequestChild();
--}
--
--bool
--ContentChild::DeallocPDeviceStorageRequestChild(PDeviceStorageRequestChild* aDeviceStorage)
--{
-- delete aDeviceStorage;
-- return true;
--}
--
- PNeckoChild*
- ContentChild::AllocPNeckoChild()
- {
- return new NeckoChild();
- }
-
- bool
- ContentChild::DeallocPNeckoChild(PNeckoChild* necko)
-@@ -2531,38 +2515,16 @@ ContentChild::RecvVolumes(nsTArray<Volum
- if (vs) {
- vs->RecvVolumesFromParent(aVolumes);
- }
- #endif
- return true;
- }
-
- bool
--ContentChild::RecvFilePathUpdate(const nsString& aStorageType,
-- const nsString& aStorageName,
-- const nsString& aPath,
-- const nsCString& aReason)
--{
-- if (nsDOMDeviceStorage::InstanceCount() == 0) {
-- // No device storage instances in this process. Don't try and
-- // and create a DeviceStorageFile since it will fail.
--
-- return true;
-- }
--
-- RefPtr<DeviceStorageFile> dsf = new DeviceStorageFile(aStorageType, aStorageName, aPath);
--
-- nsString reason;
-- CopyASCIItoUTF16(aReason, reason);
-- nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-- obs->NotifyObservers(dsf, "file-watcher-update", reason.get());
-- return true;
--}
--
--bool
- ContentChild::RecvFileSystemUpdate(const nsString& aFsName,
- const nsString& aVolumeName,
- const int32_t& aState,
- const int32_t& aMountGeneration,
- const bool& aIsMediaPresent,
- const bool& aIsSharing,
- const bool& aIsFormatting,
- const bool& aIsFake,
-diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h
---- a/dom/ipc/ContentChild.h
-+++ b/dom/ipc/ContentChild.h
-@@ -193,22 +193,16 @@ public:
- const IPCTabContext& aContext,
- const uint32_t& aChromeFlags,
- const ContentParentId& aCpID,
- const bool& aIsForApp,
- const bool& aIsForBrowser) override;
-
- virtual bool DeallocPBrowserChild(PBrowserChild*) override;
-
-- virtual PDeviceStorageRequestChild*
-- AllocPDeviceStorageRequestChild(const DeviceStorageParams&) override;
--
-- virtual bool
-- DeallocPDeviceStorageRequestChild(PDeviceStorageRequestChild*) override;
--
- virtual PBlobChild*
- AllocPBlobChild(const BlobConstructorParams& aParams) override;
-
- virtual bool DeallocPBlobChild(PBlobChild* aActor) override;
-
- virtual PCrashReporterChild*
- AllocPCrashReporterChild(const mozilla::dom::NativeThreadId& id,
- const uint32_t& processType) override;
-@@ -436,21 +430,16 @@ public:
-
- virtual bool
- RecvInitBlobURLs(nsTArray<BlobURLRegistrationData>&& aRegistations) override;
-
- virtual bool RecvLastPrivateDocShellDestroyed() override;
-
- virtual bool RecvVolumes(InfallibleTArray<VolumeInfo>&& aVolumes) override;
-
-- virtual bool RecvFilePathUpdate(const nsString& aStorageType,
-- const nsString& aStorageName,
-- const nsString& aPath,
-- const nsCString& aReason) override;
--
- virtual bool RecvFileSystemUpdate(const nsString& aFsName,
- const nsString& aVolumeName,
- const int32_t& aState,
- const int32_t& aMountGeneration,
- const bool& aIsMediaPresent,
- const bool& aIsSharing,
- const bool& aIsFormatting,
- const bool& aIsFake,
-diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
---- a/dom/ipc/ContentParent.cpp
-+++ b/dom/ipc/ContentParent.cpp
-@@ -23,17 +23,16 @@
-
- #include "chrome/common/process_watcher.h"
-
- #include "mozilla/a11y/PDocAccessible.h"
- #include "AppProcessChecker.h"
- #include "AudioChannelService.h"
- #include "BlobParent.h"
- #include "CrashReporterParent.h"
--#include "DeviceStorageStatics.h"
- #include "GMPServiceParent.h"
- #include "HandlerServiceParent.h"
- #include "IHistory.h"
- #include "imgIContainer.h"
- #include "mozIApplication.h"
- #if defined(XP_WIN) && defined(ACCESSIBILITY)
- #include "mozilla/a11y/AccessibleWrap.h"
- #endif
-@@ -50,17 +49,16 @@
- #include "mozilla/dom/GetFilesHelper.h"
- #include "mozilla/dom/GeolocationBinding.h"
- #include "mozilla/dom/Notification.h"
- #include "mozilla/dom/PContentBridgeParent.h"
- #include "mozilla/dom/PContentPermissionRequestParent.h"
- #include "mozilla/dom/PCycleCollectWithLogsParent.h"
- #include "mozilla/dom/PMemoryReportRequestParent.h"
- #include "mozilla/dom/ServiceWorkerRegistrar.h"
--#include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
- #include "mozilla/dom/power/PowerManagerService.h"
- #include "mozilla/dom/Permissions.h"
- #include "mozilla/dom/PresentationParent.h"
- #include "mozilla/dom/PPresentationParent.h"
- #include "mozilla/dom/PushNotifier.h"
- #include "mozilla/dom/FlyWebPublishedServerIPC.h"
- #include "mozilla/dom/quota/QuotaManagerService.h"
- #include "mozilla/dom/time/DateCacheCleaner.h"
-@@ -272,17 +270,16 @@ using base::ChildPrivileges;
- using base::KillProcess;
- #ifdef MOZ_ENABLE_PROFILER_SPS
- using mozilla::ProfileGatherer;
- #endif
-
- #ifdef MOZ_CRASHREPORTER
- using namespace CrashReporter;
- #endif
--using namespace mozilla::dom::devicestorage;
- using namespace mozilla::dom::power;
- using namespace mozilla::media;
- using namespace mozilla::embedding;
- using namespace mozilla::gfx;
- using namespace mozilla::gmp;
- using namespace mozilla::hal;
- using namespace mozilla::ipc;
- using namespace mozilla::layers;
-@@ -2775,22 +2772,16 @@ ContentParent::Observe(nsISupports* aSub
- Unused << SendCycleCollect();
- }
- else if (!strcmp(aTopic, "child-mmu-request")){
- Unused << SendMinimizeMemoryUsage();
- }
- else if (!strcmp(aTopic, "last-pb-context-exited")) {
- Unused << SendLastPrivateDocShellDestroyed();
- }
-- else if (!strcmp(aTopic, "file-watcher-update")) {
-- nsCString creason;
-- CopyUTF16toUTF8(aData, creason);
-- DeviceStorageFile* file = static_cast<DeviceStorageFile*>(aSubject);
-- Unused << SendFilePathUpdate(file->mStorageType, file->mStorageName, file->mPath, creason);
-- }
- #ifdef MOZ_WIDGET_GONK
- else if(!strcmp(aTopic, NS_VOLUME_STATE_CHANGED)) {
- nsCOMPtr<nsIVolume> vol = do_QueryInterface(aSubject);
- if (!vol) {
- return NS_ERROR_NOT_AVAILABLE;
- }
-
- nsString volName;
-@@ -3021,35 +3012,16 @@ ContentParent::AllocPBrowserParent(const
- }
-
- bool
- ContentParent::DeallocPBrowserParent(PBrowserParent* frame)
- {
- return nsIContentParent::DeallocPBrowserParent(frame);
- }
-
--PDeviceStorageRequestParent*
--ContentParent::AllocPDeviceStorageRequestParent(const DeviceStorageParams& aParams)
--{
-- RefPtr<DeviceStorageRequestParent> result = new DeviceStorageRequestParent(aParams);
-- if (!result->EnsureRequiredPermissions(this)) {
-- return nullptr;
-- }
-- result->Dispatch();
-- return result.forget().take();
--}
--
--bool
--ContentParent::DeallocPDeviceStorageRequestParent(PDeviceStorageRequestParent* doomed)
--{
-- DeviceStorageRequestParent *parent = static_cast<DeviceStorageRequestParent*>(doomed);
-- NS_RELEASE(parent);
-- return true;
--}
--
- PBlobParent*
- ContentParent::AllocPBlobParent(const BlobConstructorParams& aParams)
- {
- return nsIContentParent::AllocPBlobParent(aParams);
- }
-
- bool
- ContentParent::DeallocPBlobParent(PBlobParent* aActor)
-@@ -3871,35 +3843,16 @@ ContentParent::RecvAsyncMessage(const ns
- InfallibleTArray<CpowEntry>&& aCpows,
- const IPC::Principal& aPrincipal,
- const ClonedMessageData& aData)
- {
- return nsIContentParent::RecvAsyncMessage(aMsg, Move(aCpows), aPrincipal,
- aData);
- }
-
--bool
--ContentParent::RecvFilePathUpdateNotify(const nsString& aType,
-- const nsString& aStorageName,
-- const nsString& aFilePath,
-- const nsCString& aReason)
--{
-- RefPtr<DeviceStorageFile> dsf = new DeviceStorageFile(aType,
-- aStorageName,
-- aFilePath);
--
-- nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-- if (!obs) {
-- return false;
-- }
-- obs->NotifyObservers(dsf, "file-watcher-update",
-- NS_ConvertASCIItoUTF16(aReason).get());
-- return true;
--}
--
- static int32_t
- AddGeolocationListener(nsIDOMGeoPositionCallback* watcher,
- nsIDOMGeoPositionErrorCallback* errorCallBack,
- bool highAccuracy)
- {
- nsCOMPtr<nsIDOMGeoGeolocation> geo = do_GetService("@mozilla.org/geolocation;1");
- if (!geo) {
- return -1;
-@@ -4943,35 +4896,16 @@ ContentParent::RecvBeginDriverCrashGuard
- bool
- ContentParent::RecvEndDriverCrashGuard(const uint32_t& aGuardType)
- {
- mDriverCrashGuard = nullptr;
- return true;
- }
-
- bool
--ContentParent::RecvGetDeviceStorageLocation(const nsString& aType,
-- nsString* aPath)
--{
--#ifdef MOZ_WIDGET_ANDROID
-- mozilla::AndroidBridge::GetExternalPublicDirectory(aType, *aPath);
-- return true;
--#else
-- return false;
--#endif
--}
--
--bool
--ContentParent::RecvGetDeviceStorageLocations(DeviceStorageLocationInfo* info)
--{
-- DeviceStorageStatics::GetDeviceStorageLocationsForIPC(info);
-- return true;
--}
--
--bool
- ContentParent::RecvGetAndroidSystemInfo(AndroidSystemInfo* aInfo)
- {
- #ifdef MOZ_WIDGET_ANDROID
- nsSystemInfo::GetAndroidSystemInfo(aInfo);
- return true;
- #else
- MOZ_CRASH("wrong platform!");
- return false;
-diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h
---- a/dom/ipc/ContentParent.h
-+++ b/dom/ipc/ContentParent.h
-@@ -726,22 +726,16 @@ private:
- const IPCTabContext& aContext,
- const uint32_t& aChromeFlags,
- const ContentParentId& aCpId,
- const bool& aIsForApp,
- const bool& aIsForBrowser) override;
-
- virtual bool DeallocPBrowserParent(PBrowserParent* frame) override;
-
-- virtual PDeviceStorageRequestParent*
-- AllocPDeviceStorageRequestParent(const DeviceStorageParams&) override;
--
-- virtual bool
-- DeallocPDeviceStorageRequestParent(PDeviceStorageRequestParent*) override;
--
- virtual PBlobParent*
- AllocPBlobParent(const BlobConstructorParams& aParams) override;
-
- virtual bool DeallocPBlobParent(PBlobParent* aActor) override;
-
- virtual bool
- RecvPBlobConstructor(PBlobParent* aActor,
- const BlobConstructorParams& params) override;
-@@ -927,21 +921,16 @@ private:
- const IPC::Principal& aPrincipal,
- nsTArray<StructuredCloneData>* aRetvals) override;
-
- virtual bool RecvAsyncMessage(const nsString& aMsg,
- InfallibleTArray<CpowEntry>&& aCpows,
- const IPC::Principal& aPrincipal,
- const ClonedMessageData& aData) override;
-
-- virtual bool RecvFilePathUpdateNotify(const nsString& aType,
-- const nsString& aStorageName,
-- const nsString& aFilePath,
-- const nsCString& aReason) override;
--
- virtual bool RecvAddGeolocationListener(const IPC::Principal& aPrincipal,
- const bool& aHighAccuracy) override;
- virtual bool RecvRemoveGeolocationListener() override;
-
- virtual bool RecvSetGeolocationHigherAccuracy(const bool& aEnable) override;
-
- virtual bool RecvConsoleMessage(const nsString& aMessage) override;
-
-@@ -1047,21 +1036,16 @@ private:
- const uint32_t& aDropEffect) override;
-
- virtual bool RecvProfile(const nsCString& aProfile) override;
-
- virtual bool RecvGetGraphicsDeviceInitData(ContentDeviceData* aOut) override;
-
- void StartProfiler(nsIProfilerStartParams* aParams);
-
-- virtual bool RecvGetDeviceStorageLocation(const nsString& aType,
-- nsString* aPath) override;
--
-- virtual bool RecvGetDeviceStorageLocations(DeviceStorageLocationInfo* info) override;
--
- virtual bool RecvGetAndroidSystemInfo(AndroidSystemInfo* aInfo) override;
-
- virtual bool RecvNotifyBenchmarkResult(const nsString& aCodecName,
- const uint32_t& aDecodeFPS) override;
-
- virtual bool RecvNotifyPushObservers(const nsCString& aScope,
- const IPC::Principal& aPrincipal,
- const nsString& aMessageId) override;
-diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl
---- a/dom/ipc/PContent.ipdl
-+++ b/dom/ipc/PContent.ipdl
-@@ -10,17 +10,16 @@ include protocol PBrowser;
- include protocol PCompositorBridge;
- include protocol PContentBridge;
- include protocol PContentPermissionRequest;
- include protocol PCycleCollectWithLogs;
- include protocol PCrashReporter;
- include protocol PPSMContentDownloader;
- include protocol PExternalHelperApp;
- include protocol PHandlerService;
--include protocol PDeviceStorageRequest;
- include protocol PFileDescriptorSet;
- include protocol PHal;
- include protocol PHeapSnapshotTempFileHelper;
- include protocol PProcessHangMonitor;
- include protocol PImageBridge;
- include protocol PMedia;
- include protocol PMemoryReportRequest;
- include protocol PNecko;
-@@ -111,130 +110,16 @@ struct FontListEntry {
- nsCString filepath;
- uint16_t weight;
- int16_t stretch;
- uint8_t italic;
- uint8_t index;
- bool isHidden;
- };
-
--struct DeviceStorageFreeSpaceParams
--{
-- nsString type;
-- nsString storageName;
--};
--
--struct DeviceStorageUsedSpaceParams
--{
-- nsString type;
-- nsString storageName;
--};
--
--struct DeviceStorageAvailableParams
--{
-- nsString type;
-- nsString storageName;
--};
--
--struct DeviceStorageStatusParams
--{
-- nsString type;
-- nsString storageName;
--};
--
--struct DeviceStorageFormatParams
--{
-- nsString type;
-- nsString storageName;
--};
--
--struct DeviceStorageMountParams
--{
-- nsString type;
-- nsString storageName;
--};
--
--struct DeviceStorageUnmountParams
--{
-- nsString type;
-- nsString storageName;
--};
--
--struct DeviceStorageAddParams
--{
-- nsString type;
-- nsString storageName;
-- nsString relpath;
-- PBlob blob;
--};
--
--struct DeviceStorageAppendParams
--{
-- nsString type;
-- nsString storageName;
-- nsString relpath;
-- PBlob blob;
--};
--
--struct DeviceStorageCreateFdParams
--{
-- nsString type;
-- nsString storageName;
-- nsString relpath;
--};
--
--struct DeviceStorageGetParams
--{
-- nsString type;
-- nsString storageName;
-- nsString rootDir;
-- nsString relpath;
--};
--
--struct DeviceStorageDeleteParams
--{
-- nsString type;
-- nsString storageName;
-- nsString relpath;
--};
--
--struct DeviceStorageEnumerationParams
--{
-- nsString type;
-- nsString storageName;
-- nsString rootdir;
-- uint64_t since;
--};
--
--union DeviceStorageParams
--{
-- DeviceStorageAddParams;
-- DeviceStorageAppendParams;
-- DeviceStorageCreateFdParams;
-- DeviceStorageGetParams;
-- DeviceStorageDeleteParams;
-- DeviceStorageEnumerationParams;
-- DeviceStorageFreeSpaceParams;
-- DeviceStorageUsedSpaceParams;
-- DeviceStorageAvailableParams;
-- DeviceStorageStatusParams;
-- DeviceStorageFormatParams;
-- DeviceStorageMountParams;
-- DeviceStorageUnmountParams;
--};
--
--struct DeviceStorageLocationInfo {
-- nsString music;
-- nsString pictures;
-- nsString videos;
-- nsString sdcard;
-- nsString apps;
-- nsString crashes;
--};
--
- union PrefValue {
- nsCString;
- int32_t;
- bool;
- };
-
- union MaybePrefValue {
- PrefValue;
-@@ -355,17 +240,16 @@ nested(upto inside_cpow) sync protocol P
- parent opens PGMPService;
- child opens PBackground;
-
- manages PBlob;
- manages PBrowser;
- manages PContentPermissionRequest;
- manages PCrashReporter;
- manages PCycleCollectWithLogs;
-- manages PDeviceStorageRequest;
- manages PPSMContentDownloader;
- manages PExternalHelperApp;
- manages PFileDescriptorSet;
- manages PHal;
- manages PHandlerService;
- manages PHeapSnapshotTempFileHelper;
- manages PMedia;
- manages PMemoryReportRequest;
-@@ -538,19 +422,16 @@ child:
- /**
- * Send BlobURLRegistrationData to child process.
- */
- async InitBlobURLs(BlobURLRegistrationData[] registrations);
-
- // Notify child that last-pb-context-exited notification was observed
- async LastPrivateDocShellDestroyed();
-
-- async FilePathUpdate(nsString storageType, nsString storageName, nsString filepath,
-- nsCString reasons);
--
- // Note: Any changes to this structure should also be changed in
- // VolumeInfo above.
- async FileSystemUpdate(nsString fsName, nsString mountPoint, int32_t fsState,
- int32_t mountGeneration, bool isMediaPresent,
- bool isSharing, bool isFormatting, bool isFake,
- bool isUnmounting, bool isRemovable, bool isHotSwappable);
-
- // Notify volume is removed.
-@@ -738,17 +619,16 @@ parent:
- * process. |newPluginEpoch| is the current epoch in the chrome process. If
- * |pluginEpoch == newPluginEpoch|, then |plugins| will be left empty.
- */
- sync FindPlugins(uint32_t pluginEpoch) returns (nsresult aResult, PluginTag[] plugins, uint32_t newPluginEpoch);
-
- async PJavaScript();
-
- async PRemoteSpellcheckEngine();
-- async PDeviceStorageRequest(DeviceStorageParams params);
-
- sync PCrashReporter(NativeThreadId tid, uint32_t processType);
-
- /**
- * Is this token compatible with the provided version?
- *
- * |version| The offered version to test
- * Returns |True| if the offered version is compatible
-@@ -921,21 +801,16 @@ parent:
- async FirstIdle();
-
- async AudioChannelServiceStatus(bool aActiveTelephonyChannel,
- bool aContentOrNormalChannel,
- bool aAnyActiveChannel);
-
- async AudioChannelChangeDefVolChannel(int32_t aChannel, bool aHidden);
-
-- async FilePathUpdateNotify(nsString aType,
-- nsString aStorageName,
-- nsString aFilepath,
-- nsCString aReason);
--
- // called by the child (test code only) to propagate volume changes to the parent
- async CreateFakeVolume(nsString fsName, nsString mountPoint);
- async SetFakeVolumeState(nsString fsName, int32_t fsState);
- async RemoveFakeVolume(nsString fsName);
-
- sync KeywordToURI(nsCString keyword)
- returns (nsString providerName, OptionalInputStreamParams postData, OptionalURIParams uri);
-
-@@ -1108,22 +983,16 @@ parent:
- float aFullZoom)
- returns (nsresult rv,
- bool windowOpened,
- FrameScriptInfo[] frameScripts,
- nsCString urlToLoad,
- TextureFactoryIdentifier textureFactoryIdentifier,
- uint64_t layersId);
-
-- sync GetDeviceStorageLocation(nsString type)
-- returns (nsString path);
--
-- sync GetDeviceStorageLocations()
-- returns (DeviceStorageLocationInfo info);
--
- sync GetAndroidSystemInfo()
- returns (AndroidSystemInfo info);
-
- /**
- * Tells the parent to ungrab the pointer on the default display.
- *
- * This is for GTK platforms where we have to ensure the pointer ungrab happens in the
- * chrome process as that's the process that receives the pointer event.
-diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build
---- a/dom/ipc/moz.build
-+++ b/dom/ipc/moz.build
-@@ -120,17 +120,16 @@ if CONFIG['MOZ_CONTENT_SANDBOX'] and CON
- 'mozsandbox',
- ]
-
- LOCAL_INCLUDES += [
- '/caps',
- '/chrome',
- '/docshell/base',
- '/dom/base',
-- '/dom/devicestorage',
- '/dom/events',
- '/dom/filesystem',
- '/dom/geolocation',
- '/dom/media/webspeech/synth/ipc',
- '/dom/security',
- '/dom/storage',
- '/dom/workers',
- '/embedding/components/printingui/ipc',
-diff --git a/dom/moz.build b/dom/moz.build
---- a/dom/moz.build
-+++ b/dom/moz.build
-@@ -42,17 +42,16 @@ DIRS += [
- 'base',
- 'archivereader',
- 'bindings',
- 'battery',
- 'browser-element',
- 'cache',
- 'canvas',
- 'crypto',
-- 'devicestorage',
- 'encoding',
- 'events',
- 'fetch',
- 'filehandle',
- 'filesystem',
- 'flyweb',
- 'gamepad',
- 'geolocation',
-diff --git a/dom/webidl/DeviceStorage.webidl b/dom/webidl/DeviceStorage.webidl
-deleted file mode 100644
---- a/dom/webidl/DeviceStorage.webidl
-+++ /dev/null
-@@ -1,95 +0,0 @@
--/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
--/* This Source Code Form is subject to the terms of the Mozilla Public
-- * License, v. 2.0. If a copy of the MPL was not distributed with this
-- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
--
--dictionary DeviceStorageEnumerationParameters {
-- Date since;
--};
--
--[Pref="device.storage.enabled"]
--interface DeviceStorage : EventTarget {
-- attribute EventHandler onchange;
--
-- [Throws]
-- DOMRequest? add(Blob? aBlob);
-- [Throws]
-- DOMRequest? addNamed(Blob? aBlob, DOMString aName);
--
-- /**
-- * Append data to a given file.
-- * If the file doesn't exist, a "NotFoundError" event will be dispatched.
-- * In the same time, it is a request.onerror case.
-- * If the file exists, it will be opened with the following permission:
-- * "PR_WRONLY|PR_CREATE_FILE|PR_APPEND".
-- * The function will return null when blob file is null and other unexpected situations.
-- * @parameter aBlob: A Blob object representing the data to append
-- * @parameter aName: A string representing the full name (path + file name) of the file
-- * to append data to.
-- */
-- [Throws]
-- DOMRequest? appendNamed(Blob? aBlob, DOMString aName);
--
-- [Throws]
-- DOMRequest get(DOMString aName);
-- [Throws]
-- DOMRequest getEditable(DOMString aName);
-- [Throws]
-- DOMRequest delete(DOMString aName);
--
-- [Throws]
-- DOMCursor enumerate(optional DeviceStorageEnumerationParameters options);
-- [Throws]
-- DOMCursor enumerate(DOMString path,
-- optional DeviceStorageEnumerationParameters options);
-- [Throws]
-- DOMCursor enumerateEditable(optional DeviceStorageEnumerationParameters options);
-- [Throws]
-- DOMCursor enumerateEditable(DOMString path,
-- optional DeviceStorageEnumerationParameters options);
--
-- [Throws]
-- DOMRequest freeSpace();
-- [Throws]
-- DOMRequest usedSpace();
-- [Throws]
-- DOMRequest available();
-- [Throws]
-- DOMRequest storageStatus();
-- [Throws]
-- DOMRequest format();
-- [Throws]
-- DOMRequest mount();
-- [Throws]
-- DOMRequest unmount();
--
-- // Note that the storageName is just a name (like sdcard), and doesn't
-- // include any path information.
-- readonly attribute DOMString storageName;
--
-- // Indicates if the storage area denoted by storageName is capable of
-- // being mounted and unmounted.
-- readonly attribute boolean canBeMounted;
--
-- // Indicates if the storage area denoted by storageName is capable of
-- // being shared and unshared.
-- readonly attribute boolean canBeShared;
--
-- // Indicates if the storage area denoted by storageName is capable of
-- // being formatted.
-- readonly attribute boolean canBeFormatted;
--
-- // Determines if this storage area is the one which will be used by default
-- // for storing new files.
-- readonly attribute boolean default;
--
-- // Indicates if the storage area denoted by storageName is removable
-- readonly attribute boolean isRemovable;
--
-- // True if the storage area is close to being full
-- readonly attribute boolean lowDiskSpace;
--
-- [NewObject]
-- // XXXbz what type does this really return?
-- Promise<any> getRoot();
--};
-diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build
---- a/dom/webidl/moz.build
-+++ b/dom/webidl/moz.build
-@@ -104,17 +104,16 @@ WEBIDL_FILES = [
- 'DataTransfer.webidl',
- 'DataTransferItem.webidl',
- 'DataTransferItemList.webidl',
- 'DecoderDoctorNotification.webidl',
- 'DedicatedWorkerGlobalScope.webidl',
- 'DelayNode.webidl',
- 'DesktopNotification.webidl',
- 'DeviceMotionEvent.webidl',
-- 'DeviceStorage.webidl',
- 'Directory.webidl',
- 'Document.webidl',
- 'DocumentFragment.webidl',
- 'DocumentTimeline.webidl',
- 'DocumentType.webidl',
- 'DOMCursor.webidl',
- 'DOMError.webidl',
- 'DOMException.webidl',
-diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp
---- a/layout/build/nsLayoutStatics.cpp
-+++ b/layout/build/nsLayoutStatics.cpp
-@@ -122,17 +122,16 @@ using namespace mozilla::system;
- #include "mozilla/dom/CustomElementRegistry.h"
- #include "mozilla/dom/time/DateCacheCleaner.h"
- #include "mozilla/EventDispatcher.h"
- #include "mozilla/IMEStateManager.h"
- #include "mozilla/dom/HTMLVideoElement.h"
- #include "TouchManager.h"
- #include "MediaDecoder.h"
- #include "MediaPrefs.h"
--#include "mozilla/dom/devicestorage/DeviceStorageStatics.h"
- #include "mozilla/ServoBindings.h"
- #include "mozilla/StaticPresData.h"
- #include "mozilla/dom/WebIDLGlobalNameHash.h"
-
- using namespace mozilla;
- using namespace mozilla::net;
- using namespace mozilla::dom;
- using namespace mozilla::dom::ipc;
-@@ -303,18 +302,16 @@ nsLayoutStatics::Initialize()
- nsStyleContext::Initialize();
- mozilla::LayerAnimationInfo::Initialize();
- #endif
-
- MediaDecoder::InitStatics();
-
- PromiseDebugging::Init();
-
-- mozilla::dom::devicestorage::DeviceStorageStatics::Initialize();
--
- mozilla::dom::WebCryptoThreadPool::Initialize();
-
- // NB: We initialize servo in nsAppRunner.cpp, because we need to do it after
- // creating the hidden DOM window to support some current stylo hacks. We
- // should move initialization back here once those go away.
-
- #ifndef MOZ_WIDGET_ANDROID
- // On Android, we instantiate it when constructing AndroidBridge.
-diff --git a/mobile/android/components/ContentPermissionPrompt.js b/mobile/android/components/ContentPermissionPrompt.js
---- a/mobile/android/components/ContentPermissionPrompt.js
-+++ b/mobile/android/components/ContentPermissionPrompt.js
-@@ -8,20 +8,16 @@ const Cu = Components.utils;
- const Cc = Components.classes;
-
- Cu.import("resource://gre/modules/XPCOMUtils.jsm");
- Cu.import("resource://gre/modules/Services.jsm");
-
- const kEntities = {
- "contacts": "contacts",
- "desktop-notification": "desktopNotification2",
-- "device-storage:music": "deviceStorageMusic",
-- "device-storage:pictures": "deviceStoragePictures",
-- "device-storage:sdcard": "deviceStorageSdcard",
-- "device-storage:videos": "deviceStorageVideos",
- "geolocation": "geolocation",
- "flyweb-publish-server": "flyWebPublishServer",
- };
-
- // For these types, prompt for permission if action is unknown.
- const PROMPT_FOR_UNKNOWN = [
- "desktop-notification",
- "geolocation",
-diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
---- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
-+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
-@@ -2198,54 +2198,16 @@ public class GeckoAppShell
- return null;
- }
-
- @WrapForJNI
- private static String connectionGetMimeType(URLConnection connection) {
- return connection.getContentType();
- }
-
-- /**
-- * Retrieve the absolute path of an external storage directory.
-- *
-- * @param type The type of directory to return
-- * @return Absolute path of the specified directory or null on failure
-- */
-- @WrapForJNI(calledFrom = "gecko")
-- private static String getExternalPublicDirectory(final String type) {
-- final String state = Environment.getExternalStorageState();
-- if (!Environment.MEDIA_MOUNTED.equals(state) &&
-- !Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
-- // External storage is not available.
-- return null;
-- }
--
-- if ("sdcard".equals(type)) {
-- // SD card has a separate path.
-- return Environment.getExternalStorageDirectory().getAbsolutePath();
-- }
--
-- final String systemType;
-- if ("downloads".equals(type)) {
-- systemType = Environment.DIRECTORY_DOWNLOADS;
-- } else if ("pictures".equals(type)) {
-- systemType = Environment.DIRECTORY_PICTURES;
-- } else if ("videos".equals(type)) {
-- systemType = Environment.DIRECTORY_MOVIES;
-- } else if ("music".equals(type)) {
-- systemType = Environment.DIRECTORY_MUSIC;
-- } else if ("apps".equals(type)) {
-- File appInternalStorageDirectory = getApplicationContext().getFilesDir();
-- return new File(appInternalStorageDirectory, "mozilla").getAbsolutePath();
-- } else {
-- return null;
-- }
-- return Environment.getExternalStoragePublicDirectory(systemType).getAbsolutePath();
-- }
--
- @WrapForJNI(calledFrom = "gecko")
- private static int getMaxTouchPoints() {
- PackageManager pm = getApplicationContext().getPackageManager();
- if (pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND)) {
- // at least, 5+ fingers.
- return 5;
- } else if (pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT)) {
- // at least, 2+ fingers.
-diff --git a/netwerk/test/mochitests/signed_web_packaged_app.sjs b/netwerk/test/mochitests/signed_web_packaged_app.sjs
---- a/netwerk/test/mochitests/signed_web_packaged_app.sjs
-+++ b/netwerk/test/mochitests/signed_web_packaged_app.sjs
-@@ -35,19 +35,16 @@ Content-Type: application/x-web-app-mani
- "src": "scripts/library.js",
- "integrity": "TN2ByXZiaBiBCvS4MeZ02UyNi44vED+KjdjLInUl4o8="
- }
- ],
- "moz-permissions": [
- {
- "systemXHR": {
- "description": "Needed to download stuff"
-- },
-- "devicestorage:pictures": {
-- "description": "Need to load pictures"
- }
- }
- ],
- "package-identifier": "09bc9714-7ab6-4320-9d20-fde4c237522c",
- "description": "A great app!"
- }\r
- --NKWXJUAFXB\r
- Content-Location: page2.html\r
-diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
---- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
-+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
-@@ -268,53 +268,16 @@ this.DownloadIntegration = {
- // Add the view used for detecting changes to downloads to be persisted.
- // We must do this after the list of persistent downloads has been loaded,
- // even if the load operation failed. We wait for a complete initialization
- // so other callers cannot modify the list without being detected. The
- // DownloadAutoSaveView is kept alive by the underlying DownloadList.
- yield new DownloadAutoSaveView(list, this._store).initialize();
- }),
-
--#ifdef MOZ_WIDGET_GONK
-- /**
-- * Finds the default download directory which can be either in the
-- * internal storage or on the sdcard.
-- *
-- * @return {Promise}
-- * @resolves The downloads directory string path.
-- */
-- _getDefaultDownloadDirectory: Task.async(function* () {
-- let directoryPath;
-- let win = Services.wm.getMostRecentWindow("navigator:browser");
-- let storages = win.navigator.getDeviceStorages("sdcard");
-- let preferredStorageName;
-- // Use the first one or the default storage.
-- storages.forEach((aStorage) => {
-- if (aStorage.default || !preferredStorageName) {
-- preferredStorageName = aStorage.storageName;
-- }
-- });
--
-- // Now get the path for this storage area.
-- if (preferredStorageName) {
-- let volume = volumeService.getVolumeByName(preferredStorageName);
-- if (volume && volume.state === Ci.nsIVolume.STATE_MOUNTED){
-- directoryPath = OS.Path.join(volume.mountPoint, "downloads");
-- yield OS.File.makeDir(directoryPath, { ignoreExisting: true });
-- }
-- }
-- if (directoryPath) {
-- return directoryPath;
-- } else {
-- throw new Components.Exception("No suitable storage for downloads.",
-- Cr.NS_ERROR_FILE_UNRECOGNIZED_PATH);
-- }
-- }),
--#endif
--
- /**
- * Determines if a Download object from the list of persistent downloads
- * should be saved into a file, so that it can be restored across sessions.
- *
- * This function allows filtering out downloads that the host application is
- * not interested in persisting across sessions, for example downloads that
- * finished successfully.
- *
-@@ -377,18 +340,16 @@ this.DownloadIntegration = {
- #ifdef MOZ_WIDGET_ANDROID
- // Android doesn't have a $HOME directory, and by default we only have
- // write access to /data/data/org.mozilla.{$APP} and /sdcard
- directoryPath = gEnvironment.get("DOWNLOADS_DIRECTORY");
- if (!directoryPath) {
- throw new Components.Exception("DOWNLOADS_DIRECTORY is not set.",
- Cr.NS_ERROR_FILE_UNRECOGNIZED_PATH);
- }
--#elifdef MOZ_WIDGET_GONK
-- directoryPath = this._getDefaultDownloadDirectory();
- #else
- // For Linux, use XDG download dir, with a fallback to Home/Downloads
- // if the XDG user dirs are disabled.
- try {
- directoryPath = this._getDirectory("DfltDwnld");
- } catch(e) {
- directoryPath = yield this._createDownloadsDirectory("Home");
- }
-@@ -405,19 +366,16 @@ this.DownloadIntegration = {
- /**
- * Returns the user downloads directory asynchronously.
- *
- * @return {Promise}
- * @resolves The downloads directory string path.
- */
- getPreferredDownloadsDirectory: Task.async(function* () {
- let directoryPath = null;
--#ifdef MOZ_WIDGET_GONK
-- directoryPath = this._getDefaultDownloadDirectory();
--#else
- let prefValue = 1;
-
- try {
- prefValue = Services.prefs.getIntPref("browser.download.folderList");
- } catch(e) {}
-
- switch(prefValue) {
- case 0: // Desktop
-@@ -435,17 +393,16 @@ this.DownloadIntegration = {
- } catch(ex) {
- // Either the preference isn't set or the directory cannot be created.
- directoryPath = yield this.getSystemDownloadsDirectory();
- }
- break;
- default:
- directoryPath = yield this.getSystemDownloadsDirectory();
- }
--#endif
- return directoryPath;
- }),
-
- /**
- * Returns the temporary downloads directory asynchronously.
- *
- * @return {Promise}
- * @resolves The downloads directory string path.
-diff --git a/toolkit/components/jsdownloads/src/DownloadPlatform.cpp b/toolkit/components/jsdownloads/src/DownloadPlatform.cpp
---- a/toolkit/components/jsdownloads/src/DownloadPlatform.cpp
-+++ b/toolkit/components/jsdownloads/src/DownloadPlatform.cpp
-@@ -185,28 +185,16 @@ nsresult DownloadPlatform::DownloadDone(
- if (sourceCFURL) {
- ::CFRelease(sourceCFURL);
- }
- if (referrerCFURL) {
- ::CFRelease(referrerCFURL);
- }
- }
- #endif
-- if (mozilla::Preferences::GetBool("device.storage.enabled", true)) {
-- // Tell DeviceStorage that a new file may have been added.
-- nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-- nsCOMPtr<nsISupportsString> pathString
-- = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
-- if (obs && pathString) {
-- if (NS_SUCCEEDED(pathString->SetData(path))) {
-- (void)obs->NotifyObservers(pathString, "download-watcher-notify",
-- u"modified");
-- }
-- }
-- }
- }
-
- #endif
-
- return NS_OK;
- }
-
- nsresult DownloadPlatform::MapUrlToZone(const nsAString& aURL,
-diff --git a/toolkit/components/jsdownloads/test/unit/common_test_Download.js b/toolkit/components/jsdownloads/test/unit/common_test_Download.js
---- a/toolkit/components/jsdownloads/test/unit/common_test_Download.js
-+++ b/toolkit/components/jsdownloads/test/unit/common_test_Download.js
-@@ -2315,103 +2315,16 @@ add_task(function* test_toSerializable_s
- let download2 = yield Downloads.createDownload(reserialized);
-
- do_check_eq(download1.startTime.constructor.name, "Date");
- do_check_eq(download2.startTime.constructor.name, "Date");
- do_check_eq(download1.startTime.toJSON(), download2.startTime.toJSON());
- });
-
- /**
-- * This test will call the platform specific operations within
-- * DownloadPlatform::DownloadDone. While there is no test to verify the
-- * specific behaviours, this at least ensures that there is no error or crash.
-- */
--add_task(function* test_platform_integration()
--{
-- let downloadFiles = [];
-- let oldDeviceStorageEnabled = false;
-- try {
-- oldDeviceStorageEnabled = Services.prefs.getBoolPref("device.storage.enabled");
-- } catch (e) {
-- // This happens if the pref doesn't exist.
-- }
-- let downloadWatcherNotified = false;
-- let observer = {
-- observe: function(subject, topic, data) {
-- do_check_eq(topic, "download-watcher-notify");
-- do_check_eq(data, "modified");
-- downloadWatcherNotified = true;
-- }
-- }
-- Services.obs.addObserver(observer, "download-watcher-notify", false);
-- Services.prefs.setBoolPref("device.storage.enabled", true);
-- let downloadDoneCalled = false;
-- let monitorFn = base => ({
-- __proto__: base,
-- downloadDone() {
-- return super.downloadDone(...arguments).then(() => {
-- downloadDoneCalled = true;
-- });
-- },
-- });
-- Integration.downloads.register(monitorFn);
-- DownloadIntegration.allowDirectories = true;
-- function cleanup() {
-- for (let file of downloadFiles) {
-- file.remove(true);
-- }
-- Services.obs.removeObserver(observer, "download-watcher-notify");
-- Services.prefs.setBoolPref("device.storage.enabled", oldDeviceStorageEnabled);
-- Integration.downloads.unregister(monitorFn);
-- DownloadIntegration.allowDirectories = false;
-- }
--
-- for (let isPrivate of [false, true]) {
-- downloadDoneCalled = false;
--
-- // Some platform specific operations only operate on files outside the
-- // temporary directory or in the Downloads directory (such as setting
-- // the Windows searchable attribute, and the Mac Downloads icon bouncing),
-- // so use the system Downloads directory for the target file.
-- let targetFilePath = yield DownloadIntegration.getSystemDownloadsDirectory();
-- targetFilePath = OS.Path.join(targetFilePath,
-- "test" + (Math.floor(Math.random() * 1000000)));
-- let targetFile = new FileUtils.File(targetFilePath);
-- downloadFiles.push(targetFile);
--
-- let download;
-- if (gUseLegacySaver) {
-- download = yield promiseStartLegacyDownload(httpUrl("source.txt"),
-- { isPrivate, targetFile });
-- }
-- else {
-- download = yield Downloads.createDownload({
-- source: { url: httpUrl("source.txt"), isPrivate },
-- target: targetFile,
-- });
-- download.start().catch(() => {});
-- }
--
-- // Wait for the whenSucceeded promise to be resolved first.
-- // downloadDone should be called before the whenSucceeded promise is resolved.
-- yield download.whenSucceeded().then(function () {
-- do_check_true(downloadDoneCalled);
-- do_check_true(downloadWatcherNotified);
-- });
--
-- // Then, wait for the promise returned by "start" to be resolved.
-- yield promiseDownloadStopped(download);
--
-- yield promiseVerifyTarget(download.target, TEST_DATA_SHORT);
-- }
--
-- cleanup();
--});
--
--/**
- * Checks that downloads are added to browsing history when they start.
- */
- add_task(function* test_history()
- {
- mustInterruptResponses();
-
- // We will wait for the visit to be notified during the download.
- yield PlacesTestUtils.clearHistory();
-diff --git a/toolkit/content/devicestorage.properties b/toolkit/content/devicestorage.properties
-deleted file mode 100644
---- a/toolkit/content/devicestorage.properties
-+++ /dev/null
-@@ -1,4 +0,0 @@
--# Extensions we recognize for DeviceStorage storage areas
--pictures=*.jpe; *.jpg; *.jpeg; *.gif; *.png; *.bmp;
--music=*.mp3; *.oga; *.ogg; *.m4a; *.m4b; *.m4p; *.m4r; *.3gp; *.3gpp; *.mp4; *.m3u; *.pls; *.opus; *.amr; *.wav; *.lcka; *.mka; *.flac;
--videos=*.mp4; *.mpeg; *.mpg; *.ogv; *.ogx; *.webm; *.3gp; *.3gpp; *.3g2; *.ogg; *.m4v; *.ts; *.m2ts; *.avi; *.divx; *.mkv;
-diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
---- a/toolkit/content/jar.mn
-+++ b/toolkit/content/jar.mn
-@@ -40,17 +40,16 @@ toolkit.jar:
- content/global/browser-content.js
- * content/global/buildconfig.html
- content/global/contentAreaUtils.js
- #ifndef MOZ_ICECATMOBILE
- content/global/customizeToolbar.css
- content/global/customizeToolbar.js
- content/global/customizeToolbar.xul
- #endif
-- content/global/devicestorage.properties
- #ifndef MOZ_ICECATMOBILE
- content/global/editMenuOverlay.js
- * content/global/editMenuOverlay.xul
- content/global/finddialog.js
- * content/global/finddialog.xul
- content/global/findUtils.js
- #endif
- content/global/filepicker.properties
-@@ -113,9 +112,9 @@ toolkit.jar:
- content/global/bindings/videocontrols.css (widgets/videocontrols.css)
- * content/global/bindings/wizard.xml (widgets/wizard.xml)
- #ifdef XP_MACOSX
- content/global/macWindowMenu.js
- #endif
- content/global/svg/svgBindings.xml (/layout/svg/resources/content/svgBindings.xml)
- content/global/gmp-sources/eme-adobe.json (gmp-sources/eme-adobe.json)
- content/global/gmp-sources/openh264.json (gmp-sources/openh264.json)
-- content/global/gmp-sources/widevinecdm.json (gmp-sources/widevinecdm.json)
-\ No newline at end of file
-+ content/global/gmp-sources/widevinecdm.json (gmp-sources/widevinecdm.json)
-diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp
---- a/uriloader/exthandler/nsExternalHelperAppService.cpp
-+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
-@@ -101,20 +101,16 @@
-
- #ifdef MOZ_WIDGET_ANDROID
- #include "IceCatMobileJNIWrappers.h"
- #endif
-
- #include "mozilla/Preferences.h"
- #include "mozilla/ipc/URIUtils.h"
-
--#ifdef MOZ_WIDGET_GONK
--#include "nsDeviceStorage.h"
--#endif
--
- using namespace mozilla;
- using namespace mozilla::ipc;
-
- // Download Folder location constants
- #define NS_PREF_DOWNLOAD_DIR "browser.download.dir"
- #define NS_PREF_DOWNLOAD_FOLDERLIST "browser.download.folderList"
- enum {
- NS_FOLDER_VALUE_DESKTOP = 0
-@@ -321,65 +317,16 @@ static nsresult GetDownloadDirectory(nsI
- }
-
- if (!dir) {
- // If not, we default to the OS X default download location.
- nsresult rv = NS_GetSpecialDirectory(NS_OSX_DEFAULT_DOWNLOAD_DIR,
- getter_AddRefs(dir));
- NS_ENSURE_SUCCESS(rv, rv);
- }
--#elif defined(MOZ_WIDGET_GONK)
-- // On Gonk, store the files on the sdcard in the downloads directory.
-- // We need to check with the volume manager which storage point is
-- // available.
--
-- // Pick the default storage in case multiple (internal and external) ones
-- // are available.
-- nsString storageName;
-- nsDOMDeviceStorage::GetDefaultStorageName(NS_LITERAL_STRING("sdcard"),
-- storageName);
--
-- RefPtr<DeviceStorageFile> dsf(
-- new DeviceStorageFile(NS_LITERAL_STRING("sdcard"),
-- storageName,
-- NS_LITERAL_STRING("downloads")));
-- NS_ENSURE_TRUE(dsf->mFile, NS_ERROR_FILE_ACCESS_DENIED);
--
-- // If we're not checking for availability we're done.
-- if (aSkipChecks) {
-- dsf->mFile.forget(_directory);
-- return NS_OK;
-- }
--
-- // Check device storage status before continuing.
-- nsString storageStatus;
-- dsf->GetStatus(storageStatus);
--
-- // If we get an "unavailable" status, it means the sd card is not present.
-- // We'll also catch internal errors by looking for an empty string and assume
-- // the SD card isn't present when this occurs.
-- if (storageStatus.EqualsLiteral("unavailable") ||
-- storageStatus.IsEmpty()) {
-- return NS_ERROR_FILE_NOT_FOUND;
-- }
--
-- // If we get a status other than 'available' here it means the card is busy
-- // because it's mounted via USB or it is being formatted.
-- if (!storageStatus.EqualsLiteral("available")) {
-- return NS_ERROR_FILE_ACCESS_DENIED;
-- }
--
-- bool alreadyThere;
-- nsresult rv = dsf->mFile->Exists(&alreadyThere);
-- NS_ENSURE_SUCCESS(rv, rv);
-- if (!alreadyThere) {
-- rv = dsf->mFile->Create(nsIFile::DIRECTORY_TYPE, 0770);
-- NS_ENSURE_SUCCESS(rv, rv);
-- }
-- dir = dsf->mFile;
- #elif defined(ANDROID)
- // We ask Java for the temporary download directory. The directory will be
- // different depending on whether we have the permission to write to the
- // public download directory or not.
- // In the case where we do not have the permission we will start the
- // download to the app cache directory and later move it to the final
- // destination after prompting for the permission.
- jni::String::LocalRef downloadDir;
-diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp
---- a/widget/android/AndroidBridge.cpp
-+++ b/widget/android/AndroidBridge.cpp
-@@ -1119,42 +1119,8 @@ nsresult AndroidBridge::InputStreamRead(
-
- if (read <= 0) {
- *aRead = 0;
- return NS_OK;
- }
- *aRead = read;
- return NS_OK;
- }
--
--nsresult AndroidBridge::GetExternalPublicDirectory(const nsAString& aType, nsAString& aPath) {
-- if (XRE_IsContentProcess()) {
-- nsString key(aType);
-- nsAutoString path;
-- if (AndroidBridge::sStoragePaths.Get(key, &path)) {
-- aPath = path;
-- return NS_OK;
-- }
--
-- // Lazily get the value from the parent.
-- dom::ContentChild* child = dom::ContentChild::GetSingleton();
-- if (child) {
-- nsAutoString type(aType);
-- child->SendGetDeviceStorageLocation(type, &path);
-- if (!path.IsEmpty()) {
-- AndroidBridge::sStoragePaths.Put(key, path);
-- aPath = path;
-- return NS_OK;
-- }
-- }
--
-- ALOG_BRIDGE("AndroidBridge::GetExternalPublicDirectory no cache for %s",
-- NS_ConvertUTF16toUTF8(aType).get());
-- return NS_ERROR_NOT_AVAILABLE;
-- }
--
-- auto path = GeckoAppShell::GetExternalPublicDirectory(aType);
-- if (!path) {
-- return NS_ERROR_NOT_AVAILABLE;
-- }
-- aPath = path->ToString();
-- return NS_OK;
--}
-diff --git a/widget/android/AndroidBridge.h b/widget/android/AndroidBridge.h
---- a/widget/android/AndroidBridge.h
-+++ b/widget/android/AndroidBridge.h
-@@ -197,18 +197,16 @@ public:
- static jmethodID GetStaticMethodID(JNIEnv* env, jclass jClass, const char* methodName, const char* methodType);
-
- static jni::Object::LocalRef ChannelCreate(jni::Object::Param);
-
- static void InputStreamClose(jni::Object::Param obj);
- static uint32_t InputStreamAvailable(jni::Object::Param obj);
- static nsresult InputStreamRead(jni::Object::Param obj, char *aBuf, uint32_t aCount, uint32_t *aRead);
-
-- static nsresult GetExternalPublicDirectory(const nsAString& aType, nsAString& aPath);
--
- protected:
- static nsDataHashtable<nsStringHashKey, nsString> sStoragePaths;
-
- static AndroidBridge* sBridge;
-
- AndroidBridge();
- ~AndroidBridge();
-
-diff --git a/widget/android/GeneratedJNIWrappers.cpp b/widget/android/GeneratedJNIWrappers.cpp
---- a/widget/android/GeneratedJNIWrappers.cpp
-+++ b/widget/android/GeneratedJNIWrappers.cpp
-@@ -274,24 +274,16 @@ auto GeckoAppShell::GetExceptionStackTra
- constexpr char GeckoAppShell::GetExtensionFromMimeType_t::name[];
- constexpr char GeckoAppShell::GetExtensionFromMimeType_t::signature[];
-
- auto GeckoAppShell::GetExtensionFromMimeType(mozilla::jni::String::Param a0) -> mozilla::jni::String::LocalRef
- {
- return mozilla::jni::Method<GetExtensionFromMimeType_t>::Call(GeckoAppShell::Context(), nullptr, a0);
- }
-
--constexpr char GeckoAppShell::GetExternalPublicDirectory_t::name[];
--constexpr char GeckoAppShell::GetExternalPublicDirectory_t::signature[];
--
--auto GeckoAppShell::GetExternalPublicDirectory(mozilla::jni::String::Param a0) -> mozilla::jni::String::LocalRef
--{
-- return mozilla::jni::Method<GetExternalPublicDirectory_t>::Call(GeckoAppShell::Context(), nullptr, a0);
--}
--
- constexpr char GeckoAppShell::GetHWDecoderCapability_t::name[];
- constexpr char GeckoAppShell::GetHWDecoderCapability_t::signature[];
-
- auto GeckoAppShell::GetHWDecoderCapability() -> bool
- {
- return mozilla::jni::Method<GetHWDecoderCapability_t>::Call(GeckoAppShell::Context(), nullptr);
- }
-
-diff --git a/widget/android/GeneratedJNIWrappers.h b/widget/android/GeneratedJNIWrappers.h
---- a/widget/android/GeneratedJNIWrappers.h
-+++ b/widget/android/GeneratedJNIWrappers.h
-@@ -724,36 +724,16 @@ public:
- static const mozilla::jni::CallingThread callingThread =
- mozilla::jni::CallingThread::GECKO;
- static const mozilla::jni::DispatchTarget dispatchTarget =
- mozilla::jni::DispatchTarget::CURRENT;
- };
-
- static auto GetExtensionFromMimeType(mozilla::jni::String::Param) -> mozilla::jni::String::LocalRef;
-
-- struct GetExternalPublicDirectory_t {
-- typedef GeckoAppShell Owner;
-- typedef mozilla::jni::String::LocalRef ReturnType;
-- typedef mozilla::jni::String::Param SetterType;
-- typedef mozilla::jni::Args<
-- mozilla::jni::String::Param> Args;
-- static constexpr char name[] = "getExternalPublicDirectory";
-- static constexpr char signature[] =
-- "(Ljava/lang/String;)Ljava/lang/String;";
-- static const bool isStatic = true;
-- static const mozilla::jni::ExceptionMode exceptionMode =
-- mozilla::jni::ExceptionMode::ABORT;
-- static const mozilla::jni::CallingThread callingThread =
-- mozilla::jni::CallingThread::GECKO;
-- static const mozilla::jni::DispatchTarget dispatchTarget =
-- mozilla::jni::DispatchTarget::CURRENT;
-- };
--
-- static auto GetExternalPublicDirectory(mozilla::jni::String::Param) -> mozilla::jni::String::LocalRef;
--
- struct GetHWDecoderCapability_t {
- typedef GeckoAppShell Owner;
- typedef bool ReturnType;
- typedef bool SetterType;
- typedef mozilla::jni::Args<> Args;
- static constexpr char name[] = "getHWDecoderCapability";
- static constexpr char signature[] =
- "()Z";
-diff --git a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
---- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
-+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
-@@ -155,17 +155,16 @@
- #include "mozilla/dom/CSSValueBinding.h"
- #include "mozilla/dom/CSSValueListBinding.h"
- #include "mozilla/dom/CustomEventBinding.h"
- #ifdef MOZ_WEBRTC
- #include "mozilla/dom/DataChannelBinding.h"
- #endif
- #include "mozilla/dom/DataContainerEventBinding.h"
- #include "mozilla/dom/DataTransferBinding.h"
--#include "mozilla/dom/DeviceStorageBinding.h"
- #include "mozilla/dom/DOMCursorBinding.h"
- #include "mozilla/dom/DOMExceptionBinding.h"
- #include "mozilla/dom/DOMParserBinding.h"
- #include "mozilla/dom/DOMRequestBinding.h"
- #include "mozilla/dom/DocumentBinding.h"
- #include "mozilla/dom/DocumentFragmentBinding.h"
- #include "mozilla/dom/DocumentTypeBinding.h"
- #include "mozilla/dom/DocumentBinding.h"
-
diff --git a/gnu/packages/patches/libsndfile-CVE-2017-8361-8363-8365.patch b/gnu/packages/patches/libsndfile-CVE-2017-8361-8363-8365.patch
new file mode 100644
index 0000000000..5f63231af0
--- /dev/null
+++ b/gnu/packages/patches/libsndfile-CVE-2017-8361-8363-8365.patch
@@ -0,0 +1,77 @@
+Fix CVE-2017-{8361,8363,8365}:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8361
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8363
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8365
+
+Patch copied from upstream source repository:
+
+https://github.com/erikd/libsndfile/commit/fd0484aba8e51d16af1e3a880f9b8b857b385eb3
+
+From fd0484aba8e51d16af1e3a880f9b8b857b385eb3 Mon Sep 17 00:00:00 2001
+From: Erik de Castro Lopo <erikd@mega-nerd.com>
+Date: Wed, 12 Apr 2017 19:45:30 +1000
+Subject: [PATCH] FLAC: Fix a buffer read overrun
+
+Buffer read overrun occurs when reading a FLAC file that switches
+from 2 channels to one channel mid-stream. Only option is to
+abort the read.
+
+Closes: https://github.com/erikd/libsndfile/issues/230
+---
+ src/common.h | 1 +
+ src/flac.c | 13 +++++++++++++
+ src/sndfile.c | 1 +
+ 3 files changed, 15 insertions(+)
+
+diff --git a/src/common.h b/src/common.h
+index 0bd810c3..e2669b6a 100644
+--- a/src/common.h
++++ b/src/common.h
+@@ -725,6 +725,7 @@ enum
+ SFE_FLAC_INIT_DECODER,
+ SFE_FLAC_LOST_SYNC,
+ SFE_FLAC_BAD_SAMPLE_RATE,
++ SFE_FLAC_CHANNEL_COUNT_CHANGED,
+ SFE_FLAC_UNKOWN_ERROR,
+
+ SFE_WVE_NOT_WVE,
+diff --git a/src/flac.c b/src/flac.c
+index 84de0e26..986a7b8f 100644
+--- a/src/flac.c
++++ b/src/flac.c
+@@ -434,6 +434,19 @@ sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC_
+
+ switch (metadata->type)
+ { case FLAC__METADATA_TYPE_STREAMINFO :
++ if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels)
++ { psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n"
++ "Nothing to be but to error out.\n" ,
++ psf->sf.channels, metadata->data.stream_info.channels) ;
++ psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ;
++ return ;
++ } ;
++
++ if (psf->sf.channels > 0 && psf->sf.samplerate != (int) metadata->data.stream_info.sample_rate)
++ { psf_log_printf (psf, "Warning: FLAC stream changed sample rates from %d to %d.\n"
++ "Carrying on as if nothing happened.",
++ psf->sf.samplerate, metadata->data.stream_info.sample_rate) ;
++ } ;
+ psf->sf.channels = metadata->data.stream_info.channels ;
+ psf->sf.samplerate = metadata->data.stream_info.sample_rate ;
+ psf->sf.frames = metadata->data.stream_info.total_samples ;
+diff --git a/src/sndfile.c b/src/sndfile.c
+index 41875610..e2a87be8 100644
+--- a/src/sndfile.c
++++ b/src/sndfile.c
+@@ -245,6 +245,7 @@ ErrorStruct SndfileErrors [] =
+ { SFE_FLAC_INIT_DECODER , "Error : problem with initialization of the flac decoder." },
+ { SFE_FLAC_LOST_SYNC , "Error : flac decoder lost sync." },
+ { SFE_FLAC_BAD_SAMPLE_RATE, "Error : flac does not support this sample rate." },
++ { SFE_FLAC_CHANNEL_COUNT_CHANGED, "Error : flac channel changed mid stream." },
+ { SFE_FLAC_UNKOWN_ERROR , "Error : unknown error in flac decoder." },
+
+ { SFE_WVE_NOT_WVE , "Error : not a WVE file." },
+--
+2.12.2
+
diff --git a/gnu/packages/patches/libsndfile-CVE-2017-8362.patch b/gnu/packages/patches/libsndfile-CVE-2017-8362.patch
new file mode 100644
index 0000000000..5fc52a377a
--- /dev/null
+++ b/gnu/packages/patches/libsndfile-CVE-2017-8362.patch
@@ -0,0 +1,61 @@
+Fix CVE-2017-8362:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8362
+
+Patch copied from upstream source repository:
+
+https://github.com/erikd/libsndfile/commit/ef1dbb2df1c0e741486646de40bd638a9c4cd808
+
+From ef1dbb2df1c0e741486646de40bd638a9c4cd808 Mon Sep 17 00:00:00 2001
+From: Erik de Castro Lopo <erikd@mega-nerd.com>
+Date: Fri, 14 Apr 2017 15:19:16 +1000
+Subject: [PATCH] src/flac.c: Fix a buffer read overflow
+
+A file (generated by a fuzzer) which increased the number of channels
+from one frame to the next could cause a read beyond the end of the
+buffer provided by libFLAC. Only option is to abort the read.
+
+Closes: https://github.com/erikd/libsndfile/issues/231
+---
+ src/flac.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/src/flac.c b/src/flac.c
+index 5a4f8c21..e4f9aaa0 100644
+--- a/src/flac.c
++++ b/src/flac.c
+@@ -169,6 +169,14 @@ flac_buffer_copy (SF_PRIVATE *psf)
+ const int32_t* const *buffer = pflac->wbuffer ;
+ unsigned i = 0, j, offset, channels, len ;
+
++ if (psf->sf.channels != (int) frame->header.channels)
++ { psf_log_printf (psf, "Error: FLAC frame changed from %d to %d channels\n"
++ "Nothing to do but to error out.\n" ,
++ psf->sf.channels, frame->header.channels) ;
++ psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ;
++ return 0 ;
++ } ;
++
+ /*
+ ** frame->header.blocksize is variable and we're using a constant blocksize
+ ** of FLAC__MAX_BLOCK_SIZE.
+@@ -202,7 +210,6 @@ flac_buffer_copy (SF_PRIVATE *psf)
+ return 0 ;
+ } ;
+
+-
+ len = SF_MIN (pflac->len, frame->header.blocksize) ;
+
+ if (pflac->remain % channels != 0)
+@@ -436,7 +443,7 @@ sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC_
+ { case FLAC__METADATA_TYPE_STREAMINFO :
+ if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels)
+ { psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n"
+- "Nothing to be but to error out.\n" ,
++ "Nothing to do but to error out.\n" ,
+ psf->sf.channels, metadata->data.stream_info.channels) ;
+ psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ;
+ return ;
+--
+2.12.2
+
diff --git a/gnu/packages/patches/libtiff-CVE-2017-7593.patch b/gnu/packages/patches/libtiff-CVE-2017-7593.patch
new file mode 100644
index 0000000000..496efb73b9
--- /dev/null
+++ b/gnu/packages/patches/libtiff-CVE-2017-7593.patch
@@ -0,0 +1,113 @@
+Fixes CVE-2017-7593 (Potential uninitialized-memory access from tif_rawdata):
+
+http://bugzilla.maptools.org/show_bug.cgi?id=2651
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7593
+https://security-tracker.debian.org/tracker/CVE-2017-7593
+
+2017-01-11 Even Rouault <even.rouault at spatialys.com>
+
+ * libtiff/tiffio.h, tif_unix.c, tif_win32.c, tif_vms.c: add
+ _TIFFcalloc()
+
+ * libtiff/tif_read.c: TIFFReadBufferSetup(): use _TIFFcalloc() to zero
+ initialize tif_rawdata.
+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2651
+
+/cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog
+new revision: 1.1208; previous revision: 1.1207
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_read.c,v <-- libtiff/tif_read.c
+new revision: 1.53; previous revision: 1.52
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_unix.c,v <-- libtiff/tif_unix.c
+new revision: 1.28; previous revision: 1.27
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_vms.c,v <-- libtiff/tif_vms.c
+new revision: 1.14; previous revision: 1.13
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_win32.c,v <-- libtiff/tif_win32.c
+new revision: 1.42; previous revision: 1.41
+/cvs/maptools/cvsroot/libtiff/libtiff/tiffio.h,v <-- libtiff/tiffio.h
+new revision: 1.94; previous revision: 1.93
+
+diff -ru tiff-4.0.7/libtiff/tiffio.h tiff-4.0.7.new/libtiff/tiffio.h
+--- tiff-4.0.7/libtiff/tiffio.h 1969-12-31 19:00:00.000000000 -0500
++++ tiff-4.0.7.new/libtiff/tiffio.h 2017-05-05 19:08:03.772999790 -0400
+@@ -1,4 +1,4 @@
+-/* $Id: tiffio.h,v 1.92 2016-01-23 21:20:34 erouault Exp $ */
++/* $Id: tiffio.h,v 1.94 2017-01-11 19:02:49 erouault Exp $ */
+
+ /*
+ * Copyright (c) 1988-1997 Sam Leffler
+@@ -293,6 +293,7 @@
+ */
+
+ extern void* _TIFFmalloc(tmsize_t s);
++extern void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz);
+ extern void* _TIFFrealloc(void* p, tmsize_t s);
+ extern void _TIFFmemset(void* p, int v, tmsize_t c);
+ extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c);
+diff -ru tiff-4.0.7/libtiff/tif_read.c tiff-4.0.7.new/libtiff/tif_read.c
+--- tiff-4.0.7/libtiff/tif_read.c 2017-05-05 19:04:09.740966642 -0400
++++ tiff-4.0.7.new/libtiff/tif_read.c 2017-05-05 18:59:11.070709441 -0400
+@@ -1,4 +1,4 @@
+-/* $Id: tif_read.c,v 1.50 2016-12-02 21:56:56 erouault Exp $ */
++/* $Id: tif_read.c,v 1.53 2017-01-11 19:02:49 erouault Exp $ */
+
+ /*
+ * Copyright (c) 1988-1997 Sam Leffler
+@@ -976,7 +976,9 @@
+ "Invalid buffer size");
+ return (0);
+ }
+- tif->tif_rawdata = (uint8*) _TIFFmalloc(tif->tif_rawdatasize);
++ /* Initialize to zero to avoid uninitialized buffers in case of */
++ /* short reads (http://bugzilla.maptools.org/show_bug.cgi?id=2651) */
++ tif->tif_rawdata = (uint8*) _TIFFcalloc(1, tif->tif_rawdatasize);
+ tif->tif_flags |= TIFF_MYBUFFER;
+ }
+ if (tif->tif_rawdata == NULL) {
+diff -ru tiff-4.0.7/libtiff/tif_unix.c tiff-4.0.7.new/libtiff/tif_unix.c
+--- tiff-4.0.7/libtiff/tif_unix.c 1969-12-31 19:00:00.000000000 -0500
++++ tiff-4.0.7.new/libtiff/tif_unix.c 2017-05-05 19:10:48.302645187 -0400
+@@ -1,4 +1,4 @@
+-/* $Id: tif_unix.c,v 1.27 2015-08-19 02:31:04 bfriesen Exp $ */
++/* $Id: tif_unix.c,v 1.28 2017-01-11 19:02:49 erouault Exp $ */
+
+ /*
+ * Copyright (c) 1988-1997 Sam Leffler
+@@ -316,6 +316,14 @@
+ return (malloc((size_t) s));
+ }
+
++void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz)
++{
++ if( nmemb == 0 || siz == 0 )
++ return ((void *) NULL);
++
++ return calloc((size_t) nmemb, (size_t)siz);
++}
++
+ void
+ _TIFFfree(void* p)
+ {
+diff -ru tiff-4.0.7/libtiff/tif_win32.c tiff-4.0.7.new/libtiff/tif_win32.c
+--- tiff-4.0.7/libtiff/tif_win32.c 1969-12-31 19:00:00.000000000 -0500
++++ tiff-4.0.7.new/libtiff/tif_win32.c 2017-05-05 19:13:06.903399627 -0400
+@@ -1,4 +1,4 @@
+-/* $Id: tif_win32.c,v 1.41 2015-08-23 20:12:44 bfriesen Exp $ */
++/* $Id: tif_win32.c,v 1.42 2017-01-11 19:02:49 erouault Exp $ */
+
+ /*
+ * Copyright (c) 1988-1997 Sam Leffler
+@@ -360,6 +360,14 @@
+ return (malloc((size_t) s));
+ }
+
++void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz)
++{
++ if( nmemb == 0 || siz == 0 )
++ return ((void *) NULL);
++
++ return calloc((size_t) nmemb, (size_t)siz);
++}
++
+ void
+ _TIFFfree(void* p)
+ {
diff --git a/gnu/packages/patches/libtiff-CVE-2017-7594.patch b/gnu/packages/patches/libtiff-CVE-2017-7594.patch
new file mode 100644
index 0000000000..d17997d447
--- /dev/null
+++ b/gnu/packages/patches/libtiff-CVE-2017-7594.patch
@@ -0,0 +1,54 @@
+Fixes CVE-2017-7594 (Direct leak in tif_ojpeg.c):
+
+http://bugzilla.maptools.org/show_bug.cgi?id=2659
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7594
+https://security-tracker.debian.org/tracker/CVE-2017-7594
+
+2017-01-12 Even Rouault <even.rouault at spatialys.com>
+
+ * libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesAcTable
+ when read fails.
+ Patch by Nicolás Peña.
+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2659
+
+/cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog
+new revision: 1.1212; previous revision: 1.1211
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_ojpeg.c,v <-- libtiff/tif_ojpeg.c
+new revision: 1.67; previous revision: 1.66
+
+Index: libtiff/libtiff/tif_ojpeg.c
+===================================================================
+RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_ojpeg.c,v
+retrieving revision 1.67
+retrieving revision 1.68
+diff -u -r1.67 -r1.68
+--- libtiff/libtiff/tif_ojpeg.c 12 Jan 2017 17:43:26 -0000 1.67
++++ libtiff/libtiff/tif_ojpeg.c 12 Jan 2017 19:23:20 -0000 1.68
+@@ -1,4 +1,4 @@
+-/* $Id: tif_ojpeg.c,v 1.66 2016-12-03 11:15:18 erouault Exp $ */
++/* $Id: tif_ojpeg.c,v 1.68 2017-01-12 19:23:20 erouault Exp $ */
+
+ /* WARNING: The type of JPEG encapsulation defined by the TIFF Version 6.0
+ specification is now totally obsolete and deprecated for new applications and
+@@ -1790,7 +1790,10 @@
+ TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET);
+ p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
+ if (p!=64)
++ {
++ _TIFFfree(ob);
+ return(0);
++ }
+ sp->qtable[m]=ob;
+ sp->sof_tq[m]=m;
+ }
+@@ -1854,7 +1857,10 @@
+ rb[sizeof(uint32)+5+n]=o[n];
+ p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
+ if (p!=q)
++ {
++ _TIFFfree(rb);
+ return(0);
++ }
+ sp->dctable[m]=rb;
+ sp->sos_tda[m]=(m<<4);
+ }
diff --git a/gnu/packages/patches/libtiff-multiple-UBSAN-crashes.patch b/gnu/packages/patches/libtiff-multiple-UBSAN-crashes.patch
new file mode 100644
index 0000000000..2f4509f386
--- /dev/null
+++ b/gnu/packages/patches/libtiff-multiple-UBSAN-crashes.patch
@@ -0,0 +1,449 @@
+Fixes CVE-2017-{7595,7596,7597,7598,7599,7600,7601,7602}:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7595
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7596
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7597
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7598
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7599
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7600
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7601
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-7602
+
+2017-01-11 Even Rouault <even.rouault at spatialys.com>
+
+ * libtiff/tif_dir.c, tif_dirread.c, tif_dirwrite.c: implement various
+ clampings
+ of double to other data types to avoid undefined behaviour if the
+ output range
+ isn't big enough to hold the input value.
+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2643
+ http://bugzilla.maptools.org/show_bug.cgi?id=2642
+ http://bugzilla.maptools.org/show_bug.cgi?id=2646
+ http://bugzilla.maptools.org/show_bug.cgi?id=2647
+
+/cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog
+new revision: 1.1204; previous revision: 1.1203
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_dir.c,v <-- libtiff/tif_dir.c
+new revision: 1.129; previous revision: 1.128
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v <-- libtiff/tif_dirread.c
+new revision: 1.207; previous revision: 1.206
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_dirwrite.c,v <-- libtiff/tif_dirwrite.c
+new revision: 1.85; previous revision: 1.84
+
+2017-01-11 Even Rouault <even.rouault at spatialys.com>
+
+ * libtiff/tif_dirread.c: avoid division by floating point 0 in
+ TIFFReadDirEntryCheckedRational() and
+ TIFFReadDirEntryCheckedSrational(),
+ and return 0 in that case (instead of infinity as before presumably)
+ Apparently some sanitizers do not like those divisions by zero.
+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2644
+
+/cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog
+new revision: 1.1203; previous revision: 1.1202
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v <-- libtiff/tif_dirread.c
+new revision: 1.206; previous revision: 1.205
+
+2017-01-11 Even Rouault <even.rouault at spatialys.com>
+
+ * libtiff/tif_jpeg.c: validate BitsPerSample in JPEGSetupEncode() to
+ avoid undefined behaviour caused by invalid shift exponent.
+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2648
+
+
+/cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog
+new revision: 1.1205; previous revision: 1.1204
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_jpeg.c,v <-- libtiff/tif_jpeg.c
+new revision: 1.126; previous revision: 1.125
+
+2017-01-11 Even Rouault <even.rouault at spatialys.com>
+
+ * libtiff/tif_read.c: avoid potential undefined behaviour on signed
+ integer addition in TIFFReadRawStrip1() in isMapped() case.
+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2650
+
+/cvs/maptools/cvsroot/libtiff/ChangeLog,v <-- ChangeLog
+new revision: 1.1206; previous revision: 1.1205
+/cvs/maptools/cvsroot/libtiff/libtiff/tif_read.c,v <-- libtiff/tif_read.c
+new revision: 1.51; previous revision: 1.50
+
+Index: libtiff/libtiff/tif_dir.c
+===================================================================
+RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dir.c,v
+retrieving revision 1.128
+retrieving revision 1.129
+diff -u -r1.128 -r1.129
+--- libtiff/libtiff/tif_dir.c 3 Dec 2016 15:30:31 -0000 1.128
++++ libtiff/libtiff/tif_dir.c 11 Jan 2017 16:09:02 -0000 1.129
+@@ -1,4 +1,4 @@
+-/* $Id: tif_dir.c,v 1.128 2016-12-03 15:30:31 erouault Exp $ */
++/* $Id: tif_dir.c,v 1.129 2017-01-11 16:09:02 erouault Exp $ */
+
+ /*
+ * Copyright (c) 1988-1997 Sam Leffler
+@@ -31,6 +31,7 @@
+ * (and also some miscellaneous stuff)
+ */
+ #include "tiffiop.h"
++#include <float.h>
+
+ /*
+ * These are used in the backwards compatibility code...
+@@ -154,6 +155,15 @@
+ return (0);
+ }
+
++static float TIFFClampDoubleToFloat( double val )
++{
++ if( val > FLT_MAX )
++ return FLT_MAX;
++ if( val < -FLT_MAX )
++ return -FLT_MAX;
++ return (float)val;
++}
++
+ static int
+ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
+ {
+@@ -312,13 +322,13 @@
+ dblval = va_arg(ap, double);
+ if( dblval < 0 )
+ goto badvaluedouble;
+- td->td_xresolution = (float) dblval;
++ td->td_xresolution = TIFFClampDoubleToFloat( dblval );
+ break;
+ case TIFFTAG_YRESOLUTION:
+ dblval = va_arg(ap, double);
+ if( dblval < 0 )
+ goto badvaluedouble;
+- td->td_yresolution = (float) dblval;
++ td->td_yresolution = TIFFClampDoubleToFloat( dblval );
+ break;
+ case TIFFTAG_PLANARCONFIG:
+ v = (uint16) va_arg(ap, uint16_vap);
+@@ -327,10 +337,10 @@
+ td->td_planarconfig = (uint16) v;
+ break;
+ case TIFFTAG_XPOSITION:
+- td->td_xposition = (float) va_arg(ap, double);
++ td->td_xposition = TIFFClampDoubleToFloat( va_arg(ap, double) );
+ break;
+ case TIFFTAG_YPOSITION:
+- td->td_yposition = (float) va_arg(ap, double);
++ td->td_yposition = TIFFClampDoubleToFloat( va_arg(ap, double) );
+ break;
+ case TIFFTAG_RESOLUTIONUNIT:
+ v = (uint16) va_arg(ap, uint16_vap);
+Index: libtiff/libtiff/tif_dirread.c
+===================================================================
+RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v
+retrieving revision 1.206
+retrieving revision 1.207
+diff -u -r1.206 -r1.207
+--- libtiff/libtiff/tif_dirread.c 11 Jan 2017 13:28:01 -0000 1.206
++++ libtiff/libtiff/tif_dirread.c 11 Jan 2017 16:09:02 -0000 1.207
+@@ -1,4 +1,4 @@
+-/* $Id: tif_dirread.c,v 1.205 2016-12-03 11:02:15 erouault Exp $ */
++/* $Id: tif_dirread.c,v 1.207 2017-01-11 16:09:02 erouault Exp $ */
+
+ /*
+ * Copyright (c) 1988-1997 Sam Leffler
+@@ -40,6 +40,7 @@
+ */
+
+ #include "tiffiop.h"
++#include <float.h>
+
+ #define IGNORE 0 /* tag placeholder used below */
+ #define FAILED_FII ((uint32) -1)
+@@ -2406,7 +2407,14 @@
+ ma=(double*)origdata;
+ mb=data;
+ for (n=0; n<count; n++)
+- *mb++=(float)(*ma++);
++ {
++ double val = *ma++;
++ if( val > FLT_MAX )
++ val = FLT_MAX;
++ else if( val < -FLT_MAX )
++ val = -FLT_MAX;
++ *mb++=(float)val;
++ }
+ }
+ break;
+ }
+Index: libtiff/libtiff/tif_dirwrite.c
+===================================================================
+RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirwrite.c,v
+retrieving revision 1.84
+retrieving revision 1.85
+diff -u -r1.84 -r1.85
+--- libtiff/libtiff/tif_dirwrite.c 11 Jan 2017 12:51:59 -0000 1.84
++++ libtiff/libtiff/tif_dirwrite.c 11 Jan 2017 16:09:02 -0000 1.85
+@@ -1,4 +1,4 @@
+-/* $Id: tif_dirwrite.c,v 1.83 2016-10-25 21:35:15 erouault Exp $ */
++/* $Id: tif_dirwrite.c,v 1.85 2017-01-11 16:09:02 erouault Exp $ */
+
+ /*
+ * Copyright (c) 1988-1997 Sam Leffler
+@@ -30,6 +30,7 @@
+ * Directory Write Support Routines.
+ */
+ #include "tiffiop.h"
++#include <float.h>
+
+ #ifdef HAVE_IEEEFP
+ #define TIFFCvtNativeToIEEEFloat(tif, n, fp)
+@@ -939,6 +940,69 @@
+ return(0);
+ }
+
++static float TIFFClampDoubleToFloat( double val )
++{
++ if( val > FLT_MAX )
++ return FLT_MAX;
++ if( val < -FLT_MAX )
++ return -FLT_MAX;
++ return (float)val;
++}
++
++static int8 TIFFClampDoubleToInt8( double val )
++{
++ if( val > 127 )
++ return 127;
++ if( val < -128 || val != val )
++ return -128;
++ return (int8)val;
++}
++
++static int16 TIFFClampDoubleToInt16( double val )
++{
++ if( val > 32767 )
++ return 32767;
++ if( val < -32768 || val != val )
++ return -32768;
++ return (int16)val;
++}
++
++static int32 TIFFClampDoubleToInt32( double val )
++{
++ if( val > 0x7FFFFFFF )
++ return 0x7FFFFFFF;
++ if( val < -0x7FFFFFFF-1 || val != val )
++ return -0x7FFFFFFF-1;
++ return (int32)val;
++}
++
++static uint8 TIFFClampDoubleToUInt8( double val )
++{
++ if( val < 0 )
++ return 0;
++ if( val > 255 || val != val )
++ return 255;
++ return (uint8)val;
++}
++
++static uint16 TIFFClampDoubleToUInt16( double val )
++{
++ if( val < 0 )
++ return 0;
++ if( val > 65535 || val != val )
++ return 65535;
++ return (uint16)val;
++}
++
++static uint32 TIFFClampDoubleToUInt32( double val )
++{
++ if( val < 0 )
++ return 0;
++ if( val > 0xFFFFFFFFU || val != val )
++ return 0xFFFFFFFFU;
++ return (uint32)val;
++}
++
+ static int
+ TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value)
+ {
+@@ -959,7 +1023,7 @@
+ if (tif->tif_dir.td_bitspersample<=32)
+ {
+ for (i = 0; i < count; ++i)
+- ((float*)conv)[i] = (float)value[i];
++ ((float*)conv)[i] = TIFFClampDoubleToFloat(value[i]);
+ ok = TIFFWriteDirectoryTagFloatArray(tif,ndir,dir,tag,count,(float*)conv);
+ }
+ else
+@@ -971,19 +1035,19 @@
+ if (tif->tif_dir.td_bitspersample<=8)
+ {
+ for (i = 0; i < count; ++i)
+- ((int8*)conv)[i] = (int8)value[i];
++ ((int8*)conv)[i] = TIFFClampDoubleToInt8(value[i]);
+ ok = TIFFWriteDirectoryTagSbyteArray(tif,ndir,dir,tag,count,(int8*)conv);
+ }
+ else if (tif->tif_dir.td_bitspersample<=16)
+ {
+ for (i = 0; i < count; ++i)
+- ((int16*)conv)[i] = (int16)value[i];
++ ((int16*)conv)[i] = TIFFClampDoubleToInt16(value[i]);
+ ok = TIFFWriteDirectoryTagSshortArray(tif,ndir,dir,tag,count,(int16*)conv);
+ }
+ else
+ {
+ for (i = 0; i < count; ++i)
+- ((int32*)conv)[i] = (int32)value[i];
++ ((int32*)conv)[i] = TIFFClampDoubleToInt32(value[i]);
+ ok = TIFFWriteDirectoryTagSlongArray(tif,ndir,dir,tag,count,(int32*)conv);
+ }
+ break;
+@@ -991,19 +1055,19 @@
+ if (tif->tif_dir.td_bitspersample<=8)
+ {
+ for (i = 0; i < count; ++i)
+- ((uint8*)conv)[i] = (uint8)value[i];
++ ((uint8*)conv)[i] = TIFFClampDoubleToUInt8(value[i]);
+ ok = TIFFWriteDirectoryTagByteArray(tif,ndir,dir,tag,count,(uint8*)conv);
+ }
+ else if (tif->tif_dir.td_bitspersample<=16)
+ {
+ for (i = 0; i < count; ++i)
+- ((uint16*)conv)[i] = (uint16)value[i];
++ ((uint16*)conv)[i] = TIFFClampDoubleToUInt16(value[i]);
+ ok = TIFFWriteDirectoryTagShortArray(tif,ndir,dir,tag,count,(uint16*)conv);
+ }
+ else
+ {
+ for (i = 0; i < count; ++i)
+- ((uint32*)conv)[i] = (uint32)value[i];
++ ((uint32*)conv)[i] = TIFFClampDoubleToUInt32(value[i]);
+ ok = TIFFWriteDirectoryTagLongArray(tif,ndir,dir,tag,count,(uint32*)conv);
+ }
+ break;
+@@ -2102,7 +2102,7 @@
+ m[0]=0;
+ m[1]=1;
+ }
+- else if (value==(double)(uint32)value)
++ else if (value <= 0xFFFFFFFFU && value==(double)(uint32)value)
+ {
+ m[0]=(uint32)value;
+ m[1]=1;
+@@ -2148,12 +2217,13 @@
+ }
+ for (na=value, nb=m, nc=0; nc<count; na++, nb+=2, nc++)
+ {
+- if (*na<=0.0)
++ if (*na<=0.0 || *na != *na)
+ {
+ nb[0]=0;
+ nb[1]=1;
+ }
+- else if (*na==(float)(uint32)(*na))
++ else if (*na >= 0 && *na <= (float)0xFFFFFFFFU &&
++ *na==(float)(uint32)(*na))
+ {
+ nb[0]=(uint32)(*na);
+ nb[1]=1;
+Index: libtiff/libtiff/tif_dirread.c
+===================================================================
+RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v
+retrieving revision 1.205
+retrieving revision 1.206
+diff -u -r1.205 -r1.206
+--- libtiff/libtiff/tif_dirread.c 3 Dec 2016 11:02:15 -0000 1.205
++++ libtiff/libtiff/tif_dirread.c 11 Jan 2017 13:28:01 -0000 1.206
+@@ -2872,7 +2872,10 @@
+ m.l = direntry->tdir_offset.toff_long8;
+ if (tif->tif_flags&TIFF_SWAB)
+ TIFFSwabArrayOfLong(m.i,2);
+- if (m.i[0]==0)
++ /* Not completely sure what we should do when m.i[1]==0, but some */
++ /* sanitizers do not like division by 0.0: */
++ /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
++ if (m.i[0]==0 || m.i[1]==0)
+ *value=0.0;
+ else
+ *value=(double)m.i[0]/(double)m.i[1];
+@@ -2900,7 +2903,10 @@
+ m.l=direntry->tdir_offset.toff_long8;
+ if (tif->tif_flags&TIFF_SWAB)
+ TIFFSwabArrayOfLong(m.i,2);
+- if ((int32)m.i[0]==0)
++ /* Not completely sure what we should do when m.i[1]==0, but some */
++ /* sanitizers do not like division by 0.0: */
++ /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
++ if ((int32)m.i[0]==0 || m.i[1]==0)
+ *value=0.0;
+ else
+ *value=(double)((int32)m.i[0])/(double)m.i[1];
+Index: libtiff/libtiff/tif_jpeg.c
+===================================================================
+RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_jpeg.c,v
+retrieving revision 1.125
+retrieving revision 1.126
+diff -u -r1.125 -r1.126
+--- libtiff/libtiff/tif_jpeg.c 11 Jan 2017 12:15:01 -0000 1.125
++++ libtiff/libtiff/tif_jpeg.c 11 Jan 2017 16:13:50 -0000 1.126
+@@ -1,4 +1,4 @@
+-/* $Id: tif_jpeg.c,v 1.123 2016-01-23 21:20:34 erouault Exp $ */
++/* $Id: tif_jpeg.c,v 1.126 2017-01-11 16:13:50 erouault Exp $ */
+
+ /*
+ * Copyright (c) 1994-1997 Sam Leffler
+@@ -1632,6 +1632,13 @@
+ "Invalig horizontal/vertical sampling value");
+ return (0);
+ }
++ if( td->td_bitspersample > 16 )
++ {
++ TIFFErrorExt(tif->tif_clientdata, module,
++ "BitsPerSample %d not allowed for JPEG",
++ td->td_bitspersample);
++ return (0);
++ }
+
+ /*
+ * A ReferenceBlackWhite field *must* be present since the
+Index: libtiff/libtiff/tif_read.c
+===================================================================
+RCS file: /cvs/maptools/cvsroot/libtiff/libtiff/tif_read.c,v
+retrieving revision 1.50
+retrieving revision 1.51
+diff -u -r1.50 -r1.51
+--- libtiff/libtiff/tif_read.c 2 Dec 2016 21:56:56 -0000 1.50
++++ libtiff/libtiff/tif_read.c 11 Jan 2017 16:33:34 -0000 1.51
+@@ -420,16 +420,25 @@
+ return ((tmsize_t)(-1));
+ }
+ } else {
+- tmsize_t ma,mb;
++ tmsize_t ma;
+ tmsize_t n;
+- ma=(tmsize_t)td->td_stripoffset[strip];
+- mb=ma+size;
+- if ((td->td_stripoffset[strip] > (uint64)TIFF_TMSIZE_T_MAX)||(ma>tif->tif_size))
+- n=0;
+- else if ((mb<ma)||(mb<size)||(mb>tif->tif_size))
+- n=tif->tif_size-ma;
+- else
+- n=size;
++ if ((td->td_stripoffset[strip] > (uint64)TIFF_TMSIZE_T_MAX)||
++ ((ma=(tmsize_t)td->td_stripoffset[strip])>tif->tif_size))
++ {
++ n=0;
++ }
++ else if( ma > TIFF_TMSIZE_T_MAX - size )
++ {
++ n=0;
++ }
++ else
++ {
++ tmsize_t mb=ma+size;
++ if (mb>tif->tif_size)
++ n=tif->tif_size-ma;
++ else
++ n=size;
++ }
+ if (n!=size) {
+ #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
+ TIFFErrorExt(tif->tif_clientdata, module,
diff --git a/gnu/packages/patches/libtirpc-CVE-2017-8779.patch b/gnu/packages/patches/libtirpc-CVE-2017-8779.patch
new file mode 100644
index 0000000000..742e64df25
--- /dev/null
+++ b/gnu/packages/patches/libtirpc-CVE-2017-8779.patch
@@ -0,0 +1,263 @@
+Fix CVE-2017-8779:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8779
+
+Patch copied from the bug reporter's 3rd-party repository:
+
+https://github.com/guidovranken/rpcbomb/blob/master/libtirpc_patch.txt
+
+diff --git a/src/rpc_generic.c b/src/rpc_generic.c
+index 2f09a8f..589cbd5 100644
+--- a/src/rpc_generic.c
++++ b/src/rpc_generic.c
+@@ -615,6 +615,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
+
+ switch (af) {
+ case AF_INET:
++ if (nbuf->len < sizeof(*sin)) {
++ return NULL;
++ }
+ sin = nbuf->buf;
+ if (inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf)
+ == NULL)
+@@ -626,6 +629,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
+ break;
+ #ifdef INET6
+ case AF_INET6:
++ if (nbuf->len < sizeof(*sin6)) {
++ return NULL;
++ }
+ sin6 = nbuf->buf;
+ if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6)
+ == NULL)
+@@ -667,6 +673,8 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr)
+
+ port = 0;
+ sin = NULL;
++ if (uaddr == NULL)
++ return NULL;
+ addrstr = strdup(uaddr);
+ if (addrstr == NULL)
+ return NULL;
+diff --git a/src/rpcb_prot.c b/src/rpcb_prot.c
+index 43fd385..a923c8e 100644
+--- a/src/rpcb_prot.c
++++ b/src/rpcb_prot.c
+@@ -41,6 +41,7 @@
+ #include <rpc/types.h>
+ #include <rpc/xdr.h>
+ #include <rpc/rpcb_prot.h>
++#include "rpc_com.h"
+
+ bool_t
+ xdr_rpcb(xdrs, objp)
+@@ -53,13 +54,13 @@ xdr_rpcb(xdrs, objp)
+ if (!xdr_u_int32_t(xdrs, &objp->r_vers)) {
+ return (FALSE);
+ }
+- if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->r_netid, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+- if (!xdr_string(xdrs, &objp->r_addr, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->r_addr, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+- if (!xdr_string(xdrs, &objp->r_owner, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->r_owner, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+ return (TRUE);
+@@ -159,19 +160,19 @@ xdr_rpcb_entry(xdrs, objp)
+ XDR *xdrs;
+ rpcb_entry *objp;
+ {
+- if (!xdr_string(xdrs, &objp->r_maddr, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->r_maddr, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+- if (!xdr_string(xdrs, &objp->r_nc_netid, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->r_nc_netid, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+ if (!xdr_u_int32_t(xdrs, &objp->r_nc_semantics)) {
+ return (FALSE);
+ }
+- if (!xdr_string(xdrs, &objp->r_nc_protofmly, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->r_nc_protofmly, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+- if (!xdr_string(xdrs, &objp->r_nc_proto, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->r_nc_proto, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+ return (TRUE);
+@@ -292,7 +293,7 @@ xdr_rpcb_rmtcallres(xdrs, p)
+ bool_t dummy;
+ struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)(void *)p;
+
+- if (!xdr_string(xdrs, &objp->addr, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->addr, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+ if (!xdr_u_int(xdrs, &objp->results.results_len)) {
+@@ -312,6 +313,11 @@ xdr_netbuf(xdrs, objp)
+ if (!xdr_u_int32_t(xdrs, (u_int32_t *) &objp->maxlen)) {
+ return (FALSE);
+ }
++
++ if (objp->maxlen > RPC_MAXDATASIZE) {
++ return (FALSE);
++ }
++
+ dummy = xdr_bytes(xdrs, (char **)&(objp->buf),
+ (u_int *)&(objp->len), objp->maxlen);
+ return (dummy);
+diff --git a/src/rpcb_st_xdr.c b/src/rpcb_st_xdr.c
+index 08db745..28e6a48 100644
+--- a/src/rpcb_st_xdr.c
++++ b/src/rpcb_st_xdr.c
+@@ -37,6 +37,7 @@
+
+
+ #include <rpc/rpc.h>
++#include "rpc_com.h"
+
+ /* Link list of all the stats about getport and getaddr */
+
+@@ -58,7 +59,7 @@ xdr_rpcbs_addrlist(xdrs, objp)
+ if (!xdr_int(xdrs, &objp->failure)) {
+ return (FALSE);
+ }
+- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+
+@@ -109,7 +110,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
+ IXDR_PUT_INT32(buf, objp->failure);
+ IXDR_PUT_INT32(buf, objp->indirect);
+ }
+- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+ if (!xdr_pointer(xdrs, (char **)&objp->next,
+@@ -147,7 +148,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
+ objp->failure = (int)IXDR_GET_INT32(buf);
+ objp->indirect = (int)IXDR_GET_INT32(buf);
+ }
+- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+ if (!xdr_pointer(xdrs, (char **)&objp->next,
+@@ -175,7 +176,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
+ if (!xdr_int(xdrs, &objp->indirect)) {
+ return (FALSE);
+ }
+- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
+ return (FALSE);
+ }
+ if (!xdr_pointer(xdrs, (char **)&objp->next,
+diff --git a/src/xdr.c b/src/xdr.c
+index f3fb9ad..b9a1558 100644
+--- a/src/xdr.c
++++ b/src/xdr.c
+@@ -42,8 +42,10 @@
+ #include <stdlib.h>
+ #include <string.h>
+
++#include <rpc/rpc.h>
+ #include <rpc/types.h>
+ #include <rpc/xdr.h>
++#include <rpc/rpc_com.h>
+
+ typedef quad_t longlong_t; /* ANSI long long type */
+ typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */
+@@ -53,7 +55,6 @@ typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */
+ */
+ #define XDR_FALSE ((long) 0)
+ #define XDR_TRUE ((long) 1)
+-#define LASTUNSIGNED ((u_int) 0-1)
+
+ /*
+ * for unit alignment
+@@ -629,6 +630,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize)
+ {
+ char *sp = *cpp; /* sp is the actual string pointer */
+ u_int nodesize;
++ bool_t ret, allocated = FALSE;
+
+ /*
+ * first deal with the length since xdr bytes are counted
+@@ -652,6 +654,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize)
+ }
+ if (sp == NULL) {
+ *cpp = sp = mem_alloc(nodesize);
++ allocated = TRUE;
+ }
+ if (sp == NULL) {
+ warnx("xdr_bytes: out of memory");
+@@ -660,7 +663,14 @@ xdr_bytes(xdrs, cpp, sizep, maxsize)
+ /* FALLTHROUGH */
+
+ case XDR_ENCODE:
+- return (xdr_opaque(xdrs, sp, nodesize));
++ ret = xdr_opaque(xdrs, sp, nodesize);
++ if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) {
++ if (allocated == TRUE) {
++ free(sp);
++ *cpp = NULL;
++ }
++ }
++ return (ret);
+
+ case XDR_FREE:
+ if (sp != NULL) {
+@@ -754,6 +764,7 @@ xdr_string(xdrs, cpp, maxsize)
+ char *sp = *cpp; /* sp is the actual string pointer */
+ u_int size;
+ u_int nodesize;
++ bool_t ret, allocated = FALSE;
+
+ /*
+ * first deal with the length since xdr strings are counted-strings
+@@ -793,8 +804,10 @@ xdr_string(xdrs, cpp, maxsize)
+ switch (xdrs->x_op) {
+
+ case XDR_DECODE:
+- if (sp == NULL)
++ if (sp == NULL) {
+ *cpp = sp = mem_alloc(nodesize);
++ allocated = TRUE;
++ }
+ if (sp == NULL) {
+ warnx("xdr_string: out of memory");
+ return (FALSE);
+@@ -803,7 +816,14 @@ xdr_string(xdrs, cpp, maxsize)
+ /* FALLTHROUGH */
+
+ case XDR_ENCODE:
+- return (xdr_opaque(xdrs, sp, size));
++ ret = xdr_opaque(xdrs, sp, size);
++ if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) {
++ if (allocated == TRUE) {
++ free(sp);
++ *cpp = NULL;
++ }
++ }
++ return (ret);
+
+ case XDR_FREE:
+ mem_free(sp, nodesize);
+@@ -823,7 +843,7 @@ xdr_wrapstring(xdrs, cpp)
+ XDR *xdrs;
+ char **cpp;
+ {
+- return xdr_string(xdrs, cpp, LASTUNSIGNED);
++ return xdr_string(xdrs, cpp, RPC_MAXDATASIZE);
+ }
+
+ /*
diff --git a/gnu/packages/patches/lierolibre-check-unaligned-access.patch b/gnu/packages/patches/lierolibre-check-unaligned-access.patch
new file mode 100644
index 0000000000..b720c9eb3b
--- /dev/null
+++ b/gnu/packages/patches/lierolibre-check-unaligned-access.patch
@@ -0,0 +1,30 @@
+Patch copied from Debian:
+
+https://anonscm.debian.org/cgit/pkg-games/lierolibre.git/tree/debian/patches/0001-Use-unaligned-access-define-over-checking-arch.patch?id=82910748906855f6e6bfe30b3f077e8c793ae424
+
+From 396f19b6b7743d394307f70f0c0108419824437b Mon Sep 17 00:00:00 2001
+From: Martin Erik Werner <martinerikwerner@gmail.com>
+Date: Sun, 28 Jun 2015 16:31:34 +0200
+Subject: [PATCH 1/3] Use unaligned access define over checking arch
+
+This todo item seems like it done, and just needed implementing...
+---
+ io/encoding.hpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/gvl/io/encoding.hpp b/src/gvl/io/encoding.hpp
+index c491677..89bb612 100644
+--- a/src/gvl/io/encoding.hpp
++++ b/src/gvl/io/encoding.hpp
+@@ -374,7 +374,7 @@ struct octet_stream_writer
+ // inlining of the common case
+ if(std::size_t(end_ - cur_) >= len)
+ {
+-#if GVL_X86 || GVL_X86_64 // TODO: A define that says whether unaligned access is allowed
++#if GVL_UNALIGNED_ACCESS
+ if(len < 64) // TODO: Tweak this limit
+ {
+ while(len > 4)
+--
+2.4.6
+
diff --git a/gnu/packages/patches/lierolibre-is-free-software.patch b/gnu/packages/patches/lierolibre-is-free-software.patch
new file mode 100644
index 0000000000..626a24dd8c
--- /dev/null
+++ b/gnu/packages/patches/lierolibre-is-free-software.patch
@@ -0,0 +1,38 @@
+Remove outdated license text. See COPYING and the description
+at http://liero.be/ for more information.
+
+--- a/data/LIEROENG.TXT
++++ b/data/LIEROENG.TXT
+@@ -11,14 +11,6 @@
+ -----------------------------------------------------------------------------
+
+ GENERAL STUFF
+-
+- Liero is freeware. What that means is that you don't have to pay
+- for it and using it has not been restricted in any way. You may
+- distribute it to anyone and anyhow WITHOUT ANY CHANGES MADE TO IT'S
+- CONTAINMENTS.
+-
+- The source code of this game is not distributed freely (neither
+- commercially). So if you thought that maybe you could... forget it.
+
+ Liero is a wormgame with weapons for 2 players. The object of the
+ game is definately what you think it is. Liero is excellent for
+--- a/data/LIERO.TXT
++++ b/data/LIERO.TXT
+@@ -12,15 +12,6 @@
+
+ YLEISTŽ
+
+- Liero on freeware, mik„ tarkoittaa ett„ sen k„yt”st„ ei tarvitse
+- maksaa mit„„n eik„ k„ytt”„ ole rajoitettu mitenk„„n. Lieroa saa
+- kopioida kelle tahansa ja miten tahansa SISŽLT™Ž MITENKŽŽN
+- MUUTTAMATTA.
+-
+- Todettakoon t„ss„ ett„ Lieron l„hdekoodi ei ole vapaassa (sen
+- enenp„„ kuin kaupallisessakaan) jakelussa. Joten jos ajattelit
+- ett„... niin j„t„ ajatukset sikseen.
+-
+ Liero on kahden pelattava aseellinen matosimulaatiopeli. Pelin
+ p„„m„„r„n„ on ep„ilem„tt„ se mit„ luuletkin. Liero sopii
+ erinomaisen hyvin aggressioiden purkuun ja kaverin rokitt„miseen
diff --git a/gnu/packages/patches/lierolibre-newer-libconfig.patch b/gnu/packages/patches/lierolibre-newer-libconfig.patch
new file mode 100644
index 0000000000..662d0f90fa
--- /dev/null
+++ b/gnu/packages/patches/lierolibre-newer-libconfig.patch
@@ -0,0 +1,190 @@
+Fix compatibility with newer libconfig.
+
+Patch copied from upstream source repository:
+
+https://gitlab.com/lierolibre/lierolibre/commit/b27e3604aa6bfbfcc50db1000b394d06c87ae2f2
+
+diff --git a/src/common.cpp b/src/common.cpp
+index 2d6ada5..4942b05 100644
+--- a/src/common.cpp
++++ b/src/common.cpp
+@@ -162,7 +162,7 @@ void Texts::loadFromCFG(std::string cfgFilePath)
+ const libconfig::Setting &sgmodes = texts["gameModes"];
+ for(int i = 0; i < 4; ++i)
+ {
+- gameModes[i] = (char const*)sgmodes["gameModes" + to_string(i)];
++ gameModes[i] = (char const*)sgmodes[("gameModes" + to_string(i)).c_str()];
+ }
+
+ const libconfig::Setting &sgmspec = texts["gameModeSpec"];
+@@ -181,13 +181,13 @@ void Texts::loadFromCFG(std::string cfgFilePath)
+ const libconfig::Setting &swstates = texts["weapStates"];
+ for(int i = 0; i < 3; ++i)
+ {
+- weapStates[i] = (char const*)swstates["weapStates" + to_string(i)];
++ weapStates[i] = (char const*)swstates[("weapStates" + to_string(i)).c_str()];
+ }
+
+ const libconfig::Setting &sknames = texts["keyNames"];
+ for(int i = 1; i < 177; ++i) // First key starts at 1
+ {
+- keyNames[i] = (char const*)sknames["keyNames" + to_string(i)];
++ keyNames[i] = (char const*)sknames[("keyNames" + to_string(i)).c_str()];
+ }
+
+ selWeap = (char const*)texts["selWeap"];
+@@ -315,8 +315,8 @@ void Common::loadPaletteFromCFG(std::string cfgFilePath)
+ const libconfig::Setting &scanim = palette["colorAnim"];
+ for(int i = 0; i < 4; ++i)
+ {
+- colorAnim[i].from = (int)scanim["colorAnim" + to_string(i) + "from"];
+- colorAnim[i].to = (int)scanim["colorAnim" + to_string(i) + "to"];
++ colorAnim[i].from = (int)scanim[("colorAnim" + to_string(i) + "from").c_str()];
++ colorAnim[i].to = (int)scanim[("colorAnim" + to_string(i) + "to").c_str()];
+ }
+ }
+
+@@ -383,7 +383,7 @@ void Common::loadMaterialsFromCFG(std::string cfgFilePath)
+
+ for(int i = 0; i < 256; ++i)
+ {
+- const libconfig::Setting &smflags = smaterials["flags" + to_string(i)];
++ const libconfig::Setting &smflags = smaterials[("flags" + to_string(i)).c_str()];
+ materials[i].flags = smflags;
+ }
+ }
+diff --git a/src/configCompat.cpp b/src/configCompat.cpp
+index 1aeb262..a72c40f 100644
+--- a/src/configCompat.cpp
++++ b/src/configCompat.cpp
+@@ -160,19 +160,19 @@ void Common::loadConstantsFromCFGVer0(string cfgFilePath)
+ const Setting &vconstants = constants["Values"];
+ for(int i = 0; i < MaxC; ++i)
+ {
+- C[i] = (int)vconstants[valueConstantsNamesCFGVer0[i]];
++ C[i] = (int)vconstants[valueConstantsNamesCFGVer0[i].c_str()];
+ }
+
+ const Setting &sconstants = constants["Strings"];
+ for(int i = 0; i < MaxS; ++i)
+ {
+- S[i]= (char const*)sconstants[stringConstantsNamesCFGVer0[i]];
++ S[i]= (char const*)sconstants[stringConstantsNamesCFGVer0[i].c_str()];
+ }
+
+ const Setting &hconstants = constants["Hacks"];
+ for(int i = 0; i < MaxH; ++i)
+ {
+- H[i] = (bool)hconstants[hackConstantsNamesVer0[i]];
++ H[i] = (bool)hconstants[hackConstantsNamesVer0[i].c_str()];
+ }
+ }
+
+diff --git a/src/configHelper.cpp b/src/configHelper.cpp
+index fcd1f3f..a63bddc 100644
+--- a/src/configHelper.cpp
++++ b/src/configHelper.cpp
+@@ -54,15 +54,11 @@ template Uint8 ConfigHelper::getValue<Uint8, const Setting, int>(const Setting &
+
+ template Uint8 ConfigHelper::getValue<Uint8, const Setting, char const*>(const Setting &node, char const* index);
+
+-template Uint8 ConfigHelper::getValue<Uint8, const Setting, string>(const Setting &node, string index);
+-
+ // Non-const
+ template Uint8 ConfigHelper::getValue<Uint8, Setting, int>(Setting &node, int index);
+
+ template Uint8 ConfigHelper::getValue<Uint8, Setting, char const*>(Setting &node, char const* index);
+
+-template Uint8 ConfigHelper::getValue<Uint8, Setting, string>(Setting &node, string index);
+-
+
+ // Since we still need specialisation per value type (Setting::Type),
+ // no need to templateify these
+@@ -72,7 +68,7 @@ void ConfigHelper::put(Setting &node, string variable, string value)
+ {
+ node.add(variable, Setting::TypeString) = value;
+ } else {
+- Setting &var = node[variable];
++ Setting &var = node[variable.c_str()];
+ var = value;
+ }
+ }
+@@ -83,7 +79,7 @@ void ConfigHelper::put(Setting &node, string variable, int value)
+ {
+ node.add(variable, Setting::TypeInt) = value;
+ } else {
+- Setting &var = node[variable];
++ Setting &var = node[variable.c_str()];
+ var = value;
+ }
+ }
+@@ -94,7 +90,7 @@ void ConfigHelper::put(Setting &node, string variable, Uint8 value)
+ {
+ node.add(variable, Setting::TypeInt) = value;
+ } else {
+- Setting &var = node[variable];
++ Setting &var = node[variable.c_str()];
+ var = value;
+ }
+ }
+@@ -105,7 +101,7 @@ void ConfigHelper::put(Setting &node, string variable, bool value)
+ {
+ node.add(variable, Setting::TypeBoolean) = value;
+ } else {
+- Setting &var = node[variable];
++ Setting &var = node[variable.c_str()];
+ var = value;
+ }
+ }
+@@ -135,6 +131,6 @@ Setting& ConfigHelper::getSubgroup(Setting &node, string groupName)
+ {
+ node.add(groupName, Setting::TypeGroup);
+ }
+- return node[groupName];
++ return node[groupName.c_str()];
+ }
+
+diff --git a/src/constants.cpp b/src/constants.cpp
+index 7fced6a..cf7bbfc 100644
+--- a/src/constants.cpp
++++ b/src/constants.cpp
+@@ -523,19 +523,19 @@ void Common::loadConstantsFromCFG(std::string cfgFilePath)
+ const libconfig::Setting &vconstants = constants["Values"];
+ for(int i = 0; i < MaxC; ++i)
+ {
+- C[i] = (int)vconstants[valueConstantsNames[i]];
++ C[i] = (int)vconstants[valueConstantsNames[i].c_str()];
+ }
+
+ const libconfig::Setting &sconstants = constants["Strings"];
+ for(int i = 0; i < MaxS; ++i)
+ {
+- S[i]= (char const*)sconstants[stringConstantsNames[i]];
++ S[i]= (char const*)sconstants[stringConstantsNames[i].c_str()];
+ }
+
+ const libconfig::Setting &hconstants = constants["Hacks"];
+ for(int i = 0; i < MaxH; ++i)
+ {
+- H[i] = (bool)hconstants[hackConstantsNames[i]];
++ H[i] = (bool)hconstants[hackConstantsNames[i].c_str()];
+ }
+ }
+
+diff --git a/src/gfx/palette.cpp b/src/gfx/palette.cpp
+index 3fd08c4..3d3bf22 100644
+--- a/src/gfx/palette.cpp
++++ b/src/gfx/palette.cpp
+@@ -124,9 +124,9 @@ void Palette::readFromCFG(std::string cfgFilePath)
+
+ for(int i = 0; i < 256; ++i)
+ {
+- entries[i].r = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "r");
+- entries[i].g = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "g");
+- entries[i].b = cfgHelp.getValue<Uint8>(spentries, "entries" + to_string(i) + "b");
++ entries[i].r = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "r").c_str());
++ entries[i].g = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "g").c_str());
++ entries[i].b = cfgHelp.getValue<Uint8>(spentries, ("entries" + to_string(i) + "b").c_str());
+ }
+ }
+
diff --git a/gnu/packages/patches/lierolibre-remove-arch-warning.patch b/gnu/packages/patches/lierolibre-remove-arch-warning.patch
new file mode 100644
index 0000000000..ca92b72546
--- /dev/null
+++ b/gnu/packages/patches/lierolibre-remove-arch-warning.patch
@@ -0,0 +1,30 @@
+Copied from Debian:
+
+https://anonscm.debian.org/cgit/pkg-games/lierolibre.git/tree/debian/patches/0003-Remove-unknown-arch-warning.patch?id=82910748906855f6e6bfe30b3f077e8c793ae424
+
+From a9592533eeabed075b13d11c64f63f503dc13343 Mon Sep 17 00:00:00 2001
+From: Martin Erik Werner <martinerikwerner@gmail.com>
+Date: Sun, 28 Jun 2015 19:31:30 +0200
+Subject: [PATCH 3/3] Remove unknown arch warning
+
+The warning was just excessivley spammy, remove it.
+---
+ support/platform.h | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/gvl/support/platform.h b/src/gvl/support/platform.h
+index 1857b7c..ff6a7d2 100644
+--- a/src/gvl/support/platform.h
++++ b/src/gvl/support/platform.h
+@@ -87,8 +87,6 @@
+ # define GVL_X86_64 1
+ # elif defined(__i386__) || defined(_M_IX86) || defined(i386) || defined(i486) || defined(intel) || defined(x86) || defined(i86pc)
+ # define GVL_X86 1
+-# else
+-# warning "Unknown architecture, please add it"
+ # endif
+ #endif
+
+--
+2.4.6
+
diff --git a/gnu/packages/patches/lierolibre-try-building-other-arch.patch b/gnu/packages/patches/lierolibre-try-building-other-arch.patch
new file mode 100644
index 0000000000..a40dfe6110
--- /dev/null
+++ b/gnu/packages/patches/lierolibre-try-building-other-arch.patch
@@ -0,0 +1,56 @@
+Copied from Debian:
+
+https://anonscm.debian.org/cgit/pkg-games/lierolibre.git/tree/debian/patches/0001-Use-unaligned-access-define-over-checking-arch.patch?id=82910748906855f6e6bfe30b3f077e8c793ae424
+
+From a70691fb003cae1a33f06d682269285f9baa2dd9 Mon Sep 17 00:00:00 2001
+From: Martin Erik Werner <martinerikwerner@gmail.com>
+Date: Sun, 28 Jun 2015 19:00:23 +0200
+Subject: [PATCH 2/3] At least try building for other archs than x86*
+
+Allow attempting to build for other architectures than x86 and x86_64,
+whether or not the build will succeed or produce sane output is another
+question... It emits plenty of warnings about it now though...
+
+Configuration of the FPU controller is disabled on all but x86*, and the
+uninformed hope and prayer is that defaults will be fine without messing
+with them.
+---
+ math/ieee.cpp | 2 ++
+ support/platform.h | 4 ++--
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/gvl/math/ieee.cpp b/src/gvl/math/ieee.cpp
+index 8b740d4..e0803d2 100644
+--- a/src/gvl/math/ieee.cpp
++++ b/src/gvl/math/ieee.cpp
+@@ -54,6 +54,8 @@ void gvl_init_ieee()
+ {
+ #if GVL_MSVCPP
+ // Nothing needs to be done, TODO: we should however check that the x87 state is right
++#elif !GVL_X86 && !GVL_X86_64
++// No idea what to do, but run with defaults and pray it doesn't mess things up
+ #elif GVL_GCC && GVL_WIN32
+ unsigned int const flags = _RC_NEAR | _PC_53 | _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW | _EM_UNDERFLOW | _EM_INEXACT;
+ _control87(flags, _MCW_EM | _MCW_PC | _MCW_RC);
+diff --git a/src/gvl/support/platform.h b/src/gvl/support/platform.h
+index 86dcaa6..1857b7c 100644
+--- a/src/gvl/support/platform.h
++++ b/src/gvl/support/platform.h
+@@ -88,12 +88,12 @@
+ # elif defined(__i386__) || defined(_M_IX86) || defined(i386) || defined(i486) || defined(intel) || defined(x86) || defined(i86pc)
+ # define GVL_X86 1
+ # else
+-# error "Unknown architecture, please add it"
++# warning "Unknown architecture, please add it"
+ # endif
+ #endif
+
+ #if !GVL_LITTLE_ENDIAN && !GVL_BIG_ENDIAN
+-# if GVL_X86 || GVL_X86_64
++# if GVL_X86 || GVL_X86_64 || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN
+ # define GVL_LITTLE_ENDIAN 1
+ # else
+ # define GVL_BIG_ENDIAN 1
+--
+2.4.6
+
diff --git a/gnu/packages/patches/llvm-3.5-fix-clang-build-with-gcc5.patch b/gnu/packages/patches/llvm-3.5-fix-clang-build-with-gcc5.patch
new file mode 100644
index 0000000000..faa8252c43
--- /dev/null
+++ b/gnu/packages/patches/llvm-3.5-fix-clang-build-with-gcc5.patch
@@ -0,0 +1,35 @@
+This patch was downloaded from https://sft.its.cern.ch/jira/browse/ROOT-7047.
+It fixes the build of clang 3.5 with GCC 5. File paths have been adjusted.
+
+From 00f3ed6eee41da871799ad0fd19153c7682d61fe Mon Sep 17 00:00:00 2001
+From: Alexander Klimov <alserkli@inbox.ru>
+Date: Mon, 26 Jan 2015 18:45:23 +0200
+Subject: [PATCH] [ADT/IntrusiveRefCntPtr] Give friend access to
+ IntrusiveRefCntPtr<X> so the relevant move constructor can
+ access 'Obj'.
+
+From LLVM upstream:
+Author: Argyrios Kyrtzidis <akyrtzi@gmail.com>
+Date: Tue Sep 23 06:06:43 2014 +0000
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218295 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ interpreter/llvm/src/include/llvm/ADT/IntrusiveRefCntPtr.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/include/llvm/ADT/IntrusiveRefCntPtr.h b/include/llvm/ADT/IntrusiveRefCntPtr.h
+index f9df378..c859c98 100644
+--- a/include/llvm/ADT/IntrusiveRefCntPtr.h
++++ b/include/llvm/ADT/IntrusiveRefCntPtr.h
+@@ -197,6 +197,9 @@ public:
+ private:
+ void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); }
+ void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); }
++
++ template <typename X>
++ friend class IntrusiveRefCntPtr;
+ };
+
+ template<class T, class U>
+--
+1.7.10.4
+
diff --git a/gnu/packages/patches/lvm2-static-link.patch b/gnu/packages/patches/lvm2-static-link.patch
index b4b1dd92e1..6adf6891bb 100644
--- a/gnu/packages/patches/lvm2-static-link.patch
+++ b/gnu/packages/patches/lvm2-static-link.patch
@@ -1,5 +1,5 @@
Fix static linking of 'lvm.static', which indirectly depend on libpthread
-via libdevmapper.a.
+and libm via libdevmapper.a.
--- LVM2.2.02.166/tools/Makefile.in 2016-11-22 21:31:15.521045149 +0100
+++ LVM2.2.02.166/tools/Makefile.in 2016-11-22 21:31:24.085082767 +0100
@@ -8,7 +8,7 @@ via libdevmapper.a.
lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a $(interfacebuilddir)/libdevmapper.a
$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
- $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
-+ $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS) $(PTHREAD_LIBS)
++ $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS) $(PTHREAD_LIBS) $(M_LIBS)
liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
cat $(top_builddir)/lib/liblvm-internal.a > $@
diff --git a/gnu/packages/patches/lxterminal-CVE-2016-10369.patch b/gnu/packages/patches/lxterminal-CVE-2016-10369.patch
new file mode 100644
index 0000000000..809eef08da
--- /dev/null
+++ b/gnu/packages/patches/lxterminal-CVE-2016-10369.patch
@@ -0,0 +1,37 @@
+Fix CVE-2016-10369:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10369
+
+Patch copied from upstream source repository:
+
+https://git.lxde.org/gitweb/?p=lxde/lxterminal.git;a=commit;h=f99163c6ff8b2f57c5f37b1ce5d62cf7450d4648
+
+From f99163c6ff8b2f57c5f37b1ce5d62cf7450d4648 Mon Sep 17 00:00:00 2001
+From: Yao Wei <mwei@lxde.org>
+Date: Mon, 8 May 2017 00:47:55 +0800
+Subject: [PATCH] fix: use g_get_user_runtime_dir for socket directory
+
+This bug is pointed out by stackexchange user that putting socket file in
+/tmp is a potential risk. Putting the socket dir in user directory could
+mitigate the risk.
+---
+ src/unixsocket.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/unixsocket.c b/src/unixsocket.c
+index 4c660ac..f88284c 100644
+--- a/src/unixsocket.c
++++ b/src/unixsocket.c
+@@ -140,7 +140,8 @@ gboolean lxterminal_socket_initialize(LXTermWindow * lxtermwin, gint argc, gchar
+ * This function returns TRUE if this process should keep running and FALSE if it should exit. */
+
+ /* Formulate the path for the Unix domain socket. */
+- gchar * socket_path = g_strdup_printf("/tmp/.lxterminal-socket%s-%s", gdk_display_get_name(gdk_display_get_default()), g_get_user_name());
++ gchar * socket_path = g_strdup_printf("%s/.lxterminal-socket-%s", g_get_user_runtime_dir(), gdk_display_get_name(gdk_display_get_default()));
++ printf("%s\n", socket_path);
+
+ /* Create socket. */
+ int fd = socket(PF_UNIX, SOCK_STREAM, 0);
+--
+2.1.4
+
diff --git a/gnu/packages/patches/miniupnpc-CVE-2017-8798.patch b/gnu/packages/patches/miniupnpc-CVE-2017-8798.patch
new file mode 100644
index 0000000000..24eed60af9
--- /dev/null
+++ b/gnu/packages/patches/miniupnpc-CVE-2017-8798.patch
@@ -0,0 +1,55 @@
+Fix CVE-2017-8798.
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8798
+http://seclists.org/oss-sec/2017/q2/247
+
+Patch copied from upstream source repository, with Changelog entry removed:
+
+https://github.com/miniupnp/miniupnp/commit/f0f1f4b22d6a98536377a1bb07e7c20e4703d229
+
+diff --git a/miniwget.c b/miniwget.c
+index 37cb47b..1eda57c 100644
+--- a/miniwget.c
++++ b/miniwget.c
+@@ -284,11 +284,12 @@ getHTTPResponse(int s, int * size, int * status_code)
+ goto end_of_stream;
+ }
+ }
+- bytestocopy = ((int)chunksize < (n - i))?chunksize:(unsigned int)(n - i);
++ /* it is guaranteed that (n >= i) */
++ bytestocopy = (chunksize < (unsigned int)(n - i))?chunksize:(unsigned int)(n - i);
+ if((content_buf_used + bytestocopy) > content_buf_len)
+ {
+ char * tmp;
+- if(content_length >= (int)(content_buf_used + bytestocopy)) {
++ if((content_length >= 0) && ((unsigned int)content_length >= (content_buf_used + bytestocopy))) {
+ content_buf_len = content_length;
+ } else {
+ content_buf_len = content_buf_used + bytestocopy;
+@@ -313,14 +314,15 @@ getHTTPResponse(int s, int * size, int * status_code)
+ {
+ /* not chunked */
+ if(content_length > 0
+- && (int)(content_buf_used + n) > content_length) {
++ && (content_buf_used + n) > (unsigned int)content_length) {
+ /* skipping additional bytes */
+ n = content_length - content_buf_used;
+ }
+ if(content_buf_used + n > content_buf_len)
+ {
+ char * tmp;
+- if(content_length >= (int)(content_buf_used + n)) {
++ if(content_length >= 0
++ && (unsigned int)content_length >= (content_buf_used + n)) {
+ content_buf_len = content_length;
+ } else {
+ content_buf_len = content_buf_used + n;
+@@ -340,7 +342,7 @@ getHTTPResponse(int s, int * size, int * status_code)
+ }
+ }
+ /* use the Content-Length header value if available */
+- if(content_length > 0 && (int)content_buf_used >= content_length)
++ if(content_length > 0 && content_buf_used >= (unsigned int)content_length)
+ {
+ #ifdef DEBUG
+ printf("End of HTTP content\n");
diff --git a/gnu/packages/patches/mozjs38-pkg-config-version.patch b/gnu/packages/patches/mozjs38-pkg-config-version.patch
new file mode 100644
index 0000000000..49ff6f6f8d
--- /dev/null
+++ b/gnu/packages/patches/mozjs38-pkg-config-version.patch
@@ -0,0 +1,24 @@
+Taken from https://bug1339931.bmoattachments.org/attachment.cgi?id=8837770.
+
+Add major version to pkg-config filename.
+Author: Rico Tzschichholz <ricotz@ubuntu.com>
+Forwarded: no
+Last-Update: 2015-05-04
+
+Index: b/js/src/Makefile.in
+===================================================================
+--- a/js/src/Makefile.in
++++ b/js/src/Makefile.in
+@@ -214,10 +214,10 @@
+ $(JS_CONFIG_NAME): js-config
+ cp $^ $@
+
+-$(LIBRARY_NAME).pc: js.pc
++$(JS_LIBRARY_NAME).pc: js.pc
+ cp $^ $@
+
+-install:: $(LIBRARY_NAME).pc
++install:: $(JS_LIBRARY_NAME).pc
+ $(SYSINSTALL) $^ $(DESTDIR)$(libdir)/pkgconfig
+
+ install:: js-config.h
diff --git a/gnu/packages/patches/mozjs38-shell-version.patch b/gnu/packages/patches/mozjs38-shell-version.patch
new file mode 100644
index 0000000000..e7d3d19c85
--- /dev/null
+++ b/gnu/packages/patches/mozjs38-shell-version.patch
@@ -0,0 +1,67 @@
+Taken from https://bug1339931.bmoattachments.org/attachment.cgi?id=8837771.
+
+# HG changeset patch
+# Parent 4732a0e5d22bc7e5c1f1ace7a182d537d9cc2c6a
+Add major version to shell and js-config filenames.
+Author: Rico Tzschichholz <ricotz@ubuntu.com>
+Forwarded: no
+Last-Update: 2014-10-29
+
+---
+diff --git a/js/src/configure b/js/src/configure
+--- a/js/src/configure
++++ b/js/src/configure
+@@ -1696,8 +1696,13 @@
+ MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
+ IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
+
++if test -n "$JS_STANDALONE"; then
++JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
++JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
++else
+ JS_SHELL_NAME=js
+ JS_CONFIG_NAME=js-config
++fi
+
+
+ if test -n "$IS_ALPHA"; then
+
+diff --git a/js/src/configure.in b/js/src/configure.in
+--- a/js/src/configure.in
++++ b/js/src/configure.in
+@@ -234,16 +234,13 @@ MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSI
+ MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
+ IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
+
+-dnl XXX in a temporary bid to avoid developer anger at renaming files
+-dnl XXX before "js" symlinks exist, don't change names.
+-dnl
+-dnl if test -n "$JS_STANDALONE"; then
+-dnl JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
+-dnl JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
+-dnl else
++if test -n "$JS_STANDALONE"; then
++JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
++JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
++else
+ JS_SHELL_NAME=js
+ JS_CONFIG_NAME=js-config
+-dnl fi
++fi
+
+ changequote([,])
+ if test -n "$IS_ALPHA"; then
+
+diff -r 80a9e64d75f5 js/src/Makefile.in
+--- a/js/src/Makefile.in Wed Jun 25 15:11:42 2014 +0200
++++ b/js/src/Makefile.in Sat Jul 05 14:08:38 2014 +0200
+@@ -273,6 +273,9 @@
+ SCRIPTS = $(JS_CONFIG_NAME)
+ SDK_BINARY = $(JS_CONFIG_NAME)
+
++$(JS_CONFIG_NAME): js-config
++ cp $^ $@
++
+ $(JS_LIBRARY_NAME).pc: js.pc
+ cp $^ $@
+
diff --git a/gnu/packages/patches/mozjs38-tracelogger.patch b/gnu/packages/patches/mozjs38-tracelogger.patch
new file mode 100644
index 0000000000..0375ec36cc
--- /dev/null
+++ b/gnu/packages/patches/mozjs38-tracelogger.patch
@@ -0,0 +1,608 @@
+Squashed version of several commits to fix the tracelogger.
+
+Taken from
+https://github.com/GNOME/jhbuild/blob/master/patches/mozjs38-fix-tracelogger.patch.
+
+# === Fix the SM38 tracelogger ===
+# This patch is a squashed version of several patches that were adapted
+# to fix failing hunks.
+#
+# Applied in the following order, they are:
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1223767
+# Assertion failure: i < size_, at js/src/vm/TraceLoggingTypes.h:210
+# Also fix stop-information to make reduce.py work correctly.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1227914
+# Limit the memory tracelogger can take.
+# This causes tracelogger to flush data to the disk regularly and prevents out of
+# memory issues if a lot of data gets logged.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1155618
+# Fix tracelogger destructor that touches possibly uninitialised hash table.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1223636
+# Don't treat extraTextId as containing only extra ids.
+# This fixes an assertion failure: id == nextTextId at js/src/vm/TraceLoggingGraph.cpp
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1227028
+# Fix when to keep the payload of a TraceLogger event.
+# This fixes an assertion failure: textId < uint32_t(1 << 31) at js/src/vm/TraceLoggingGraph.h
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1266649
+# Handle failing to add to pointermap gracefully.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1280648
+# Don't cache based on pointers to movable GC things.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1224123
+# Fix the use of LastEntryId in tracelogger.h.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1231170
+# Use size in debugger instead of the current id to track last logged item.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1221844
+# Move TraceLogger_Invalidation to LOG_ITEM.
+# Add some debug checks to logTimestamp.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1255766
+# Also mark resizing of memory.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1259403
+# Only increase capacity by multiples of 2.
+# Always make sure there are 3 free slots for events.
+# ===
+
+diff --git a/js/src/jit-test/tests/tracelogger/bug1231170.js b/js/src/jit-test/tests/tracelogger/bug1231170.js
+new file mode 100644
+index 0000000..023e93e
+--- /dev/null
++++ b/js/src/jit-test/tests/tracelogger/bug1231170.js
+@@ -0,0 +1,3 @@
++var du = new Debugger();
++if (typeof du.drainTraceLogger === "function")
++ du.drainTraceLogger();
+diff --git a/js/src/jit-test/tests/tracelogger/bug1266649.js b/js/src/jit-test/tests/tracelogger/bug1266649.js
+new file mode 100644
+index 0000000..81ae7ad
+--- /dev/null
++++ b/js/src/jit-test/tests/tracelogger/bug1266649.js
+@@ -0,0 +1,10 @@
++
++var du = new Debugger();
++if (typeof du.setupTraceLogger === "function" &&
++ typeof oomTest === 'function')
++{
++ du.setupTraceLogger({
++ Scripts: true
++ })
++ oomTest(() => function(){});
++}
+diff --git a/js/src/jit/Ion.cpp b/js/src/jit/Ion.cpp
+index 93e2fda..09049d6 100644
+--- a/js/src/jit/Ion.cpp
++++ b/js/src/jit/Ion.cpp
+@@ -1055,6 +1055,8 @@ IonScript::Destroy(FreeOp* fop, IonScript* script)
+
+ script->destroyCaches();
+ script->unlinkFromRuntime(fop);
++ // Frees the potential event we have set.
++ script->traceLoggerScriptEvent_ = TraceLoggerEvent();
+ fop->free_(script);
+ }
+
+diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp
+index 26262fd..af7f313 100644
+--- a/js/src/vm/Debugger.cpp
++++ b/js/src/vm/Debugger.cpp
+@@ -369,10 +369,10 @@ Debugger::Debugger(JSContext* cx, NativeObject* dbg)
+ objects(cx),
+ environments(cx),
+ #ifdef NIGHTLY_BUILD
+- traceLoggerLastDrainedId(0),
++ traceLoggerLastDrainedSize(0),
+ traceLoggerLastDrainedIteration(0),
+ #endif
+- traceLoggerScriptedCallsLastDrainedId(0),
++ traceLoggerScriptedCallsLastDrainedSize(0),
+ traceLoggerScriptedCallsLastDrainedIteration(0)
+ {
+ assertSameCompartment(cx, dbg);
+@@ -3907,9 +3907,9 @@ Debugger::drainTraceLogger(JSContext* cx, unsigned argc, Value* vp)
+ size_t num;
+ TraceLoggerThread* logger = TraceLoggerForMainThread(cx->runtime());
+ bool lostEvents = logger->lostEvents(dbg->traceLoggerLastDrainedIteration,
+- dbg->traceLoggerLastDrainedId);
++ dbg->traceLoggerLastDrainedSize);
+ EventEntry* events = logger->getEventsStartingAt(&dbg->traceLoggerLastDrainedIteration,
+- &dbg->traceLoggerLastDrainedId,
++ &dbg->traceLoggerLastDrainedSize,
+ &num);
+
+ RootedObject array(cx, NewDenseEmptyArray(cx));
+@@ -4002,10 +4002,10 @@ Debugger::drainTraceLoggerScriptCalls(JSContext* cx, unsigned argc, Value* vp)
+ size_t num;
+ TraceLoggerThread* logger = TraceLoggerForMainThread(cx->runtime());
+ bool lostEvents = logger->lostEvents(dbg->traceLoggerScriptedCallsLastDrainedIteration,
+- dbg->traceLoggerScriptedCallsLastDrainedId);
++ dbg->traceLoggerScriptedCallsLastDrainedSize);
+ EventEntry* events = logger->getEventsStartingAt(
+ &dbg->traceLoggerScriptedCallsLastDrainedIteration,
+- &dbg->traceLoggerScriptedCallsLastDrainedId,
++ &dbg->traceLoggerScriptedCallsLastDrainedSize,
+ &num);
+
+ RootedObject array(cx, NewDenseEmptyArray(cx));
+diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h
+index 8cac36a..c92d685 100644
+--- a/js/src/vm/Debugger.h
++++ b/js/src/vm/Debugger.h
+@@ -314,10 +314,10 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
+ * lost events.
+ */
+ #ifdef NIGHTLY_BUILD
+- uint32_t traceLoggerLastDrainedId;
++ uint32_t traceLoggerLastDrainedSize;
+ uint32_t traceLoggerLastDrainedIteration;
+ #endif
+- uint32_t traceLoggerScriptedCallsLastDrainedId;
++ uint32_t traceLoggerScriptedCallsLastDrainedSize;
+ uint32_t traceLoggerScriptedCallsLastDrainedIteration;
+
+ class FrameRange;
+diff --git a/js/src/vm/TraceLogging.cpp b/js/src/vm/TraceLogging.cpp
+index 6715b36..9766a6f 100644
+--- a/js/src/vm/TraceLogging.cpp
++++ b/js/src/vm/TraceLogging.cpp
+@@ -131,7 +131,7 @@ TraceLoggerThread::init()
+ {
+ if (!pointerMap.init())
+ return false;
+- if (!extraTextId.init())
++ if (!textIdPayloads.init())
+ return false;
+ if (!events.init())
+ return false;
+@@ -185,10 +185,10 @@ TraceLoggerThread::~TraceLoggerThread()
+ graph = nullptr;
+ }
+
+- for (TextIdHashMap::Range r = extraTextId.all(); !r.empty(); r.popFront())
+- js_delete(r.front().value());
+- extraTextId.finish();
+- pointerMap.finish();
++ if (textIdPayloads.initialized()) {
++ for (TextIdHashMap::Range r = textIdPayloads.all(); !r.empty(); r.popFront())
++ js_delete(r.front().value());
++ }
+ }
+
+ bool
+@@ -287,7 +287,7 @@ TraceLoggerThread::eventText(uint32_t id)
+ if (id < TraceLogger_Last)
+ return TLTextIdString(static_cast<TraceLoggerTextId>(id));
+
+- TextIdHashMap::Ptr p = extraTextId.lookup(id);
++ TextIdHashMap::Ptr p = textIdPayloads.lookup(id);
+ MOZ_ASSERT(p);
+
+ return p->value()->string();
+@@ -341,13 +341,15 @@ TraceLoggerThread::extractScriptDetails(uint32_t textId, const char** filename,
+ TraceLoggerEventPayload*
+ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId textId)
+ {
+- TextIdHashMap::AddPtr p = extraTextId.lookupForAdd(textId);
+- if (p)
++ TextIdHashMap::AddPtr p = textIdPayloads.lookupForAdd(textId);
++ if (p) {
++ MOZ_ASSERT(p->value()->textId() == textId); // Sanity check.
+ return p->value();
++ }
+
+ TraceLoggerEventPayload* payload = js_new<TraceLoggerEventPayload>(textId, (char*)nullptr);
+
+- if (!extraTextId.add(p, textId, payload))
++ if (!textIdPayloads.add(p, textId, payload))
+ return nullptr;
+
+ return payload;
+@@ -357,8 +359,10 @@ TraceLoggerEventPayload*
+ TraceLoggerThread::getOrCreateEventPayload(const char* text)
+ {
+ PointerHashMap::AddPtr p = pointerMap.lookupForAdd((const void*)text);
+- if (p)
++ if (p) {
++ MOZ_ASSERT(p->value()->textId() < nextTextId); // Sanity check.
+ return p->value();
++ }
+
+ size_t len = strlen(text);
+ char* str = js_pod_malloc<char>(len + 1);
+@@ -369,7 +373,7 @@ TraceLoggerThread::getOrCreateEventPayload(const char* text)
+ MOZ_ASSERT(ret == len);
+ MOZ_ASSERT(strlen(str) == len);
+
+- uint32_t textId = extraTextId.count() + TraceLogger_Last;
++ uint32_t textId = nextTextId;
+
+ TraceLoggerEventPayload* payload = js_new<TraceLoggerEventPayload>(textId, str);
+ if (!payload) {
+@@ -377,17 +381,19 @@ TraceLoggerThread::getOrCreateEventPayload(const char* text)
+ return nullptr;
+ }
+
+- if (!extraTextId.putNew(textId, payload)) {
++ if (!textIdPayloads.putNew(textId, payload)) {
+ js_delete(payload);
+ return nullptr;
+ }
+
+- if (!pointerMap.add(p, text, payload))
+- return nullptr;
+-
+ if (graph.get())
+ graph->addTextId(textId, str);
+
++ nextTextId++;
++
++ if (!pointerMap.add(p, text, payload))
++ return nullptr;
++
+ return payload;
+ }
+
+@@ -407,9 +413,14 @@ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, const char* f
+ if (!traceLoggerState->isTextIdEnabled(type))
+ return getOrCreateEventPayload(type);
+
+- PointerHashMap::AddPtr p = pointerMap.lookupForAdd(ptr);
+- if (p)
+- return p->value();
++ PointerHashMap::AddPtr p;
++ if (ptr) {
++ p = pointerMap.lookupForAdd(ptr);
++ if (p) {
++ MOZ_ASSERT(p->value()->textId() < nextTextId); // Sanity check.
++ return p->value();
++ }
++ }
+
+ // Compute the length of the string to create.
+ size_t lenFilename = strlen(filename);
+@@ -428,24 +439,28 @@ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, const char* f
+ MOZ_ASSERT(ret == len);
+ MOZ_ASSERT(strlen(str) == len);
+
+- uint32_t textId = extraTextId.count() + TraceLogger_Last;
++ uint32_t textId = nextTextId;
+ TraceLoggerEventPayload* payload = js_new<TraceLoggerEventPayload>(textId, str);
+ if (!payload) {
+ js_free(str);
+ return nullptr;
+ }
+
+- if (!extraTextId.putNew(textId, payload)) {
++ if (!textIdPayloads.putNew(textId, payload)) {
+ js_delete(payload);
+ return nullptr;
+ }
+
+- if (!pointerMap.add(p, ptr, payload))
+- return nullptr;
+-
+ if (graph.get())
+ graph->addTextId(textId, str);
+
++ nextTextId++;
++
++ if (ptr) {
++ if (!pointerMap.add(p, ptr, payload))
++ return nullptr;
++ }
++
+ return payload;
+ }
+
+@@ -453,14 +468,14 @@ TraceLoggerEventPayload*
+ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, JSScript* script)
+ {
+ return getOrCreateEventPayload(type, script->filename(), script->lineno(), script->column(),
+- script);
++ nullptr);
+ }
+
+ TraceLoggerEventPayload*
+ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type,
+ const JS::ReadOnlyCompileOptions& script)
+ {
+- return getOrCreateEventPayload(type, script.filename(), script.lineno, script.column, &script);
++ return getOrCreateEventPayload(type, script.filename(), script.lineno, script.column, nullptr);
+ }
+
+ void
+@@ -485,7 +500,7 @@ TraceLoggerThread::startEvent(uint32_t id)
+ if (!traceLoggerState->isTextIdEnabled(id))
+ return;
+
+- logTimestamp(id);
++ log(id);
+ }
+
+ void
+@@ -510,7 +525,7 @@ TraceLoggerThread::stopEvent(uint32_t id)
+ if (!traceLoggerState->isTextIdEnabled(id))
+ return;
+
+- logTimestamp(TraceLogger_Stop);
++ log(TraceLogger_Stop);
+ }
+
+ void
+@@ -522,23 +537,57 @@ TraceLoggerThread::logTimestamp(TraceLoggerTextId id)
+ void
+ TraceLoggerThread::logTimestamp(uint32_t id)
+ {
++ MOZ_ASSERT(id > TraceLogger_LastTreeItem && id < TraceLogger_Last);
++ log(id);
++}
++
++void
++TraceLoggerThread::log(uint32_t id)
++{
+ if (enabled == 0)
+ return;
+
+ MOZ_ASSERT(traceLoggerState);
+- if (!events.ensureSpaceBeforeAdd()) {
++
++ // We request for 3 items to add, since if we don't have enough room
++ // we record the time it took to make more place. To log this information
++ // we need 2 extra free entries.
++ if (!events.hasSpaceForAdd(3)) {
+ uint64_t start = rdtsc() - traceLoggerState->startupTime;
+
+- if (graph.get())
+- graph->log(events);
++ if (!events.ensureSpaceBeforeAdd(3)) {
++ if (graph.get())
++ graph->log(events);
++
++ iteration_++;
++ events.clear();
++
++ // Remove the item in the pointerMap for which the payloads
++ // have no uses anymore
++ for (PointerHashMap::Enum e(pointerMap); !e.empty(); e.popFront()) {
++ if (e.front().value()->uses() != 0)
++ continue;
++
++ TextIdHashMap::Ptr p = textIdPayloads.lookup(e.front().value()->textId());
++ MOZ_ASSERT(p);
++ textIdPayloads.remove(p);
++
++ e.removeFront();
++ }
+
+- iteration_++;
+- events.clear();
++ // Free all payloads that have no uses anymore.
++ for (TextIdHashMap::Enum e(textIdPayloads); !e.empty(); e.popFront()) {
++ if (e.front().value()->uses() == 0) {
++ js_delete(e.front().value());
++ e.removeFront();
++ }
++ }
++ }
+
+ // Log the time it took to flush the events as being from the
+ // Tracelogger.
+ if (graph.get()) {
+- MOZ_ASSERT(events.capacity() > 2);
++ MOZ_ASSERT(events.hasSpaceForAdd(2));
+ EventEntry& entryStart = events.pushUninitialized();
+ entryStart.time = start;
+ entryStart.textId = TraceLogger_Internal;
+@@ -548,13 +597,6 @@ TraceLoggerThread::logTimestamp(uint32_t id)
+ entryStop.textId = TraceLogger_Stop;
+ }
+
+- // Free all TextEvents that have no uses anymore.
+- for (TextIdHashMap::Enum e(extraTextId); !e.empty(); e.popFront()) {
+- if (e.front().value()->uses() == 0) {
+- js_delete(e.front().value());
+- e.removeFront();
+- }
+- }
+ }
+
+ uint64_t time = rdtsc() - traceLoggerState->startupTime;
+@@ -956,3 +998,16 @@ TraceLoggerEvent::~TraceLoggerEvent()
+ if (payload_)
+ payload_->release();
+ }
++
++TraceLoggerEvent&
++TraceLoggerEvent::operator=(const TraceLoggerEvent& other)
++{
++ if (hasPayload())
++ payload()->release();
++ if (other.hasPayload())
++ other.payload()->use();
++
++ payload_ = other.payload_;
++
++ return *this;
++}
+diff --git a/js/src/vm/TraceLogging.h b/js/src/vm/TraceLogging.h
+index a124dcb..91a1eb0 100644
+--- a/js/src/vm/TraceLogging.h
++++ b/js/src/vm/TraceLogging.h
+@@ -110,6 +110,9 @@ class TraceLoggerEvent {
+ bool hasPayload() const {
+ return !!payload_;
+ }
++
++ TraceLoggerEvent& operator=(const TraceLoggerEvent& other);
++ TraceLoggerEvent(const TraceLoggerEvent& event) = delete;
+ };
+
+ /**
+@@ -130,6 +133,10 @@ class TraceLoggerEventPayload {
+ uses_(0)
+ { }
+
++ ~TraceLoggerEventPayload() {
++ MOZ_ASSERT(uses_ == 0);
++ }
++
+ uint32_t textId() {
+ return textId_;
+ }
+@@ -166,7 +173,8 @@ class TraceLoggerThread
+ mozilla::UniquePtr<TraceLoggerGraph> graph;
+
+ PointerHashMap pointerMap;
+- TextIdHashMap extraTextId;
++ TextIdHashMap textIdPayloads;
++ uint32_t nextTextId;
+
+ ContinuousSpace<EventEntry> events;
+
+@@ -181,6 +189,7 @@ class TraceLoggerThread
+ : enabled(0),
+ failed(false),
+ graph(),
++ nextTextId(TraceLogger_Last),
+ iteration_(0),
+ top(nullptr)
+ { }
+@@ -195,22 +204,22 @@ class TraceLoggerThread
+ bool enable(JSContext* cx);
+ bool disable();
+
+- // Given the previous iteration and lastEntryId, return an array of events
++ // Given the previous iteration and size, return an array of events
+ // (there could be lost events). At the same time update the iteration and
+- // lastEntry and gives back how many events there are.
+- EventEntry* getEventsStartingAt(uint32_t* lastIteration, uint32_t* lastEntryId, size_t* num) {
++ // size and gives back how many events there are.
++ EventEntry* getEventsStartingAt(uint32_t* lastIteration, uint32_t* lastSize, size_t* num) {
+ EventEntry* start;
+ if (iteration_ == *lastIteration) {
+- MOZ_ASSERT(events.lastEntryId() >= *lastEntryId);
+- *num = events.lastEntryId() - *lastEntryId;
+- start = events.data() + *lastEntryId + 1;
++ MOZ_ASSERT(*lastSize <= events.size());
++ *num = events.size() - *lastSize;
++ start = events.data() + *lastSize;
+ } else {
+- *num = events.lastEntryId() + 1;
++ *num = events.size();
+ start = events.data();
+ }
+
+ *lastIteration = iteration_;
+- *lastEntryId = events.lastEntryId();
++ *lastSize = events.size();
+ return start;
+ }
+
+@@ -220,16 +229,16 @@ class TraceLoggerThread
+ const char** lineno, size_t* lineno_len, const char** colno,
+ size_t* colno_len);
+
+- bool lostEvents(uint32_t lastIteration, uint32_t lastEntryId) {
++ bool lostEvents(uint32_t lastIteration, uint32_t lastSize) {
+ // If still logging in the same iteration, there are no lost events.
+ if (lastIteration == iteration_) {
+- MOZ_ASSERT(lastEntryId <= events.lastEntryId());
++ MOZ_ASSERT(lastSize <= events.size());
+ return false;
+ }
+
+- // When proceeded to the next iteration and lastEntryId points to
+- // the maximum capacity there are no logs that are lost.
+- if (lastIteration + 1 == iteration_ && lastEntryId == events.capacity())
++ // If we are in a consecutive iteration we are only sure we didn't lose any events,
++ // when the lastSize equals the maximum size 'events' can get.
++ if (lastIteration == iteration_ - 1 && lastSize == events.maxSize())
+ return false;
+
+ return true;
+@@ -268,6 +277,7 @@ class TraceLoggerThread
+ void stopEvent(uint32_t id);
+ private:
+ void stopEvent();
++ void log(uint32_t id);
+
+ public:
+ static unsigned offsetOfEnabled() {
+diff --git a/js/src/vm/TraceLoggingGraph.cpp b/js/src/vm/TraceLoggingGraph.cpp
+index d1b7f2e..a4eb273 100644
+--- a/js/src/vm/TraceLoggingGraph.cpp
++++ b/js/src/vm/TraceLoggingGraph.cpp
+@@ -276,7 +276,7 @@ TraceLoggerGraph::flush()
+ if (bytesWritten < tree.size())
+ return false;
+
+- treeOffset += tree.lastEntryId();
++ treeOffset += tree.size();
+ tree.clear();
+ }
+
+@@ -359,7 +359,7 @@ TraceLoggerGraph::startEventInternal(uint32_t id, uint64_t timestamp)
+
+ if (parent.lastChildId() == 0) {
+ MOZ_ASSERT(!entry.hasChildren());
+- MOZ_ASSERT(parent.treeId() == tree.lastEntryId() + treeOffset);
++ MOZ_ASSERT(parent.treeId() == treeOffset + tree.size() - 1);
+
+ if (!updateHasChildren(parent.treeId()))
+ return false;
+diff --git a/js/src/vm/TraceLoggingTypes.h b/js/src/vm/TraceLoggingTypes.h
+index f1c9d0c..10b76d6 100644
+--- a/js/src/vm/TraceLoggingTypes.h
++++ b/js/src/vm/TraceLoggingTypes.h
+@@ -21,7 +21,6 @@
+ _(Internal) \
+ _(Interpreter) \
+ _(InlinedScripts) \
+- _(Invalidation) \
+ _(IonCompilation) \
+ _(IonCompilationPaused) \
+ _(IonLinking) \
+@@ -60,6 +59,7 @@
+
+ #define TRACELOGGER_LOG_ITEMS(_) \
+ _(Bailout) \
++ _(Invalidation) \
+ _(Disable) \
+ _(Enable) \
+ _(Stop)
+@@ -130,6 +130,9 @@ class ContinuousSpace {
+ uint32_t size_;
+ uint32_t capacity_;
+
++ // The maximum amount of ram memory a continuous space structure can take (in bytes).
++ static const uint32_t LIMIT = 200 * 1024 * 1024;
++
+ public:
+ ContinuousSpace ()
+ : data_(nullptr)
+@@ -151,6 +154,10 @@ class ContinuousSpace {
+ data_ = nullptr;
+ }
+
++ static uint32_t maxSize() {
++ return LIMIT / sizeof(T);
++ }
++
+ T* data() {
+ return data_;
+ }
+@@ -187,11 +194,14 @@ class ContinuousSpace {
+ if (hasSpaceForAdd(count))
+ return true;
+
++ // Limit the size of a continuous buffer.
++ if (size_ + count > maxSize())
++ return false;
++
+ uint32_t nCapacity = capacity_ * 2;
+- if (size_ + count > nCapacity)
+- nCapacity = size_ + count;
+- T* entries = (T*) js_realloc(data_, nCapacity * sizeof(T));
++ nCapacity = (nCapacity < maxSize()) ? nCapacity : maxSize();
+
++ T* entries = (T*) js_realloc(data_, nCapacity * sizeof(T));
+ if (!entries)
+ return false;
+
diff --git a/gnu/packages/patches/mozjs38-version-detection.patch b/gnu/packages/patches/mozjs38-version-detection.patch
new file mode 100644
index 0000000000..ec2d264ccc
--- /dev/null
+++ b/gnu/packages/patches/mozjs38-version-detection.patch
@@ -0,0 +1,180 @@
+Taken from
+https://trac.wildfiregames.com/export/18656/ps/trunk/libraries/source/spidermonkey/FixVersionDetectionConfigure.diff.
+
+Fixes a version detection issue in 0ad. See
+https://lists.gnu.org/archive/html/guix-devel/2017-01/msg00625.html.
+
+diff --git a/js/src/configure b/js/src/configure
+--- a/js/src/configure
++++ b/js/src/configure
+@@ -1662,70 +1662,6 @@ esac
+
+ fi
+
+-MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
+-MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
+-MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
+-
+-cat >> confdefs.pytmp <<EOF
+- (''' MOZILLA_VERSION ''', r''' "$MOZILLA_VERSION" ''')
+-EOF
+-cat >> confdefs.h <<EOF
+-#define MOZILLA_VERSION "$MOZILLA_VERSION"
+-EOF
+-
+-cat >> confdefs.pytmp <<EOF
+- (''' MOZILLA_VERSION_U ''', r''' $MOZILLA_VERSION ''')
+-EOF
+-cat >> confdefs.h <<EOF
+-#define MOZILLA_VERSION_U $MOZILLA_VERSION
+-EOF
+-
+-cat >> confdefs.pytmp <<EOF
+- (''' MOZILLA_UAVERSION ''', r''' "$MOZILLA_UAVERSION" ''')
+-EOF
+-cat >> confdefs.h <<EOF
+-#define MOZILLA_UAVERSION "$MOZILLA_UAVERSION"
+-EOF
+-
+-
+-
+-# Separate version into components for use in shared object naming etc
+-
+-MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
+-MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"`
+-MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
+-IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
+-
+-JS_SHELL_NAME=js
+-JS_CONFIG_NAME=js-config
+-
+-
+-if test -n "$IS_ALPHA"; then
+-
+- MOZJS_ALPHA=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9\.]*\([^0-9]\).*|\1|"`
+-
+-fi
+-cat >> confdefs.pytmp <<EOF
+- (''' MOZJS_MAJOR_VERSION ''', r''' $MOZJS_MAJOR_VERSION ''')
+-EOF
+-cat >> confdefs.h <<EOF
+-#define MOZJS_MAJOR_VERSION $MOZJS_MAJOR_VERSION
+-EOF
+-
+-cat >> confdefs.pytmp <<EOF
+- (''' MOZJS_MINOR_VERSION ''', r''' $MOZJS_MINOR_VERSION ''')
+-EOF
+-cat >> confdefs.h <<EOF
+-#define MOZJS_MINOR_VERSION $MOZJS_MINOR_VERSION
+-EOF
+-
+-
+-
+-
+-
+-
+-
+-
+
+ AR_FLAGS='crs $@'
+
+@@ -5731,6 +5565,71 @@ XCFLAGS="$X_CFLAGS"
+
+ fi # COMPILE_ENVIRONMENT
+
++MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
++MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
++MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
++
++cat >> confdefs.pytmp <<EOF
++ (''' MOZILLA_VERSION ''', r''' "$MOZILLA_VERSION" ''')
++EOF
++cat >> confdefs.h <<EOF
++#define MOZILLA_VERSION "$MOZILLA_VERSION"
++EOF
++
++cat >> confdefs.pytmp <<EOF
++ (''' MOZILLA_VERSION_U ''', r''' $MOZILLA_VERSION ''')
++EOF
++cat >> confdefs.h <<EOF
++#define MOZILLA_VERSION_U $MOZILLA_VERSION
++EOF
++
++cat >> confdefs.pytmp <<EOF
++ (''' MOZILLA_UAVERSION ''', r''' "$MOZILLA_UAVERSION" ''')
++EOF
++cat >> confdefs.h <<EOF
++#define MOZILLA_UAVERSION "$MOZILLA_UAVERSION"
++EOF
++
++
++
++# Separate version into components for use in shared object naming etc
++
++MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
++MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"`
++MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
++IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
++
++JS_SHELL_NAME=js
++JS_CONFIG_NAME=js-config
++
++
++if test -n "$IS_ALPHA"; then
++
++ MOZJS_ALPHA=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9\.]*\([^0-9]\).*|\1|"`
++
++fi
++cat >> confdefs.pytmp <<EOF
++ (''' MOZJS_MAJOR_VERSION ''', r''' $MOZJS_MAJOR_VERSION ''')
++EOF
++cat >> confdefs.h <<EOF
++#define MOZJS_MAJOR_VERSION $MOZJS_MAJOR_VERSION
++EOF
++
++cat >> confdefs.pytmp <<EOF
++ (''' MOZJS_MINOR_VERSION ''', r''' $MOZJS_MINOR_VERSION ''')
++EOF
++cat >> confdefs.h <<EOF
++#define MOZJS_MINOR_VERSION $MOZJS_MINOR_VERSION
++EOF
++
++
++
++
++
++
++
++
++
+ AS_BIN=$AS
+ AR_LIST='$(AR) t'
+ AR_EXTRACT='$(AR) x'
+@@ -16003,13 +15908,6 @@ sed 's/$/,/' >> $CONFIG_STATUS <<EOF
+ (''' ANDROID_NDK ''', r''' $ANDROID_NDK ''')
+ (''' ANDROID_TOOLCHAIN ''', r''' $ANDROID_TOOLCHAIN ''')
+ (''' ANDROID_PLATFORM ''', r''' $ANDROID_PLATFORM ''')
+- (''' MOZILLA_SYMBOLVERSION ''', r''' $MOZILLA_SYMBOLVERSION ''')
+- (''' JS_SHELL_NAME ''', r''' $JS_SHELL_NAME ''')
+- (''' JS_CONFIG_NAME ''', r''' $JS_CONFIG_NAME ''')
+- (''' MOZJS_MAJOR_VERSION ''', r''' $MOZJS_MAJOR_VERSION ''')
+- (''' MOZJS_MINOR_VERSION ''', r''' $MOZJS_MINOR_VERSION ''')
+- (''' MOZJS_PATCH_VERSION ''', r''' $MOZJS_PATCH_VERSION ''')
+- (''' MOZJS_ALPHA ''', r''' $MOZJS_ALPHA ''')
+ (''' HOST_CC ''', r''' $HOST_CC ''')
+ (''' HOST_CXX ''', r''' $HOST_CXX ''')
+ (''' HOST_RANLIB ''', r''' $HOST_RANLIB ''')
+@@ -16061,6 +15959,13 @@ sed 's/$/,/' >> $CONFIG_STATUS <<EOF
+ (''' X_PRE_LIBS ''', r''' $X_PRE_LIBS ''')
+ (''' X_LIBS ''', r''' $X_LIBS ''')
+ (''' X_EXTRA_LIBS ''', r''' $X_EXTRA_LIBS ''')
++ (''' MOZILLA_SYMBOLVERSION ''', r''' $MOZILLA_SYMBOLVERSION ''')
++ (''' JS_SHELL_NAME ''', r''' $JS_SHELL_NAME ''')
++ (''' JS_CONFIG_NAME ''', r''' $JS_CONFIG_NAME ''')
++ (''' MOZJS_MAJOR_VERSION ''', r''' $MOZJS_MAJOR_VERSION ''')
++ (''' MOZJS_MINOR_VERSION ''', r''' $MOZJS_MINOR_VERSION ''')
++ (''' MOZJS_PATCH_VERSION ''', r''' $MOZJS_PATCH_VERSION ''')
++ (''' MOZJS_ALPHA ''', r''' $MOZJS_ALPHA ''')
+ (''' SOLARIS_SUNPRO_CC ''', r''' $SOLARIS_SUNPRO_CC ''')
+ (''' SOLARIS_SUNPRO_CXX ''', r''' $SOLARIS_SUNPRO_CXX ''')
+ (''' MOZ_THUMB2 ''', r''' $MOZ_THUMB2 ''')
diff --git a/gnu/packages/patches/pcre2-CVE-2017-8786.patch b/gnu/packages/patches/pcre2-CVE-2017-8786.patch
new file mode 100644
index 0000000000..6071d58f07
--- /dev/null
+++ b/gnu/packages/patches/pcre2-CVE-2017-8786.patch
@@ -0,0 +1,155 @@
+Fix CVE-2017-8786:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8786
+https://bugs.exim.org/show_bug.cgi?id=2079
+https://blogs.gentoo.org/ago/2017/04/29/libpcre-heap-based-buffer-overflow-write-in-pcre2test-c/
+
+Patch copied from upstream source repository:
+
+https://vcs.pcre.org/pcre2?view=revision&revision=696
+https://vcs.pcre.org/pcre2?view=revision&revision=697
+
+--- trunk/doc/pcre2api.3 2017/03/21 16:48:40 695
++++ trunk/doc/pcre2api.3 2017/03/21 17:46:21 696
+@@ -1,4 +1,4 @@
+-.TH PCRE2API 3 "24 December 2016" "PCRE2 10.23"
++.TH PCRE2API 3 "21 March 2017" "PCRE2 10.30"
+ .SH NAME
+ PCRE2 - Perl-compatible regular expressions (revised API)
+ .sp
+@@ -2633,8 +2633,8 @@
+ A text message for an error code from any PCRE2 function (compile, match, or
+ auxiliary) can be obtained by calling \fBpcre2_get_error_message()\fP. The code
+ is passed as the first argument, with the remaining two arguments specifying a
+-code unit buffer and its length, into which the text message is placed. Note
+-that the message is returned in code units of the appropriate width for the
++code unit buffer and its length in code units, into which the text message is
++placed. The message is returned in code units of the appropriate width for the
+ library that is being used.
+ .P
+ The returned message is terminated with a trailing zero, and the function
+@@ -3321,6 +3321,6 @@
+ .rs
+ .sp
+ .nf
+-Last updated: 23 December 2016
+-Copyright (c) 1997-2016 University of Cambridge.
++Last updated: 21 March 2017
++Copyright (c) 1997-2017 University of Cambridge.
+ .fi
+--- trunk/src/pcre2_error.c 2017/03/21 16:48:40 695
++++ trunk/src/pcre2_error.c 2017/03/21 17:46:21 696
+@@ -271,7 +271,7 @@
+ Arguments:
+ enumber error number
+ buffer where to put the message (zero terminated)
+- size size of the buffer
++ size size of the buffer in code units
+
+ Returns: length of message if all is well
+ negative on error
+--- trunk/src/pcre2test.c 2017/03/21 17:46:21 696
++++ trunk/src/pcre2test.c 2017/03/21 18:36:13 697
+@@ -1017,9 +1017,9 @@
+ if (test_mode == PCRE8_MODE) \
+ r = pcre2_get_error_message_8(a,G(b,8),G(G(b,8),_size)); \
+ else if (test_mode == PCRE16_MODE) \
+- r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size)); \
++ r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size/2)); \
+ else \
+- r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))
++ r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size/4))
+
+ #define PCRE2_GET_OVECTOR_COUNT(a,b) \
+ if (test_mode == PCRE8_MODE) \
+@@ -1399,6 +1399,9 @@
+
+ /* ----- Common macros for two-mode cases ----- */
+
++#define BYTEONE (BITONE/8)
++#define BYTETWO (BITTWO/8)
++
+ #define CASTFLD(t,a,b) \
+ ((test_mode == G(G(PCRE,BITONE),_MODE))? (t)(G(a,BITONE)->b) : \
+ (t)(G(a,BITTWO)->b))
+@@ -1481,9 +1484,9 @@
+
+ #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
+ if (test_mode == G(G(PCRE,BITONE),_MODE)) \
+- r = G(pcre2_get_error_message_,BITONE)(a,G(b,BITONE),G(G(b,BITONE),_size)); \
++ r = G(pcre2_get_error_message_,BITONE)(a,G(b,BITONE),G(G(b,BITONE),_size/BYTEONE)); \
+ else \
+- r = G(pcre2_get_error_message_,BITTWO)(a,G(b,BITTWO),G(G(b,BITTWO),_size))
++ r = G(pcre2_get_error_message_,BITTWO)(a,G(b,BITTWO),G(G(b,BITTWO),_size/BYTETWO))
+
+ #define PCRE2_GET_OVECTOR_COUNT(a,b) \
+ if (test_mode == G(G(PCRE,BITONE),_MODE)) \
+@@ -1904,7 +1907,7 @@
+ #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \
+ a = pcre2_dfa_match_16(G(b,16),(PCRE2_SPTR16)c,d,e,f,G(g,16),h,i,j)
+ #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
+- r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size))
++ r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size/2))
+ #define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_16(G(b,16))
+ #define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_16(G(b,16))
+ #define PCRE2_JIT_COMPILE(r,a,b) r = pcre2_jit_compile_16(G(a,16),b)
+@@ -2000,7 +2003,7 @@
+ #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \
+ a = pcre2_dfa_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),h,i,j)
+ #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
+- r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))
++ r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size/4))
+ #define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_32(G(b,32))
+ #define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_32(G(b,32))
+ #define PCRE2_JIT_COMPILE(r,a,b) r = pcre2_jit_compile_32(G(a,32),b)
+--- trunk/src/pcre2test.c 2017/03/21 16:48:40 695
++++ trunk/src/pcre2test.c 2017/03/21 17:46:21 696
+@@ -2889,7 +2889,7 @@
+ {
+ if (pbuffer32 != NULL) free(pbuffer32);
+ pbuffer32_size = 4*len + 4;
+- if (pbuffer32_size < 256) pbuffer32_size = 256;
++ if (pbuffer32_size < 512) pbuffer32_size = 512;
+ pbuffer32 = (uint32_t *)malloc(pbuffer32_size);
+ if (pbuffer32 == NULL)
+ {
+@@ -7600,7 +7600,8 @@
+ int errcode;
+ char *endptr;
+
+-/* Ensure the relevant non-8-bit buffer is available. */
++/* Ensure the relevant non-8-bit buffer is available. Ensure that it is at
++least 128 code units, because it is used for retrieving error messages. */
+
+ #ifdef SUPPORT_PCRE2_16
+ if (test_mode == PCRE16_MODE)
+@@ -7620,7 +7621,7 @@
+ #ifdef SUPPORT_PCRE2_32
+ if (test_mode == PCRE32_MODE)
+ {
+- pbuffer32_size = 256;
++ pbuffer32_size = 512;
+ pbuffer32 = (uint32_t *)malloc(pbuffer32_size);
+ if (pbuffer32 == NULL)
+ {
+--- trunk/testdata/testinput2 2017/03/21 16:48:40 695
++++ trunk/testdata/testinput2 2017/03/21 17:46:21 696
+@@ -5017,4 +5017,6 @@
+
+ /(?<!\1((?U)1((?U))))(*F)/never_backslash_c,alt_bsux,anchored,extended
+
++/\g{3/
++
+ # End of testinput2
+--- trunk/testdata/testoutput2 2017/03/21 16:48:40 695
++++ trunk/testdata/testoutput2 2017/03/21 17:46:21 696
+@@ -15570,6 +15570,9 @@
+
+ /(?<!\1((?U)1((?U))))(*F)/never_backslash_c,alt_bsux,anchored,extended
+
++/\g{3/
++Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
++
+ # End of testinput2
+ Error -63: PCRE2_ERROR_BADDATA (unknown error number)
+ Error -62: bad serialized data
diff --git a/gnu/packages/patches/perl-net-dns-resolver-programmable-Fix-broken-interface.patch b/gnu/packages/patches/perl-net-dns-resolver-programmable-fix.patch
index 371693dca1..371693dca1 100644
--- a/gnu/packages/patches/perl-net-dns-resolver-programmable-Fix-broken-interface.patch
+++ b/gnu/packages/patches/perl-net-dns-resolver-programmable-fix.patch
diff --git a/gnu/packages/patches/proot-test-fhs.patch b/gnu/packages/patches/proot-test-fhs.patch
new file mode 100644
index 0000000000..d3896addd6
--- /dev/null
+++ b/gnu/packages/patches/proot-test-fhs.patch
@@ -0,0 +1,98 @@
+The test suite of PRoot makes many FHS assumptions, such as assuming
+that /bin, /bin/true, and /usr exist. This patch fixes these assumptions.
+
+--- source/tests/GNUmakefile 2017-05-11 15:26:36.899115484 +0200
++++ source/tests/GNUmakefile 2017-05-11 15:26:46.143063166 +0200
+@@ -121,7 +121,7 @@ $(ROOTFS_DIR):
+ setup: $(ROOTFS_BIN)
+
+ $(ROOTFS)/bin/abs-true:
+- @ln -fs /bin/true $@
++ @ln -fs `which true` $@
+
+ $(ROOTFS)/bin/rel-true:
+ @ln -fs ./true $@
+
+--- source/tests/test-d2175fc3.sh 2017-05-11 15:36:53.727617010 +0200
++++ source/tests/test-d2175fc3.sh 2017-05-11 15:37:10.155523637 +0200
+@@ -2,8 +2,8 @@ if [ ! -x ${ROOTFS}/bin/readlink ] || [
+ exit 125;
+ fi
+
+-${PROOT} -r ${ROOTFS} /bin/readlink /bin/abs-true | grep '^/bin/true$'
++${PROOT} -r ${ROOTFS} /bin/readlink /bin/abs-true | grep "`which true`"
+ ${PROOT} -r ${ROOTFS} /bin/readlink /bin/rel-true | grep '^\./true$'
+
+-${PROOT} -b /:/host-rootfs -r ${ROOTFS} /bin/readlink /bin/abs-true | grep '^/bin/true$'
++${PROOT} -b /:/host-rootfs -r ${ROOTFS} /bin/readlink /bin/abs-true | grep "`which true`"
+ ${PROOT} -b /:/host-rootfs -r ${ROOTFS} /bin/readlink /bin/rel-true | grep '^./true$'
+
+--- source/tests/test-d1be631a.sh 2017-05-11 15:41:36.458008715 +0200
++++ source/tests/test-d1be631a.sh 2017-05-11 15:41:38.921994686 +0200
+@@ -1,4 +1,4 @@
+-if [ -z `which mknod`] || [ `id -u` -eq 0 ]; then
++if [ -z `which mknod` ] || [ `id -u` -eq 0 ]; then
+ exit 125;
+ fi
+
+--- source/tests/test-5bed7141.c 2017-05-11 15:34:23.088472743 +0200
++++ source/tests/test-5bed7141.c 2017-05-11 15:34:27.052450235 +0200
+@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
+ exit(EXIT_FAILURE);
+
+ case 0: /* child */
+- status = chdir("/usr");
++ status = chdir("/gnu");
+ if (status < 0) {
+ perror("chdir");
+ exit(EXIT_FAILURE);
+
+--- a/tests/test-092c5e26.sh
++++ b/tests/test-092c5e26.sh
+@@ -24,7 +24,7 @@ fi
+
+ unset LD_LIBRARY_PATH
+
+-env PROOT_FORCE_FOREIGN_BINARY=1 PATH=/tmp:/bin:/usr/bin ${PROOT} -r ${ROOTFS} -q echo ${TMP} | grep "^-U LD_LIBRARY_PATH ${EXTRA}-0 /bin/argv0 /bin/argv0 ${TMP_ABS}$"
++env PROOT_FORCE_FOREIGN_BINARY=1 PATH=/tmp:/bin:/usr/bin:$(dirname $(which echo)) ${PROOT} -r ${ROOTFS} -q echo ${TMP} | grep "^-U LD_LIBRARY_PATH ${EXTRA}-0 /bin/argv0 /bin/argv0 ${TMP_ABS}$"
+ env PROOT_FORCE_FOREIGN_BINARY=1 ${PROOT} -r ${ROOTFS} -q echo ${TMP_ABS} | grep "^-U LD_LIBRARY_PATH ${EXTRA}-0 /bin/argv0 /bin/argv0 ${TMP_ABS}$"
+
+ cat > ${ROOTFS}/${TMP_ABS} <<EOF
+@@ -34,7 +34,7 @@ chmod +x ${ROOTFS}/${TMP_ABS}
+
+ # Valgrind prepends "/bin/sh" in front of foreign binaries.
+ if ! $(echo ${PROOT} | grep -q valgrind); then
+- env PATH=/tmp:/bin:/usr/bin ${PROOT} -r ${ROOTFS} -q echo ${TMP} | grep "^-U LD_LIBRARY_PATH -0 ${TMP} ${TMP_ABS}$"
++ env PATH=/tmp:/bin:/usr/bin:$(dirname $(which echo)) ${PROOT} -r ${ROOTFS} -q echo ${TMP} | grep "^-U LD_LIBRARY_PATH -0 ${TMP} ${TMP_ABS}$"
+ ${PROOT} -r ${ROOTFS} -q echo ${TMP_ABS} | grep "^-U LD_LIBRARY_PATH -0 ${TMP_ABS} ${TMP_ABS}$"
+ fi
+
+diff --git a/tests/test-5467b986.sh b/tests/test-5467b986.sh
+index c6ac71a..f616f1e 100644
+--- a/tests/test-5467b986.sh
++++ b/tests/test-5467b986.sh
+@@ -30,8 +30,8 @@ ${PROOT} -v -1 -b /tmp:/b -b /tmp:/a -r ${ROOTFS} fchdir_getcwd /b | grep '^/[ab
+ ! ${PROOT} -w /bin -r ${ROOTFS} fchdir_getcwd true
+ [ $? -eq 0 ]
+
+-${PROOT} -v -1 -w /usr -r / ${ROOTFS}/bin/chdir_getcwd share | grep '^/usr/share$'
+-${PROOT} -v -1 -w /usr -r / ${ROOTFS}/bin/fchdir_getcwd share | grep '^/usr/share$'
++${PROOT} -v -1 -w /gnu -r / ${ROOTFS}/bin/chdir_getcwd store | grep '^/gnu/store$'
++${PROOT} -v -1 -w /gnu -r / ${ROOTFS}/bin/fchdir_getcwd store | grep '^/gnu/store$'
+
+-(cd /; ${PROOT} -v -1 -w usr -r / ${ROOTFS}/bin/chdir_getcwd share | grep '^/usr/share$')
+-(cd /; ${PROOT} -v -1 -w usr -r / ${ROOTFS}/bin/fchdir_getcwd share | grep '^/usr/share$')
++(cd /; ${PROOT} -v -1 -w gnu -r / ${ROOTFS}/bin/chdir_getcwd store | grep '^/gnu/store$')
++(cd /; ${PROOT} -v -1 -w gnu -r / ${ROOTFS}/bin/fchdir_getcwd store | grep '^/gnu/store$')
+
+--- a/tests/test-c15999f9.sh
++++ b/tests/test-c15999f9.sh
+@@ -5,7 +5,7 @@ fi
+ TMP=/tmp/$(mcookie)
+ mkdir ${TMP}
+
+-${PROOT} -b /bin/true:${TMP}/true /bin/true
++${PROOT} -b `which true`:${TMP}/true `which true`
+ ! test -e ${TMP}/true
+ [ $? -eq 0 ]
+
diff --git a/gnu/packages/patches/reptyr-fix-gcc-7.patch b/gnu/packages/patches/reptyr-fix-gcc-7.patch
new file mode 100644
index 0000000000..5e0e581218
--- /dev/null
+++ b/gnu/packages/patches/reptyr-fix-gcc-7.patch
@@ -0,0 +1,38 @@
+This patch allows reptyr to build with gcc 7. It is taken from reptyr mainline patches
+fa0d63f and b45fd92.
+
+https://github.com/nelhage/reptyr/commit/fa0d63ff8c488be15976e5353580b565e85586a1
+https://github.com/nelhage/reptyr/commit/b45fd9238958fcf2d8f3d6fc23e6d491febea2ac
+
+Patch by Nelson Elhage <nelhage@nelhage.com>.
+
+diff --git a/attach.c b/attach.c
+index bd8ef8c..8d9cbf8 100644
+--- a/attach.c
++++ b/attach.c
+@@ -389,8 +389,11 @@ int setup_steal_socket(struct steal_pty_state *steal) {
+ return errno;
+
+ steal->addr_un.sun_family = AF_UNIX;
+- snprintf(steal->addr_un.sun_path, sizeof(steal->addr_un.sun_path),
+- "%s/reptyr.sock", steal->tmpdir);
++ if (snprintf(steal->addr_un.sun_path, sizeof(steal->addr_un.sun_path),
++ "%s/reptyr.sock", steal->tmpdir) >= sizeof(steal->addr_un.sun_path)) {
++ error("tmpdir path too long!");
++ return ENAMETOOLONG;
++ }
+
+ if ((steal->sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
+ return errno;
+diff --git a/platform/linux/linux.h b/platform/linux/linux.h
+index 9e6b78a..3ec5a99 100644
+--- a/platform/linux/linux.h
++++ b/platform/linux/linux.h
+@@ -40,6 +40,7 @@
+ #include <sys/ptrace.h>
+ #include <asm/ptrace.h>
+ #include <sys/types.h>
++#include <sys/sysmacros.h>
+ #include <sys/user.h>
+ #include <unistd.h>
+ #include <stdlib.h>
diff --git a/gnu/packages/patches/rpcbind-CVE-2017-8779.patch b/gnu/packages/patches/rpcbind-CVE-2017-8779.patch
new file mode 100644
index 0000000000..6ca93ff12b
--- /dev/null
+++ b/gnu/packages/patches/rpcbind-CVE-2017-8779.patch
@@ -0,0 +1,29 @@
+Fix CVE-2017-8779:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8779
+
+Patch copied from the bug reporter's 3rd-party repository:
+
+https://github.com/guidovranken/rpcbomb/blob/master/rpcbind_patch.txt
+
+diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
+index 5862c26..e11f61b 100644
+--- a/src/rpcb_svc_com.c
++++ b/src/rpcb_svc_com.c
+@@ -48,6 +48,7 @@
+ #include <rpc/rpc.h>
+ #include <rpc/rpcb_prot.h>
+ #include <rpc/svc_dg.h>
++#include <rpc/rpc_com.h>
+ #include <netconfig.h>
+ #include <errno.h>
+ #include <syslog.h>
+@@ -432,7 +433,7 @@ rpcbproc_taddr2uaddr_com(void *arg, struct svc_req *rqstp /*__unused*/,
+ static bool_t
+ xdr_encap_parms(XDR *xdrs, struct encap_parms *epp)
+ {
+- return (xdr_bytes(xdrs, &(epp->args), (u_int *) &(epp->arglen), ~0));
++ return (xdr_bytes(xdrs, &(epp->args), (u_int *) &(epp->arglen), RPC_MAXDATASIZE));
+ }
+
+ /*