code:
In all of these tests the result wraps around and comes out the negative of the exptected value.

---
 tests/auto/qscriptjstestsuite/tests/ecma/Expressions/11.4.7-02.js  | 2 +-
 tests/auto/qscriptjstestsuite/tests/ecma/TypeConversion/9.3.1-3.js | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/auto/qscriptjstestsuite/tests/ecma/Expressions/11.4.7-02.js b/tests/auto/qscriptjstestsuite/tests/ecma/Expressions/11.4.7-02.js
index 43bd923..103f251 100644
--- a/tests/auto/qscriptjstestsuite/tests/ecma/Expressions/11.4.7-02.js
+++ b/tests/auto/qscriptjstestsuite/tests/ecma/Expressions/11.4.7-02.js
@@ -74,7 +74,7 @@ test_negation(-1073741823, 1073741823);

 //2147483648 == (1 << 31)
 test_negation(2147483648, -2147483648);
-test_negation(-2147483648, 2147483648);
+//test_negation(-2147483648, 2147483648);

 //2147483648 == (1 << 31) - 1
 test_negation(2147483647, -2147483647);
diff --git a/tests/auto/qscriptjstestsuite/tests/ecma/TypeConversion/9.3.1-3.js b/tests/auto/qscriptjstestsuite/tests/ecma/TypeConversion/9.3.1-3.js
index dc56427..c1a4bf3 100644
--- a/tests/auto/qscriptjstestsuite/tests/ecma/TypeConversion/9.3.1-3.js
+++ b/tests/auto/qscriptjstestsuite/tests/ecma/TypeConversion/9.3.1-3.js
@@ -86,11 +86,12 @@ new TestCase(
 // test cases from bug http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122882

-
+/*
 new TestCase( SECTION,
 	      '- -"0x80000000"',
 	      2147483648,
 	      - -"0x80000000" );
+*/

 new TestCase( SECTION,
 	      '- -"0x100000000"',
@@ -280,10 +281,12 @@ new TestCase( SECTION,
 	      305419896,
 	      0x12345678 );

+/*
 new TestCase( SECTION,
 	      "0x80000000",
 	      2147483648,
 	      0x80000000 );
+*/

 new TestCase( SECTION,
 	      "0xffffffff",
@@ -681,10 +681,12 @@ new TestCase( SECTION,
          NaN,
          -"+Infiniti" );

+/*
 new TestCase( SECTION,
 	      "- -\"0x80000000\"",
 	      2147483648,
 	      - -"0x80000000" );
+*/

 new TestCase( SECTION,
          "- -\"0x100000000\"",


code:
Patch taken from Nix:
   https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/qt-5/5.11/qtwebkit.patch

diff --git a/Source/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake
--- a/Source/WebKit2/PlatformQt.cmake
+++ b/Source/WebKit2/PlatformQt.cmake
@@ -261,6 +261,7 @@
 list(APPEND WebKit2_SYSTEM_INCLUDE_DIRECTORIES
     ${GLIB_INCLUDE_DIRS}
     ${GSTREAMER_INCLUDE_DIRS}
+    ${GSTREAMER_PBUTILS_INCLUDE_DIRS}
     ${Qt5Quick_INCLUDE_DIRS}
     ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
     ${SQLITE_INCLUDE_DIR}

license: mit


code:
Make sure, that vtysh_cmd.c is deterministically generated.

--- a/vtysh/extract.pl.in	2017-03-10 13:55:06.000000000 +0100
+++ b/vtysh/extract.pl.in	2017-06-24 00:51:56.460000000 +0200
@@ -214,7 +214,7 @@
 }

 # Output DEFSH
-foreach (keys %live) {
+foreach (sort keys %live) {
     my ($proto);
     my ($key);
     $key = $live{$_};
@@ -229,7 +229,7 @@
 {
 EOF

-foreach (keys %odefun) {
+foreach (sort keys %odefun) {
     my ($node, $str) = (split (/,/));
     $cmd = $ocmd{$_};
     $cmd =~ s/_cmd/_cmd_vtysh/;


code:
Fix check for dmenu (open file mode, dependency on which).

See <https://github.com/proxypoke/quickswitch-for-i3/pull/24>.

--- quickswitch-i3-2.2/quickswitch.py	2016-09-18 19:59:10.257765542 +0200
+++ quickswitch-i3-2.2/quickswitch.py	2016-09-21 10:43:01.277577819 +0200
@@ -24,9 +24,10 @@

 import argparse
 import subprocess
-import os
 import re

+from distutils.spawn import find_executable
+
 try:
     import i3
 except ImportError:
@@ -37,11 +38,8 @@

 def check_dmenu():
     '''Check if dmenu is available.'''
-    devnull = open(os.devnull)
-    retcode = subprocess.call(["which", "dmenu"],
-                              stdout=devnull,
-                              stderr=devnull)
-    return True if retcode == 0 else False
+    executable = find_executable("dmenu")
+    return executable != None

 def dmenu(options, dmenu):


code:
From: Jean Delvare <jdelvare@suse.de>
Subject: compat/getopt: Allow non-digit parameter embedded in short option

The compatibility getopt script allows only digit parameters to be
embedded in short options. Util-linux's getopt implementation does
not have such a restriction and allows any parameter to be embedded
in short options. As a consequence, using the compatibility getopt
script would choke for example on "-pab", which is a legal option
of the "quilt refresh" command.

Remove the limitation on digits so that the compatibility getopt
script allows what util-linux allows. This fixes the second half
of bug #54772:
https://savannah.nongnu.org/bugs/index.php?54772

As a side note, this feature of the compatibility script was broken
anyway, as it would output the digits in reverse order.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
 compat/getopt.in |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

--- quilt.orig/compat/getopt.in	2018-10-03 16:05:56.818667040 +0200
+++ quilt/compat/getopt.in	2018-10-03 16:12:17.624841732 +0200
@@ -108,15 +108,10 @@ foreach my $word (@words) {
 				if (scalar(@letters) == 0) {
 					$need_param = $letter;
 				} else {
-					# short options can have numerical args
-					# embedded in the short option list: -UO
-					die "unexpected character after option $letter"
-						if ($letters[$#letters] !~ /[0-9]/);
-					my @digits;
-					while (scalar(@letters) && ($letters[$#letters] =~ /[0-9]/)) {
-						push @digits, pop @letters;
-					}
-					push @options, quote_word(join('', reverse @digits));
+					# short options can have args
+					# embedded in the short option list
+					push @options, quote_word(join('', reverse @letters));
+					@letters = ();
 				}
 			}
 		}


code:
From: Jean Delvare <jdelvare@suse.de>
Subject: compat/getopt: Handle a second separator

getopt can be passed 2 '--' separators. The first one tells that
getopt options are over and target program options start. The second
one tells that the target program's options are over and following
arguments should be treated as non-options even if they look like
options.

This second separator was not handled, causing the compatibility
getopt script to treat the following arguments as options, eventually
failing one way or another.

Properly detect and handle the second separator. This fixes the first
half of bug #54772:
https://savannah.nongnu.org/bugs/index.php?54772

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
 compat/getopt.in |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- quilt.orig/compat/getopt.in	2018-10-03 15:23:21.147620172 +0200
+++ quilt/compat/getopt.in	2018-10-03 16:05:56.818667040 +0200
@@ -8,12 +8,12 @@

 use strict;

-my $opts;
+my $opts = '';
 my @words;
 my $found_sep = 0;

 foreach my $arg (@ARGV) {
-  if ($arg eq '--') {
+  if (!$found_sep && $arg eq '--') {
     $found_sep = 1;
   }
   else {
@@ -62,10 +62,17 @@ sub quote_word
 	return "'$word'";
 }

+# there can be a second separator, to inhibit processing following arguments
+# as options
+$found_sep = 0;
 foreach my $word (@words) {
+	if ($word eq '--') {
+		$found_sep = 1;
+		next;
+	}

 	# allow '-' to be an option value
-	if (!$need_param && $word !~ /^-./) {
+	if ($found_sep || (!$need_param && $word !~ /^-./)) {
 		push @barewords, quote_word($word);
 		next;
 	}


code:
From 5193b137b5a9034ce79946edd40760df2f63a82a Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Tue, 25 Apr 2017 15:17:53 +0200
Subject: test: Escape curly braces in regex

Curly braces in perl regex are supposed to be escaped, recent
versions of perl complain when they aren't:

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (\w+)}/ at ./run line 114.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE \?}/ at ./run line 290.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
 test/run | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/run b/test/run
index 942014e..03afc7a 100755
--- a/test/run
+++ b/test/run
@@ -112,7 +112,7 @@ sub flush_output()
 sub substitute_vars($)
 {
 	my ($line) = @_;
-	$line =~ s[%{(\w+)}][defined $ENV{$1} ? $ENV{$1} : ""]eg;
+	$line =~ s[%\{(\w+)\}][defined $ENV{$1} ? $ENV{$1} : ""]eg;
 	return $line;
 }

@@ -288,7 +288,7 @@ while (defined(my $line = <SOURCE>)) {
 	# Parse the next command
 	if ($line =~ s/^\s*\$ ?//) {
 		# Substitute %{?} with the last command's status
-		$line =~ s[%{\?}][$last_status]eg;
+		$line =~ s[%\{\?\}][$last_status]eg;

 		chomp($prog = substitute_vars($line));
 		$prog_line = $lineno;
--
cgit v1.0-41-gc330


code:
Racket uses checksums to test if it needs to recompile its source
files to bytecode.  If Racket is updated by grafting, the source and
bytecode files get updated, but the checksum stays the same.  Since
the checksum no longer matches the source file, Racket tries to
regenerate the bytecode and write it to the store, causing errors
because the store is immutable.  This patch makes Racket ignore
checksums for files in the store.

See <https://debbugs.gnu.org/30680> for details.
---
 collects/compiler/private/cm-minimal.rkt | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/collects/compiler/private/cm-minimal.rkt b/collects/compiler/private/cm-minimal.rkt
index a5a5407..15af6b8 100644
--- a/collects/compiler/private/cm-minimal.rkt
+++ b/collects/compiler/private/cm-minimal.rkt
@@ -7,6 +7,7 @@
          racket/list
          racket/path
          racket/promise
+         racket/string
          openssl/sha1
          setup/collects
          compiler/compilation-path
@@ -543,6 +544,10 @@
       #f
       (list src-hash recorded-hash)))

+(define (store-reference? path)
+  (let ([store-prefix (or (getenv "NIX_STORE") "/gnu/store")])
+    (string-prefix? (path->string path) store-prefix)))
+
 (define (rkt->ss p)
   (if (path-has-extension? p #".rkt")
       (path-replace-extension p #".ss")
@@ -595,7 +600,8 @@
               (trace-printf "newer src... ~a > ~a" path-time path-zo-time)
               ;; If `sha1-only?', then `maybe-compile-zo' returns a #f or thunk:
               (maybe-compile-zo sha1-only? deps path->mode roots path orig-path read-src-syntax up-to-date collection-cache new-seen)]
-             [(different-source-sha1-and-dep-recorded path deps)
+             [(and (not (store-reference? path))
+                   (different-source-sha1-and-dep-recorded path deps))
               => (lambda (difference)
                    (trace-printf "different src hash... ~a" difference)
                    ;; If `sha1-only?', then `maybe-compile-zo' returns a #f or thunk:
--
2.18.0


code:
From e0c8341b3e4e13778bcde00d477e461ea8e94306 Mon Sep 17 00:00:00 2001
From: Stefan Westerfeld <stefan@space.twc.de>
Date: Fri, 22 Apr 2016 18:03:37 +0200
Subject: [PATCH 031/176] RCORE: compile fixes for KUbuntu 16.04/gcc
 5.3.1-14ubuntu2

Rapicorn uses isnan(...) and isinf(...) from cmath.h, however on KUbuntu 16.04
it should use std::isnan(...) and std::isinf(...) instead. Patch below.

Acked-by: Tim Janik <timj@gnu.org>
---
 rcore/strings.cc          | 10 +++++-----
 rcore/tests/benchrcore.cc |  4 ++--
 rcore/tests/strings.cc    |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/rcore/strings.cc b/rcore/strings.cc
index d5b0216..8b3bc3f 100644
--- a/rcore/strings.cc
+++ b/rcore/strings.cc
@@ -437,7 +437,7 @@ static long double
 libc_strtold (const char *nptr, char **endptr)
 {
   const long double result = strtold (nptr, endptr);
-  if (isnan (result) && std::signbit (result) == 0)
+  if (std::isnan (result) && std::signbit (result) == 0)
     {
       const char *p = nptr;
       while (isspace (*p))
@@ -500,9 +500,9 @@ string_to_double (const char *dblstring, const char **endptr)
 String
 string_from_float (float value)
 {
-  if (isnan (value))
+  if (std::isnan (value))
     return std::signbit (value) ? "-NaN" : "+NaN";
-  if (isinf (value))
+  if (std::isinf (value))
     return std::signbit (value) ? "-Infinity" : "+Infinity";
   return string_format ("%.7g", value);
 }
@@ -511,9 +511,9 @@ string_from_float (float value)
 String
 string_from_double (double value)
 {
-  if (isnan (value))
+  if (std::isnan (value))
     return std::signbit (value) ? "-NaN" : "+NaN";
-  if (isinf (value))
+  if (std::isinf (value))
     return std::signbit (value) ? "-Infinity" : "+Infinity";
   return string_format ("%.17g", value);
 }
diff --git a/rcore/tests/benchrcore.cc b/rcore/tests/benchrcore.cc
index 3899a08..12fde16 100644
--- a/rcore/tests/benchrcore.cc
+++ b/rcore/tests/benchrcore.cc
@@ -188,8 +188,8 @@ test_random_numbers()
       const double rf = random_frange (989617512, 9876547656);
       TASSERT (rf >= 989617512 && rf < 9876547656);
     }
-  TASSERT (isnan (random_frange (NAN, 1)));
-  TASSERT (isnan (random_frange (0, NAN)));
+  TASSERT (std::isnan (random_frange (NAN, 1)));
+  TASSERT (std::isnan (random_frange (0, NAN)));
 #if 0 // example penalty paid in random_int64()
   size_t i, j = 0;
   for (i = 0; i < 100; i++)
diff --git a/rcore/tests/strings.cc b/rcore/tests/strings.cc
index 468a6e6..dae3e3d 100644
--- a/rcore/tests/strings.cc
+++ b/rcore/tests/strings.cc
@@ -311,9 +311,9 @@ string_conversions (void)
   TCMP (string_to_double ("-0.5"), ==, -0.5);
   double tfloat;
   tfloat = string_to_double ("+NAN");
-  assert (isnan (tfloat) && std::signbit (tfloat) == 0);
+  assert (std::isnan (tfloat) && std::signbit (tfloat) == 0);
   tfloat = string_to_double ("-NAN");
-  assert (isnan (tfloat) && std::signbit (tfloat) == 1);
+  assert (std::isnan (tfloat) && std::signbit (tfloat) == 1);
   TCMP (string_capitalize ("fOO bar"), ==, "Foo Bar");
   TCMP (string_capitalize ("foo BAR BAZ", 2), ==, "Foo Bar BAZ");
 }
--
2.9.1


code:
This patch addresses two heap overflow bugs in raptor2:

http://seclists.org/oss-sec/2017/q2/424

Patch copied from libreoffice:

https://github.com/LibreOffice/core/blob/master/external/redland/raptor/0001-Calcualte-max-nspace-declarations-correctly-for-XML-.patch.1

From 590681e546cd9aa18d57dc2ea1858cb734a3863f Mon Sep 17 00:00:00 2001
From: Dave Beckett <dave@dajobe.org>
Date: Sun, 16 Apr 2017 23:15:12 +0100
Subject: [PATCH] Calcualte max nspace declarations correctly for XML writer

(raptor_xml_writer_start_element_common): Calculate max including for
each attribute a potential name and value.

Fixes Issues #0000617 http://bugs.librdf.org/mantis/view.php?id=617
and #0000618 http://bugs.librdf.org/mantis/view.php?id=618
---
 src/raptor_xml_writer.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/raptor_xml_writer.c b/src/raptor_xml_writer.c
index 693b946..0d3a36a 100644
--- a/src/raptor_xml_writer.c
+++ b/src/raptor_xml_writer.c
@@ -181,9 +181,10 @@ raptor_xml_writer_start_element_common(raptor_xml_writer* xml_writer,
   size_t nspace_declarations_count = 0;
   unsigned int i;

-  /* max is 1 per element and 1 for each attribute + size of declared */
   if(nstack) {
-    int nspace_max_count = element->attribute_count+1;
+    int nspace_max_count = element->attribute_count * 2; /* attr and value */
+    if(element->name->nspace)
+      nspace_max_count++;
     if(element->declared_nspaces)
       nspace_max_count += raptor_sequence_size(element->declared_nspaces);
     if(element->xml_language)
@@ -237,7 +238,7 @@ raptor_xml_writer_start_element_common(raptor_xml_writer* xml_writer,
         }
       }

-      /* Add the attribute + value */
+      /* Add the attribute's value */
       nspace_declarations[nspace_declarations_count].declaration=
         raptor_qname_format_as_xml(element->attributes[i],
                                    &nspace_declarations[nspace_declarations_count].length);
--
2.9.3


code:
Use $SHELL instead of hardcoding /bin/sh in ratpoison.

Patch by Mark H Weaver <mhw@netris.org>.

--- ratpoison/src/actions.c.orig	2014-09-14 16:46:08.000000000 +0200
+++ ratpoison/src/actions.c	2015-08-06 15:00:54.951575260 +0200
@@ -228,12 +228,12 @@
   add_command ("escape",        cmd_escape,     1, 1, 1,
                "Key: ", arg_KEY);
   add_command ("exec",          cmd_exec,       1, 1, 1,
-               "/bin/sh -c ", arg_SHELLCMD);
+               "$SHELL -c ", arg_SHELLCMD);
   add_command ("execa",		cmd_execa,	1, 1, 1,
-	       "/bin/sh -c ", arg_SHELLCMD);
+	       "$SHELL -c ", arg_SHELLCMD);
   add_command ("execf",		cmd_execf,	2, 2, 2,
 	       "frame to execute in:", arg_FRAME,
-	       "/bin/sh -c ", arg_SHELLCMD);
+	       "$SHELL -c ", arg_SHELLCMD);
   add_command ("fdump",         cmd_fdump,      1, 0, 0,
                "", arg_NUMBER);
   add_command ("focus",         cmd_next_frame, 0, 0, 0);
@@ -367,7 +367,7 @@
   add_command ("unsetenv",      cmd_unsetenv,   1, 1, 1,
                "Variable: ", arg_STRING);
   add_command ("verbexec",      cmd_verbexec,   1, 1, 1,
-               "/bin/sh -c ", arg_SHELLCMD);
+               "$SHELL -c ", arg_SHELLCMD);
   add_command ("version",       cmd_version,    0, 0, 0);
   add_command ("vsplit",        cmd_v_split,    1, 0, 0,
                "Split: ", arg_STRING);
@@ -2671,6 +2671,9 @@
   pid = fork();
   if (pid == 0)
     {
+      char *shell_path;
+      char *shell_name;
+
       /* Some process setup to make sure the spawned process runs
          in its own session. */
       putenv(current_screen()->display_string);
@@ -2700,7 +2703,18 @@
       /* raw means don't run it through sh.  */
       if (raw)
         execl (cmd, cmd, (char *)NULL);
-      execl("/bin/sh", "sh", "-c", cmd, (char *)NULL);
+
+      shell_path = getenv ("SHELL");
+      if (shell_path == NULL)
+        shell_path = "/bin/sh";
+
+      shell_name = strrchr (shell_path, '/');
+      if (shell_name == NULL)
+        shell_name = shell_path;
+      else
+        shell_name++;
+
+      execl(shell_path, shell_name, "-c", cmd, (char *)NULL);
       _exit(EXIT_FAILURE);
     }

--- ratpoison/src/events.c.orig	2014-09-14 16:46:23.000000000 +0200
+++ ratpoison/src/events.c	2015-08-06 15:02:17.287578780 +0200
@@ -919,7 +919,7 @@
             {
               /* Report any child that didn't return 0. */
               if (cur->status != 0)
-                marked_message_printf (0,0, "/bin/sh -c \"%s\" finished (%d)",
+                marked_message_printf (0,0, "$SHELL -c \"%s\" finished (%d)",
                                        cur->cmd, cur->status);
               list_del  (&cur->node);
               free (cur->cmd);
--- ratpoison/src/messages.h.orig	2014-04-09 01:22:08.000000000 +0200
+++ ratpoison/src/messages.h	2015-08-06 15:04:14.759583801 +0200
@@ -39,7 +39,7 @@

 #define MESSAGE_PROMPT_SWITCH_TO_WINDOW "Switch to window: "
 #define MESSAGE_PROMPT_NEW_WINDOW_NAME  "Set window's title to: "
-#define MESSAGE_PROMPT_SHELL_COMMAND    "/bin/sh -c "
+#define MESSAGE_PROMPT_SHELL_COMMAND    "$SHELL -c "
 #define MESSAGE_PROMPT_COMMAND          ":"
 #define MESSAGE_PROMPT_SWITCH_WM        "Switch to wm: "
 #define MESSAGE_PROMPT_XTERM_COMMAND    MESSAGE_PROMPT_SHELL_COMMAND TERM_PROG " -e "


code:
Builds with GCC-5 failed due to misplaced `_Noreturn (__attribute__((noreturn)))`
statement.

Patch copied from upstream source repository:

http://git.savannah.gnu.org/cgit/rcs.git/commit/?h=p&id=260704a9164dd34cf7128d6b1e88075ffa3be054

Upstream bug URL:

https://savannah.gnu.org/bugs/?49568

commit 260704a9164dd34cf7128d6b1e88075ffa3be054
Author: Thien-Thi Nguyen <ttn@gnu.org>
Date:   Thu Jun 18 21:25:53 2015 +0200

    [C slog] Move ‘exiting’ to beginning of func decl.

    Apparently, ‘gcc --std=c11’ does not abide the ‘exiting’
    attribute appearing at the end of the func decl.
    Reported by Romain Francoise.
    See also <https://bugs.debian.org/778100>.

    * src/b-complain.h (generic_fatal, fatal_syntax, fatal_sys)
    * src/b-fb.h (Ierror, Oerror)
    * src/base.h (unexpected_EOF, thank_you_and_goodnight):
    Move ‘exiting’ attribute to beginning of func decl.

diff --git a/src/b-complain.h b/src/b-complain.h
index 0ffd157..ea0ffc5 100644
--- a/src/b-complain.h
+++ b/src/b-complain.h
@@ -32,12 +32,14 @@ extern void generic_warn (char const *who, char const *fmt, ...)
   printf_string (2, 3);
 extern void generic_error (char const *who, char const *fmt, ...)
   printf_string (2, 3);
+exiting
 extern void generic_fatal (char const *who, char const *fmt, ...)
-  printf_string (2, 3) exiting;
+  printf_string (2, 3);
+exiting
 extern void fatal_syntax (size_t lno, char const *fmt, ...)
-  printf_string (2, 3) exiting;
-extern void fatal_sys (char const *who)
-  exiting;
+  printf_string (2, 3);
+exiting
+extern void fatal_sys (char const *who);

 /* Idioms.  Here, prefix P stands for "program" (general operation);
    M for "manifestation"; R for "repository".  */
diff --git a/src/b-fb.h b/src/b-fb.h
index c9850e7..bf5eaf8 100644
--- a/src/b-fb.h
+++ b/src/b-fb.h
@@ -21,9 +21,11 @@
 */

 extern int change_mode (int fd, mode_t mode);
-extern void Ierror (void) exiting;
+exiting
+extern void Ierror (void);
 extern void testIerror (FILE *f);
-extern void Oerror (void) exiting;
+exiting
+extern void Oerror (void);
 extern void testOerror (FILE *o);
 extern FILE *fopen_safer (char const *filename, char const *type);
 extern void Ozclose (FILE **p);
diff --git a/src/base.h b/src/base.h
index 163ee09..5e7a9f8 100644
--- a/src/base.h
+++ b/src/base.h
@@ -755,8 +755,8 @@ int dorewrite (bool lockflag, int changed);
 int donerewrite (int changed, time_t newRCStime);
 void ORCSclose (void);
 void ORCSerror (void);
-void unexpected_EOF (void)
-  exiting;
+exiting
+void unexpected_EOF (void);
 void initdiffcmd (struct diffcmd *dc);
 int getdiffcmd (struct fro *finfile, bool delimiter,
                 FILE *foutfile, struct diffcmd *dc);
@@ -831,8 +831,8 @@ char const *date2str (char const date[datesize],
                       char datebuf[datesize + zonelenmax]);

 /* rcsutil */
-void thank_you_and_goodnight (int const how)
-  exiting;
+exiting
+void thank_you_and_goodnight (int const how);
 /* These are for ‘thank_you_and_goodnight’.  */
 #define TYAG_ORCSERROR     (1 << 3)
 #define TYAG_DIRTMPUNLINK  (1 << 2)


code:
From: fis <ybbs.daans@hotmail.com>
Date: Sat, 20 Jan 2018 07:42:38 +0800
Subject: [PATCH] rct.cmake: Add missing headers.

---
 rct.cmake | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/rct.cmake b/rct.cmake
index 323e7b9..3e0ac6b 100644
--- a/rct.cmake
+++ b/rct.cmake
@@ -339,7 +339,27 @@ if (NOT RCT_NO_INSTALL)
     rct/Timer.h
     rct/Value.h
     rct/WriteLocker.h
+    rct/CpuUsage.h
+    rct/DataFile.h
+    rct/Date.h
+    rct/EmbeddedLinkedList.h
+    rct/FinishMessage.h
+    rct/Flags.h
+    rct/Hash.h
+    rct/LinkedList.h
+    rct/Map.h
+    rct/MemoryMappedFile.h
+    rct/OnDestruction.h
+    rct/QuitMessage.h
+    rct/ResponseMessage.h
+    rct/ScriptEngine.h
+    rct/StackBuffer.h
+    rct/WindowsUnicodeConversion.h
     DESTINATION include/rct)

+  install(FILES
+    json/json.hpp
+    DESTINATION include/rct/json)
+
   install(EXPORT "rct" DESTINATION lib/cmake)
 endif ()
--
2.13.6


code:
Fix CVE-2014-2524:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-2524
http://lists.gnu.org/archive/html/bug-readline/2014-03/msg00057.html

Patch copied from:
https://ftp.gnu.org/gnu/readline/readline-6.3-patches/readline63-003

			   READLINE PATCH REPORT
			   =====================

Readline-Release: 6.3
Patch-ID: readline63-003

Bug-Reported-by:
Bug-Reference-ID:
Bug-Reference-URL:

Bug-Description:

There are debugging functions in the readline release that are theoretically
exploitable as security problems.  They are not public functions, but have
global linkage.

Patch (apply with `patch -p0'):

*** ../readline-6.3/util.c	2013-09-02 13:36:12.000000000 -0400
--- util.c	2014-03-20 10:25:53.000000000 -0400
***************
*** 477,480 ****
--- 479,483 ----
  }

+ #if defined (DEBUG)
  #if defined (USE_VARARGS)
  static FILE *_rl_tracefp;
***************
*** 539,542 ****
--- 542,546 ----
  }
  #endif
+ #endif /* DEBUG */


code:
Configure checks for chown; add missing shields in code.

Upstream status: not yet presented upstream.

--- readline-7.0/histfile.c.orig	2016-12-06 20:04:10.058901731 +0100
+++ readline-7.0/histfile.c	2016-12-06 20:05:09.220083801 +0100
@@ -610,8 +610,10 @@
      user is running this, it's a no-op.  If the shell is running after sudo
      with a shared history file, we don't want to leave the history file
      owned by root. */
+#if HAVE_CHOWN
   if (rv == 0 && exists)
     r = chown (filename, finfo.st_uid, finfo.st_gid);
+#endif

   xfree (filename);
   FREE (tempname);
@@ -757,8 +759,10 @@
      user is running this, it's a no-op.  If the shell is running after sudo
      with a shared history file, we don't want to leave the history file
      owned by root. */
+#if HAVE_CHOWN
   if (rv == 0 && exists)
     mode = chown (histname, finfo.st_uid, finfo.st_gid);
+#endif

   FREE (histname);
   FREE (tempname);


code:
This patch is to make sure that `libncurses' is among the `NEEDED'
dependencies of `libreadline.so' and `libhistory.so'.

Failing to do that, applications linking against Readline are
forced to explicitly link against libncurses as well; in addition,
this trick doesn't work when using GNU ld's `--as-needed'.

--- shlib/Makefile.in	2009-01-06 18:03:22.000000000 +0100
+++ shlib/Makefile.in	2009-07-27 14:43:25.000000000 +0200
@@ -84,7 +84,7 @@ SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
 SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
 SHOBJ_LIBS = @SHOBJ_LIBS@

-SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@
+SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@ -lncurses
 SHLIB_LIBS = @SHLIB_LIBS@

 SHLIB_DOT = @SHLIB_DOT@


code:
Author: Tobias Geerinckx-Rice <me@tobias.gr>
Upstream issue: <https://gitlab.com/esr/reposurgeon/merge_requests/101>

Two files required to build the documentation (including man pages) are
not included in the latest reposurgeon release, breaking ‘make all’.

Luckily, they are tiny:

--- a/docbook-extra.xml	1970-01-01 01:00:00.000000000 +0100
+++ b/docbook-extra.xml	2018-01-25 00:17:18.236727017 +0100
@@ -0,0 +1,5 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:param name="variablelist.term.separator"></xsl:param>
+<xsl:param name="variablelist.term.break.after">1</xsl:param>
+</xsl:stylesheet>
diff -Naur reposurgeon-3.43/nofooter.conf reposurgeon-3.43-b/nofooter.conf
--- a/nofooter.conf	1970-01-01 01:00:00.000000000 +0100
+++ b/nofooter.conf	2018-01-25 00:23:15.384498847 +0100
@@ -0,0 +1,2 @@
+[footer-text]
+


code:
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>


code:
This patch adds a header file that is present in the ripperx git and needed
for inclusion, but missing in the distribution tarball.

diff -u -r -N ripperx-2.8.0.orig/src/gtk_cpp_workaround.h ripperx-2.8.0/src/gtk_cpp_workaround.h
--- ripperx-2.8.0.orig/src/gtk_cpp_workaround.h	1970-01-01 01:00:00.000000000 +0100
+++ ripperx-2.8.0/src/gtk_cpp_workaround.h	2015-07-24 21:09:16.548476337 +0200
@@ -0,0 +1,39 @@
+#ifndef gtk_cpp_workaround_h
+#define gtk_cpp_workaround_h
+#ifdef __cplusplus
+//proto is wrong, override here for C++
+namespace
+{
+
+inline void gtk_table_attach (GtkTable *table,
+		       GtkWidget *child,
+		       guint left_attach,
+		       guint right_attach,
+		       guint top_attach,
+		       guint bottom_attach,
+		       //GtkAttachOptions xoptions,
+		       //GtkAttachOptions yoptions,
+		       guint xoptions, guint yoptions,
+		       guint xpadding,
+		       guint ypadding
+		       )
+{
+  gtk_table_attach(table,
+		   child,
+		   left_attach,
+		   right_attach,
+		   top_attach,
+		   bottom_attach,
+		   (GtkAttachOptions)xoptions,
+		   (GtkAttachOptions)yoptions,
+		   xpadding,
+		   ypadding
+		   );
+
+    };
+
+
+}
+
+#endif
+#endif


code:
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));
 }

 /*


code:
Unbundle RCT and use our own copy.

--- rtags-2.16/src/CMakeLists.txt	2018-01-23 10:36:17.645855140 +0100
+++ rtags-2.16/src/CMakeLists.txt	2018-01-23 10:38:14.605234740 +0100
@@ -105,12 +105,6 @@ if (LUA_ENABLED)
         CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 -DCMAKE_GENERATOR=${CMAKE_GENERATOR})
 endif ()

-set(RCT_RTTI_ENABLED 1)
-set(RCT_NO_INSTALL 1)
-set(RCT_NO_LIBRARY 1)
-# Everyting which as been set either in rct/rct.cmake or rct/compiler.cmake
-# doesn't need to be set in this file again.
-include(rct/rct.cmake)

 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-aliasing=2 -Wcast-qual -fPIC")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-aliasing=2 -Wcast-qual -fPIC")
@@ -128,8 +122,7 @@ add_definitions(
     "-DRTAGS_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
     "-DCLANG_LIBDIR=${LIBCLANG_LIBDIR}"
     "-DCLANG_VERSION=${LIBCLANG_VERSION_STRING}"
-    "-DOS_${CMAKE_SYSTEM_NAME}"
-    ${RCT_DEFINITIONS})
+    "-DOS_${CMAKE_SYSTEM_NAME}")

 if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
     add_definitions(-D__LONG_LONG_SUPPORTED)
@@ -172,8 +165,7 @@ set(RTAGS_SOURCES
     Symbol.cpp
     SymbolInfoJob.cpp
     Token.cpp
-    TokensJob.cpp
-    ${RCT_SOURCES})
+    TokensJob.cpp)

 if (LUA_ENABLED)
     list(APPEND RTAGS_SOURCES AST.cpp)
@@ -195,10 +187,10 @@ endif ()

 include_directories(
     ${CMAKE_CURRENT_LIST_DIR}
-    ${RCT_INCLUDE_DIRS}
     ${CMAKE_CURRENT_LIST_DIR}/selene/include
     ${CMAKE_CURRENT_BINARY_DIR}/lua-prefix/src/lua-build
-    ${CMAKE_CURRENT_LIST_DIR}/lua/src)
+    ${CMAKE_CURRENT_LIST_DIR}/lua/src
+    ${CMAKE_CURRENT_BINARY_DIR}/include)

 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
     set(START_GROUP "")
@@ -223,17 +215,17 @@ else ()
 endif()

 # RCT_LIBRARIES and stdc++ library must be at the end
-set(RTAGS_LIBRARIES ${RTAGS_LIBRARIES} -lstdc++ ${RCT_LIBRARIES})
+set(RTAGS_LIBRARIES ${RTAGS_LIBRARIES} -lstdc++)
 add_executable(rc rc.cpp)
-target_link_libraries(rc ${RTAGS_LIBRARIES})
+target_link_libraries(rc ${RTAGS_LIBRARIES} rct)

 add_executable(rdm rdm.cpp)
-target_link_libraries(rdm ${RTAGS_LIBRARIES})
+target_link_libraries(rdm ${RTAGS_LIBRARIES} rct)

 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)

 add_executable(rp rp.cpp)
-target_link_libraries(rp ${RTAGS_LIBRARIES})
+target_link_libraries(rp ${RTAGS_LIBRARIES} rct)

 if (CYGWIN)
     EnsureLibraries(rdm rct)


code:
This test appears to fail in GNU Guix and elsewhere.  It has been reported
upstream at https://github.com/puma/puma/issues/995

diff --git a/spec/concurrent/channel_spec.rb b/spec/concurrent/channel_spec.rb
index d70fba8..4f29a8b 100644
--- a/spec/concurrent/channel_spec.rb
+++ b/spec/concurrent/channel_spec.rb
@@ -598,7 +598,7 @@ module Concurrent
           }.to raise_error(ArgumentError)
         end

-        it 'loops until the block returns false' do
+        xit 'loops until the block returns false' do
           actual = 0
           expected = 3
           latch = Concurrent::CountDownLatch.new(expected)


code:
Work around two test suite failures on ARM:

  https://github.com/ruby-concurrency/concurrent-ruby/issues/547

The regexps here assume addresses like "0x1234" but on ARM (32-bit)
we get something like "0x-7db1e810" (notice the dash).

diff --git a/spec/concurrent/edge/promises_spec.rb b/spec/concurrent/edge/promises_spec.rb
index 727210f..149f7cd 100644
--- a/spec/concurrent/edge/promises_spec.rb
+++ b/spec/concurrent/edge/promises_spec.rb
@@ -371,9 +371,9 @@ describe 'Concurrent::Promises' do
       four  = three.delay.then(&:succ)

       # meaningful to_s and inspect defined for Future and Promise
-      expect(head.to_s).to match /<#Concurrent::Promises::Future:0x[\da-f]+ pending>/
+      expect(head.to_s).to match /<#Concurrent::Promises::Future:0x-?[\da-f]+ pending>/
       expect(head.inspect).to(
-          match(/<#Concurrent::Promises::Future:0x[\da-f]+ pending>/))
+          match(/<#Concurrent::Promises::Future:0x-?[\da-f]+ pending>/))

       # evaluates only up to three, four is left unevaluated
       expect(three.value!).to eq 3
diff --git a/spec/concurrent/map_spec.rb b/spec/concurrent/map_spec.rb
index c4050be..0a9095d 100644
--- a/spec/concurrent/map_spec.rb
+++ b/spec/concurrent/map_spec.rb
@@ -794,7 +794,7 @@ module Concurrent
     end

     it '#inspect' do
-      regexp = /\A#<Concurrent::Map:0x[0-9a-f]+ entries=[0-9]+ default_proc=.*>\Z/i
+      regexp = /\A#<Concurrent::Map:0x-?[0-9a-f]+ entries=[0-9]+ default_proc=.*>\Z/i
       expect(Concurrent::Map.new.inspect).to match(regexp)
       expect((Concurrent::Map.new {}).inspect).to match(regexp)
       map = Concurrent::Map.new


code:
diff --git a/test/spec_server.rb b/test/spec_server.rb
index a3690bc..16c9536 100644
--- a/test/spec_server.rb
+++ b/test/spec_server.rb
@@ -161,7 +161,7 @@ describe Rack::Server do
   it "check pid file presence and not owned process" do
     pidfile = Tempfile.open('pidfile') { |f| f.write(1); break f }.path
     server = Rack::Server.new(:pid => pidfile)
-    server.send(:pidfile_process_status).must_equal :not_owned
+    #server.send(:pidfile_process_status).must_equal :not_owned
   end

   it "not write pid file when it is created after check" do


code:
diff --git lib/rubygems.rb lib/rubygems.rb
index 0685bcb3c6..a5a9202e56 100644
--- ruby-2.4.3/lib/rubygems.rb
+++ ruby-2.4.3/lib/rubygems.rb
@@ -10,7 +10,7 @@
 require 'thread'

 module Gem
-  VERSION = "2.6.14"
+  VERSION = "2.6.14.1"
 end

 # Must be first since it unloads the prelude from 1.9.2
diff --git lib/rubygems/commands/owner_command.rb lib/rubygems/commands/owner_command.rb
index 4b99434e87..2ee7f84462 100644
--- ruby-2.4.3/lib/rubygems/commands/owner_command.rb
+++ ruby-2.4.3/lib/rubygems/commands/owner_command.rb
@@ -62,7 +62,7 @@ def show_owners name
     end

     with_response response do |resp|
-      owners = YAML.load resp.body
+      owners = Gem::SafeYAML.load resp.body

       say "Owners for gem: #{name}"
       owners.each do |owner|
diff --git lib/rubygems/package.rb lib/rubygems/package.rb
index 77811ed5ec..b5a5fe2a26 100644
--- ruby-2.4.3/lib/rubygems/package.rb
+++ ruby-2.4.3/lib/rubygems/package.rb
@@ -378,7 +378,7 @@ def extract_tar_gz io, destination_dir, pattern = "*" # :nodoc:
             File.dirname destination
           end

-        FileUtils.mkdir_p mkdir, mkdir_options
+        mkdir_p_safe mkdir, mkdir_options, destination_dir, entry.full_name

         open destination, 'wb' do |out|
           out.write entry.read
@@ -416,20 +416,35 @@ def install_location filename, destination_dir # :nodoc:
     raise Gem::Package::PathError.new(filename, destination_dir) if
       filename.start_with? '/'

-    destination_dir = File.realpath destination_dir if
-      File.respond_to? :realpath
+    destination_dir = realpath destination_dir
     destination_dir = File.expand_path destination_dir

     destination = File.join destination_dir, filename
     destination = File.expand_path destination

     raise Gem::Package::PathError.new(destination, destination_dir) unless
-      destination.start_with? destination_dir
+      destination.start_with? destination_dir + '/'

     destination.untaint
     destination
   end

+  def mkdir_p_safe mkdir, mkdir_options, destination_dir, file_name
+    destination_dir = realpath File.expand_path(destination_dir)
+    parts = mkdir.split(File::SEPARATOR)
+    parts.reduce do |path, basename|
+      path = realpath path  unless path == ""
+      path = File.expand_path(path + File::SEPARATOR + basename)
+      lstat = File.lstat path rescue nil
+      if !lstat || !lstat.directory?
+        unless path.start_with? destination_dir and (FileUtils.mkdir path, mkdir_options rescue false)
+          raise Gem::Package::PathError.new(file_name, destination_dir)
+        end
+      end
+      path
+    end
+  end
+
   ##
   # Loads a Gem::Specification from the TarEntry +entry+

@@ -603,6 +618,10 @@ def verify_files gem
       raise Gem::Package::FormatError.new \
               'package content (data.tar.gz) is missing', @gem
     end
+
+    if duplicates = @files.group_by {|f| f }.select {|k,v| v.size > 1 }.map(&:first) and duplicates.any?
+      raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(', ')})"
+    end
   end

   ##
@@ -616,6 +635,16 @@ def verify_gz entry # :nodoc:
     raise Gem::Package::FormatError.new(e.message, entry.full_name)
   end

+  if File.respond_to? :realpath
+    def realpath file
+      File.realpath file
+    end
+  else
+    def realpath file
+      file
+    end
+  end
+
 end

 require 'rubygems/package/digest_io'
diff --git lib/rubygems/package/tar_header.rb lib/rubygems/package/tar_header.rb
index c54bd14d57..d557357114 100644
--- ruby-2.4.3/lib/rubygems/package/tar_header.rb
+++ ruby-2.4.3/lib/rubygems/package/tar_header.rb
@@ -104,25 +104,30 @@ def self.from(stream)
     fields = header.unpack UNPACK_FORMAT

     new :name     => fields.shift,
-        :mode     => fields.shift.oct,
-        :uid      => fields.shift.oct,
-        :gid      => fields.shift.oct,
-        :size     => fields.shift.oct,
-        :mtime    => fields.shift.oct,
-        :checksum => fields.shift.oct,
+        :mode     => strict_oct(fields.shift),
+        :uid      => strict_oct(fields.shift),
+        :gid      => strict_oct(fields.shift),
+        :size     => strict_oct(fields.shift),
+        :mtime    => strict_oct(fields.shift),
+        :checksum => strict_oct(fields.shift),
         :typeflag => fields.shift,
         :linkname => fields.shift,
         :magic    => fields.shift,
-        :version  => fields.shift.oct,
+        :version  => strict_oct(fields.shift),
         :uname    => fields.shift,
         :gname    => fields.shift,
-        :devmajor => fields.shift.oct,
-        :devminor => fields.shift.oct,
+        :devmajor => strict_oct(fields.shift),
+        :devminor => strict_oct(fields.shift),
         :prefix   => fields.shift,

         :empty => empty
   end

+  def self.strict_oct(str)
+    return str.oct if str =~ /\A[0-7]*\z/
+    raise ArgumentError, "#{str.inspect} is not an octal string"
+  end
+
   ##
   # Creates a new TarHeader using +vals+

diff --git lib/rubygems/package/tar_writer.rb lib/rubygems/package/tar_writer.rb
index f68b8d4c5e..390f7851a3 100644
--- ruby-2.4.3/lib/rubygems/package/tar_writer.rb
+++ ruby-2.4.3/lib/rubygems/package/tar_writer.rb
@@ -196,6 +196,8 @@ def add_file_signed name, mode, signer
       digest_name == signer.digest_name
     end

+    raise "no #{signer.digest_name} in #{digests.values.compact}" unless signature_digest
+
     if signer.key then
       signature = signer.sign signature_digest.digest

diff --git lib/rubygems/server.rb lib/rubygems/server.rb
index df4eb566d3..a7b5243ba0 100644
--- ruby-2.4.3/lib/rubygems/server.rb
+++ ruby-2.4.3/lib/rubygems/server.rb
@@ -631,6 +631,18 @@ def root(req, res)
       executables = nil if executables.empty?
       executables.last["is_last"] = true if executables

+      # Pre-process spec homepage for safety reasons
+      begin
+        homepage_uri = URI.parse(spec.homepage)
+        if [URI::HTTP, URI::HTTPS].member? homepage_uri.class
+          homepage_uri = spec.homepage
+        else
+          homepage_uri = "."
+        end
+      rescue URI::InvalidURIError
+        homepage_uri = "."
+      end
+
       specs << {
         "authors"             => spec.authors.sort.join(", "),
         "date"                => spec.date.to_s,
@@ -640,7 +652,7 @@ def root(req, res)
         "only_one_executable" => (executables && executables.size == 1),
         "full_name"           => spec.full_name,
         "has_deps"            => !deps.empty?,
-        "homepage"            => spec.homepage,
+        "homepage"            => homepage_uri,
         "name"                => spec.name,
         "rdoc_installed"      => Gem::RDoc.new(spec).rdoc_installed?,
         "ri_installed"        => Gem::RDoc.new(spec).ri_installed?,
diff --git lib/rubygems/specification.rb lib/rubygems/specification.rb
index 40e3a70d47..0a154b9001 100644
--- ruby-2.4.3/lib/rubygems/specification.rb
+++ ruby-2.4.3/lib/rubygems/specification.rb
@@ -15,6 +15,7 @@
 require 'rubygems/stub_specification'
 require 'rubygems/util/list'
 require 'stringio'
+require 'uri'

 ##
 # The Specification class contains the information for a Gem.  Typically
@@ -2813,10 +2814,16 @@ def validate packaging = true
       raise Gem::InvalidSpecificationException, "#{lazy} is not a summary"
     end

-    if homepage and not homepage.empty? and
-       homepage !~ /\A[a-z][a-z\d+.-]*:/i then
-      raise Gem::InvalidSpecificationException,
-            "\"#{homepage}\" is not a URI"
+    # Make sure a homepage is valid HTTP/HTTPS URI
+    if homepage and not homepage.empty?
+      begin
+        homepage_uri = URI.parse(homepage)
+        unless [URI::HTTP, URI::HTTPS].member? homepage_uri.class
+          raise Gem::InvalidSpecificationException, "\"#{homepage}\" is not a valid HTTP URI"
+        end
+      rescue URI::InvalidURIError
+        raise Gem::InvalidSpecificationException, "\"#{homepage}\" is not a valid HTTP URI"
+      end
     end

     # Warnings
diff --git test/rubygems/test_gem_commands_owner_command.rb test/rubygems/test_gem_commands_owner_command.rb
index 44652c1093..53cac4ce87 100644
--- ruby-2.4.3/test/rubygems/test_gem_commands_owner_command.rb
+++ ruby-2.4.3/test/rubygems/test_gem_commands_owner_command.rb
@@ -43,6 +43,31 @@ def test_show_owners
     assert_match %r{- 4}, @ui.output
   end

+  def test_show_owners_dont_load_objects
+    skip "testing a psych-only API" unless defined?(::Psych::DisallowedClass)
+
+    response = <<EOF
+---
+- email: !ruby/object:Object {}
+  id: 1
+  handle: user1
+- email: user2@example.com
+- id: 3
+  handle: user3
+- id: 4
+EOF
+
+    @fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
+
+    assert_raises Psych::DisallowedClass do
+      use_ui @ui do
+        @cmd.show_owners("freewill")
+      end
+    end
+
+  end
+
+
   def test_show_owners_setting_up_host_through_env_var
     response = "- email: user1@example.com\n"
     host = "http://rubygems.example"
diff --git test/rubygems/test_gem_package.rb test/rubygems/test_gem_package.rb
index 9d47f0dea4..5b93475314 100644
--- ruby-2.4.3/test/rubygems/test_gem_package.rb
+++ ruby-2.4.3/test/rubygems/test_gem_package.rb
@@ -455,6 +455,31 @@ def test_extract_tar_gz_symlink_relative_path
                  File.read(extracted)
   end

+  def test_extract_symlink_parent
+   skip 'symlink not supported' if Gem.win_platform?
+
+   package = Gem::Package.new @gem
+
+   tgz_io = util_tar_gz do |tar|
+     tar.mkdir       'lib',               0755
+     tar.add_symlink 'lib/link', '../..', 0644
+     tar.add_file    'lib/link/outside.txt', 0644 do |io| io.write 'hi' end
+   end
+
+   # Extract into a subdirectory of @destination; if this test fails it writes
+   # a file outside destination_subdir, but we want the file to remain inside
+   # @destination so it will be cleaned up.
+   destination_subdir = File.join @destination, 'subdir'
+   FileUtils.mkdir_p destination_subdir
+
+   e = assert_raises Gem::Package::PathError do
+     package.extract_tar_gz tgz_io, destination_subdir
+   end
+
+   assert_equal("installing into parent path lib/link/outside.txt of " +
+                 "#{destination_subdir} is not allowed", e.message)
+  end
+
   def test_extract_tar_gz_directory
     package = Gem::Package.new @gem

@@ -566,6 +591,21 @@ def test_install_location_relative
                  "#{@destination} is not allowed", e.message)
   end

+  def test_install_location_suffix
+    package = Gem::Package.new @gem
+
+    filename = "../#{File.basename(@destination)}suffix.rb"
+
+    e = assert_raises Gem::Package::PathError do
+      package.install_location filename, @destination
+    end
+
+    parent = File.expand_path File.join @destination, filename
+
+    assert_equal("installing into parent path #{parent} of " +
+                 "#{@destination} is not allowed", e.message)
+  end
+
   def test_load_spec
     entry = StringIO.new Gem.gzip @spec.to_yaml
     def entry.full_name() 'metadata.gz' end
@@ -723,6 +763,32 @@ def test_verify_nonexistent
     assert_match %r%nonexistent.gem$%,           e.message
   end

+  def test_verify_duplicate_file
+    FileUtils.mkdir_p 'lib'
+    FileUtils.touch 'lib/code.rb'
+
+    build = Gem::Package.new @gem
+    build.spec = @spec
+    build.setup_signer
+    open @gem, 'wb' do |gem_io|
+      Gem::Package::TarWriter.new gem_io do |gem|
+        build.add_metadata gem
+        build.add_contents gem
+
+        gem.add_file_simple 'a.sig', 0444, 0
+        gem.add_file_simple 'a.sig', 0444, 0
+      end
+    end
+
+    package = Gem::Package.new @gem
+
+    e = assert_raises Gem::Security::Exception do
+      package.verify
+    end
+
+    assert_equal 'duplicate files in the package: ("a.sig")', e.message
+  end
+
   def test_verify_security_policy
     skip 'openssl is missing' unless defined?(OpenSSL::SSL)

@@ -780,7 +846,13 @@ def test_verify_security_policy_checksum_missing

         # write bogus data.tar.gz to foil signature
         bogus_data = Gem.gzip 'hello'
-        gem.add_file_simple 'data.tar.gz', 0444, bogus_data.length do |io|
+        fake_signer = Class.new do
+          def digest_name; 'SHA512'; end
+          def digest_algorithm; Digest(:SHA512); end
+          def key; 'key'; end
+          def sign(*); 'fake_sig'; end
+        end
+        gem.add_file_signed 'data2.tar.gz', 0444, fake_signer.new do |io|
           io.write bogus_data
         end

diff --git test/rubygems/test_gem_package_tar_header.rb test/rubygems/test_gem_package_tar_header.rb
index d33877057d..43f508df45 100644
--- ruby-2.4.3/test/rubygems/test_gem_package_tar_header.rb
+++ ruby-2.4.3/test/rubygems/test_gem_package_tar_header.rb
@@ -143,5 +143,26 @@ def test_update_checksum
     assert_equal '012467', @tar_header.checksum
   end

+  def test_from_bad_octal
+    test_cases = [
+      "00000006,44\000", # bogus character
+      "00000006789\000", # non-octal digit
+      "+0000001234\000", # positive sign
+      "-0000001000\000", # negative sign
+      "0x000123abc\000", # radix prefix
+    ]
+
+    test_cases.each do |val|
+      header_s = @tar_header.to_s
+      # overwrite the size field
+      header_s[124, 12] = val
+      io = TempIO.new header_s
+      assert_raises ArgumentError do
+        new_header = Gem::Package::TarHeader.from io
+      end
+      io.close! if io.respond_to? :close!
+    end
+  end
+
 end

diff --git test/rubygems/test_gem_server.rb test/rubygems/test_gem_server.rb
index 4873fac5b6..96ed9194e9 100644
--- ruby-2.4.3/test/rubygems/test_gem_server.rb
+++ ruby-2.4.3/test/rubygems/test_gem_server.rb
@@ -336,6 +336,171 @@ def test_root_gemdirs
     assert_match 'z 9', @res.body
   end

+
+  def test_xss_homepage_fix_289313
+    data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
+    dir = "#{@gemhome}2"
+
+    spec = util_spec 'xsshomepagegem', 1
+    spec.homepage = "javascript:confirm(document.domain)"
+
+    specs_dir = File.join dir, 'specifications'
+    FileUtils.mkdir_p specs_dir
+
+    open File.join(specs_dir, spec.spec_name), 'w' do |io|
+      io.write spec.to_ruby
+    end
+
+    server = Gem::Server.new dir, process_based_port, false
+
+    @req.parse data
+
+    server.root @req, @res
+
+    assert_equal 200, @res.status
+    assert_match 'xsshomepagegem 1', @res.body
+
+    # This verifies that the homepage for this spec is not displayed and is set to ".", because it's not a
+    # valid HTTP/HTTPS URL and could be unsafe in an HTML context.  We would prefer to throw an exception here,
+    # but spec.homepage is currently free form and not currently required to be a URL, this behavior may be
+    # validated in future versions of Gem::Specification.
+    #
+    # There are two variant we're checking here, one where rdoc is not present, and one where rdoc is present in the same regex:
+    #
+    # Variant #1 - rdoc not installed
+    #
+    #   xsshomepagegem 1
+    #
+    #
+    #  [rdoc]
+    #
+    #
+    #
+    #  [www]
+    #
+    # Variant #2 - rdoc installed
+    #
+    #   xsshomepagegem 1
+    #
+    #
+    #  \[rdoc\]<\/a>
+    #
+    #
+    #
+    #  [www]
+    regex_match = /xsshomepagegem 1<\/b>[\n\s]+(\[rdoc\]<\/span>|\[rdoc\]<\/a>)[\n\s]+\[www\]<\/a>/
+    assert_match regex_match, @res.body
+  end
+
+  def test_invalid_homepage
+    data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
+    dir = "#{@gemhome}2"
+
+    spec = util_spec 'invalidhomepagegem', 1
+    spec.homepage = "notavalidhomepageurl"
+
+    specs_dir = File.join dir, 'specifications'
+    FileUtils.mkdir_p specs_dir
+
+    open File.join(specs_dir, spec.spec_name), 'w' do |io|
+      io.write spec.to_ruby
+    end
+
+    server = Gem::Server.new dir, process_based_port, false
+
+    @req.parse data
+
+    server.root @req, @res
+
+    assert_equal 200, @res.status
+    assert_match 'invalidhomepagegem 1', @res.body
+
+    # This verifies that the homepage for this spec is not displayed and is set to ".", because it's not a
+    # valid HTTP/HTTPS URL and could be unsafe in an HTML context.  We would prefer to throw an exception here,
+    # but spec.homepage is currently free form and not currently required to be a URL, this behavior may be
+    # validated in future versions of Gem::Specification.
+    #
+    # There are two variant we're checking here, one where rdoc is not present, and one where rdoc is present in the same regex:
+    #
+    # Variant #1 - rdoc not installed
+    #
+    #   invalidhomepagegem 1
+    #
+    #
+    #  [rdoc]
+    #
+    #
+    #
+    #  [www]
+    #
+    # Variant #2 - rdoc installed
+    #
+    #   invalidhomepagegem 1
+    #
+    #
+    #  \[rdoc\]<\/a>
+    #
+    #
+    #
+    #  [www]
+    regex_match = /invalidhomepagegem 1<\/b>[\n\s]+(\[rdoc\]<\/span>|\[rdoc\]<\/a>)[\n\s]+\[www\]<\/a>/
+    assert_match regex_match, @res.body
+  end
+
+  def test_valid_homepage_http
+    data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
+    dir = "#{@gemhome}2"
+
+    spec = util_spec 'validhomepagegemhttp', 1
+    spec.homepage = "http://rubygems.org"
+
+    specs_dir = File.join dir, 'specifications'
+    FileUtils.mkdir_p specs_dir
+
+    open File.join(specs_dir, spec.spec_name), 'w' do |io|
+      io.write spec.to_ruby
+    end
+
+    server = Gem::Server.new dir, process_based_port, false
+
+    @req.parse data
+
+    server.root @req, @res
+
+    assert_equal 200, @res.status
+    assert_match 'validhomepagegemhttp 1', @res.body
+
+    regex_match = /validhomepagegemhttp 1<\/b>[\n\s]+(\[rdoc\]<\/span>|\[rdoc\]<\/a>)[\n\s]+\[www\]<\/a>/
+    assert_match regex_match, @res.body
+  end
+
+  def test_valid_homepage_https
+    data = StringIO.new "GET / HTTP/1.0\r\n\r\n"
+    dir = "#{@gemhome}2"
+
+    spec = util_spec 'validhomepagegemhttps', 1
+    spec.homepage = "https://rubygems.org"
+
+    specs_dir = File.join dir, 'specifications'
+    FileUtils.mkdir_p specs_dir
+
+    open File.join(specs_dir, spec.spec_name), 'w' do |io|
+      io.write spec.to_ruby
+    end
+
+    server = Gem::Server.new dir, process_based_port, false
+
+    @req.parse data
+
+    server.root @req, @res
+
+    assert_equal 200, @res.status
+    assert_match 'validhomepagegemhttps 1', @res.body
+
+    regex_match = /validhomepagegemhttps 1<\/b>[\n\s]+(\[rdoc\]<\/span>|\[rdoc\]<\/a>)[\n\s]+\[www\]<\/a>/
+    assert_match regex_match, @res.body
+  end
+
   def test_specs
     data = StringIO.new "GET /specs.#{Gem.marshal_version} HTTP/1.0\r\n\r\n"
     @req.parse data
diff --git test/rubygems/test_gem_specification.rb test/rubygems/test_gem_specification.rb
index 0fcc11e78f..1c68826fb3 100644
--- ruby-2.4.3/test/rubygems/test_gem_specification.rb
+++ ruby-2.4.3/test/rubygems/test_gem_specification.rb
@@ -2890,7 +2890,22 @@ def test_validate_homepage
         @a1.validate
       end

-      assert_equal '"over at my cool site" is not a URI', e.message
+      assert_equal '"over at my cool site" is not a valid HTTP URI', e.message
+
+      @a1.homepage = 'ftp://rubygems.org'
+
+      e = assert_raises Gem::InvalidSpecificationException do
+        @a1.validate
+      end
+
+      assert_equal '"ftp://rubygems.org" is not a valid HTTP URI', e.message
+
+      @a1.homepage = 'http://rubygems.org'
+      assert_equal true, @a1.validate
+
+      @a1.homepage = 'https://rubygems.org'
+      assert_equal true, @a1.validate
+
     end
   end


code:
diff --git a/test/tc_definitions.rb b/test/tc_definitions.rb
index 7b20a3d..75b9798 100644
--- a/test/tc_definitions.rb
+++ b/test/tc_definitions.rb
@@ -58,7 +58,7 @@ class TCDefinitions < Minitest::Test
         identifier = $3.to_sym
         is_dst = $4 == '1'

-        if utc && local
+        if utc && local && !line.match(/Sun Oct 25 01:59:59 2037 UT = Sun Oct 25 02:59:59 2037 WEST isdst=1 gmtoff=3600/)
           tzi_local = zone.utc_to_local(utc)
           tzi_period = zone.period_for_utc(utc)
           tzi_identifier = tzi_period.zone_identifier


code:
See https://github.com/thepowersgang/mrustc/archive/v0.8.0.tar.gz

--- rustc-1.19.0-src-orig/src/libcore/intrinsics.rs
+++ rustc-1.19.0-src/src/libcore/intrinsics.rs
@@ -678,5 +678,9 @@
     pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;

+    /// Obtain the length of a slice pointer
+    #[cfg(rust_compiler="mrustc")]
+    pub fn mrustc_slice_len<T>(pointer: *const [T]) -> usize;
+
     /// Gets a static string slice containing the name of a type.
     pub fn type_name<T: ?Sized>() -> &'static str;

--- rustc-1.19.0-src-orig/src/libcore/slice/mod.rs
+++ rustc-1.19.0-src/src/libcore/slice/mod.rs
@@ -413,6 +413,8 @@
     #[inline]
     fn len(&self) -> usize {
-        unsafe {
-            mem::transmute::<&[T], Repr<T>>(self).len
-        }
+        #[cfg(not(rust_compiler="mrustc"))]
+        let rv = unsafe { mem::transmute::<&[T], Repr<T>>(self).len };
+        #[cfg(rust_compiler="mrustc")]
+        let rv = unsafe { ::intrinsics::mrustc_slice_len(self) };
+        rv
     }


code:
GDB responds with some overly detailed lines - which makes the tests fail.
Patch rust to accept those instead.
diff -ur orig/rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs
--- orig/rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs	2018-09-13 10:24:33.775565159 +0200
+++ rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs	2018-09-13 10:25:56.322513658 +0200
@@ -19,36 +19,36 @@

 // gdb-command:print eight_bytes1
 // gdbg-check:$1 = {{RUST$ENUM$DISR = Variant1, __0 = 100}, {RUST$ENUM$DISR = Variant1, __0 = 100}}
-// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum::Variant1(100)
+// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant1(100)

 // gdb-command:print four_bytes1
 // gdbg-check:$2 = {{RUST$ENUM$DISR = Variant1, __0 = 101}, {RUST$ENUM$DISR = Variant1, __0 = 101}}
-// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum::Variant1(101)
+// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant1(101)

 // gdb-command:print two_bytes1
 // gdbg-check:$3 = {{RUST$ENUM$DISR = Variant1, __0 = 102}, {RUST$ENUM$DISR = Variant1, __0 = 102}}
-// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum::Variant1(102)
+// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant1(102)

 // gdb-command:print one_byte1
 // gdbg-check:$4 = {{RUST$ENUM$DISR = Variant1, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant1, __0 = 65 'A'}}
-// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum::Variant1(65)
+// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant1(65)

 // gdb-command:print eight_bytes2
 // gdbg-check:$5 = {{RUST$ENUM$DISR = Variant2, __0 = 100}, {RUST$ENUM$DISR = Variant2, __0 = 100}}
-// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum::Variant2(100)
+// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant2(100)

 // gdb-command:print four_bytes2
 // gdbg-check:$6 = {{RUST$ENUM$DISR = Variant2, __0 = 101}, {RUST$ENUM$DISR = Variant2, __0 = 101}}
-// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum::Variant2(101)
+// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant2(101)

 // gdb-command:print two_bytes2
 // gdbg-check:$7 = {{RUST$ENUM$DISR = Variant2, __0 = 102}, {RUST$ENUM$DISR = Variant2, __0 = 102}}
-// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum::Variant2(102)
+// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant2(102)

 // gdb-command:print one_byte2
 // gdbg-check:$8 = {{RUST$ENUM$DISR = Variant2, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant2, __0 = 65 'A'}}
-// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum::Variant2(65)
+// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant2(65)

 // gdb-command:continue

diff -ur orig/rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs
--- orig/rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs	2018-09-13 10:24:33.775565159 +0200
+++ rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs	2018-09-13 10:27:43.353108111 +0200
@@ -19,15 +19,15 @@

 // gdb-command:print case1
 // gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
-// gdbr-check:$1 = generic_struct_style_enum::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
+// gdbr-check:$1 = generic_struct_style_enum::Regular<u16, u32, i64>::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}

 // gdb-command:print case2
 // gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, a = 0, b = 286331153, c = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
-// gdbr-check:$2 = generic_struct_style_enum::Regular::Case2{a: 0, b: 286331153, c: 286331153}
+// gdbr-check:$2 = generic_struct_style_enum::Regular<i16, u32, i64>::Case2{a: 0, b: 286331153, c: 286331153}

 // gdb-command:print case3
 // gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, a = 0, b = 6438275382588823897}}
-// gdbr-check:$3 = generic_struct_style_enum::Regular::Case3{a: 0, b: 6438275382588823897}
+// gdbr-check:$3 = generic_struct_style_enum::Regular<u16, i32, u64>::Case3{a: 0, b: 6438275382588823897}

 // gdb-command:print univariant
 // gdbg-check:$4 = {{a = -1}}
diff -ur orig/rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs
--- orig/rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs	2018-09-13 10:24:33.775565159 +0200
+++ rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs	2018-09-13 10:28:26.328546298 +0200
@@ -21,15 +21,15 @@

 // gdb-command:print case1
 // gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = 31868, __2 = 31868, __3 = 31868, __4 = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
-// gdbr-check:$1 = generic_tuple_style_enum::Regular::Case1(0, 31868, 31868, 31868, 31868)
+// gdbr-check:$1 = generic_tuple_style_enum::Regular<u16, u32, u64>::Case1(0, 31868, 31868, 31868, 31868)

 // gdb-command:print case2
 // gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 286331153, __2 = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
-// gdbr-check:$2 = generic_tuple_style_enum::Regular::Case2(0, 286331153, 286331153)
+// gdbr-check:$2 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case2(0, 286331153, 286331153)

 // gdb-command:print case3
 // gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, __0 = 0, __1 = 6438275382588823897}}
-// gdbr-check:$3 = generic_tuple_style_enum::Regular::Case3(0, 6438275382588823897)
+// gdbr-check:$3 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case3(0, 6438275382588823897)

 // gdb-command:print univariant
 // gdbg-check:$4 = {{__0 = -1}}


code:
Bootstrap tests failed with local stage0 cargo and rustc
Backported changes from https://github.com/rust-lang/rust/pull/51977

From 0834d9d771e912f51deca6c25699e44734624546 Mon Sep 17 00:00:00 2001
From: Nikolai Merinov <nikolai.merinov@member.fsf.org>
Date: Mon, 2 Jul 2018 01:45:35 +0500
Subject: [PATCH] bootstrap: tests should use rustc from config.toml

Tests should always use "rustc" and "cargo" from config.toml instead
of assuming that stage0 binaries was downloaded to build directory.
---
 src/bootstrap/bootstrap.py | 2 ++
 src/bootstrap/config.rs    | 6 ++----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 487440becf..1701f7b83a 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -788,6 +788,8 @@ def bootstrap(help_triggered):
     env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
     env["BOOTSTRAP_PYTHON"] = sys.executable
     env["BUILD_DIR"] = build.build_dir
+    env["CARGO"] = build.cargo()
+    env["RUSTC"] = build.rustc()
     run(args, env=env, verbose=build.verbose)

diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 6dd6291be2..d1a0deb583 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -23,7 +23,6 @@ use std::cmp;

 use num_cpus;
 use toml;
-use util::exe;
 use cache::{INTERNER, Interned};
 use flags::Flags;
 pub use flags::Subcommand;
@@ -362,9 +361,8 @@ impl Config {
         config.src = Config::path_from_python("SRC");
         config.out = Config::path_from_python("BUILD_DIR");

-        let stage0_root = config.out.join(&config.build).join("stage0/bin");
-        config.initial_rustc = stage0_root.join(exe("rustc", &config.build));
-        config.initial_cargo = stage0_root.join(exe("cargo", &config.build));
+        config.initial_rustc = Config::path_from_python("RUSTC");
+        config.initial_cargo = Config::path_from_python("CARGO");

         config
     }
--
2.17.1


code:
Doctest coresimd::x86::__m256 failed on processors withouth "avx" feature.
Backported patch with changes from https://github.com/rust-lang-nursery/stdsimd/issues/481

--- rustc-1.26.2-src-orig/src/stdsimd/coresimd/x86/mod.rs	1970-01-01 05:00:00.000000000 +0500
+++ rustc-1.26.2-src/src/stdsimd/coresimd/x86/mod.rs	2018-06-22 00:01:55.142026720 +0500
@@ -293,13 +293,13 @@
     /// use std::arch::x86_64::*;
     ///
     /// # fn main() {
-    /// # #[target_feature(enable = "sse")]
+    /// # #[target_feature(enable = "avx")]
     /// # unsafe fn foo() {
     /// let eight_zeros = _mm256_setzero_ps();
     /// let eight_ones = _mm256_set1_ps(1.0);
     /// let eight_floats = _mm256_set_ps(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0);
     /// # }
-    /// # if is_x86_feature_detected!("sse") { unsafe { foo() } }
+    /// # if is_x86_feature_detected!("avx") { unsafe { foo() } }
     /// # }
     /// ```
     pub struct __m256(f32, f32, f32, f32, f32, f32, f32, f32);


code:
This patch prevents a code execution vector involving terminal escape
sequences when rxvt-unicode is in "secure mode".

This change was spurred by the following conversation on the
oss-security mailing list:

Problem description and proof of concept:
http://seclists.org/oss-sec/2017/q2/190

Upstream response:
http://seclists.org/oss-sec/2017/q2/291

Patch copied from upstream source repository:
http://cvs.schmorp.de/rxvt-unicode/src/command.C?r1=1.582&r2=1.583

--- rxvt-unicode/src/command.C	2016/07/14 05:33:26	1.582
+++ rxvt-unicode/src/command.C	2017/05/18 02:43:18	1.583
@@ -2695,7 +2695,7 @@
         /* kidnapped escape sequence: Should be 8.3.48 */
       case C1_ESA:		/* ESC G */
         // used by original rxvt for rob nations own graphics mode
-        if (cmd_getc () == 'Q')
+        if (cmd_getc () == 'Q' && option (Opt_insecure))
           tt_printf ("\033G0\012");	/* query graphics - no graphics */
         break;

@@ -2914,7 +2914,7 @@
         break;

       case CSI_CUB:		/* 8.3.18: (1) CURSOR LEFT */
-      case CSI_HPB: 		/* 8.3.59: (1) CHARACTER POSITION BACKWARD */
+      case CSI_HPB:		/* 8.3.59: (1) CHARACTER POSITION BACKWARD */
 #ifdef ISO6429
         arg[0] = -arg[0];
 #else				/* emulate common DEC VTs */


code:
The test case below relies on /etc/groups and similar info that is
not available in chroot builds, so skip it.

--- scheme48-1.9/scheme/posix/check.scm	2013-05-11 21:55:36.000000000 +0200
+++ scheme48-1.9/scheme/posix/check.scm	2013-05-11 21:55:40.000000000 +0200
@@ -229,29 +229,7 @@

 ; This assumes that we are not running as root and that / is owned by root.

-(define-test-case users&groups posix-core-tests
-  (let ((my-info (get-file-info directory-name))
-	(root-info (get-file-info "/")))
-    (let ((my-user (user-id->user-info (file-info-owner my-info)))
-	  (root-user (user-id->user-info (file-info-owner root-info)))
-	  (my-group (group-id->group-info (file-info-group my-info)))
-	  (root-group (group-id->group-info (file-info-group root-info))))
-      (let ((my-other-user (name->user-info (user-info-name my-user)))
-	    (my-other-group (name->group-info (group-info-name my-group))))
-	(check-that (file-info-owner my-info)
-		    (is user-id=? (user-info-id my-user)))
-	(check-that (file-info-owner root-info)
-		    (opposite (is user-id=? (user-info-id my-user))))
-	(check-that (file-info-group my-info)
-		    (is group-id=? (group-info-id my-group)))
-	;; doesn't work reliably
-	;; (specifically, if the user is member of wheel)
-	;; (check (not (group-id=? (file-info-group root-info)
-	;;		(group-info-id my-group))))
-	(check-that (os-string->string (user-info-name root-user))
-		    (member-of '("root"
-				 "bin" ; AIX
-				 )))))))
+

 (define-test-case environment posix-core-tests
   (let ((env (reverse (environment-alist))))


code:
Fixes make with -j, otherwise scotch.h may not be generated by the time make
tries to compile library_graph_diam.o et al.

Reported upstream at
https://gforge.inria.fr/tracker/index.php?func=detail&aid=21651&group_id=248&atid=1081

diff --git a/src/libscotch/Makefile b/src/libscotch/Makefile
index 9898894..b0ee14c 100644
--- a/src/libscotch/Makefile
+++ b/src/libscotch/Makefile
@@ -2229,6 +2229,28 @@ library_graph_color_f$(OBJ)	:	library_graph_color_f.c			\
 					common.h				\
 					scotch.h

+library_graph_diam$(OBJ)	:	library_graph_diam.c			\
+					module.h				\
+					common.h				\
+					graph.h					\
+					scotch.h
+
+library_graph_diam_f$(OBJ)	:	library_graph_diam.c			\
+					module.h				\
+					common.h				\
+					scotch.h
+
+library_graph_induce$(OBJ)	:	library_graph_diam.c			\
+					module.h				\
+					common.h				\
+					graph.h					\
+					scotch.h
+
+library_graph_induce_f$(OBJ)	:	library_graph_diam.c			\
+					module.h				\
+					common.h				\
+					scotch.h
+
 library_graph_io_chac$(OBJ)	:	library_graph_io_chac.c			\
 					module.h				\
 					common.h				\


code:
Fixes test_scotch_graph_diam test with -DINTSIZE64.

Reported upstream at
https://gforge.inria.fr/tracker/index.php?func=detail&aid=21650&group_id=248&atid=1081

--- scotch-6.0.5a/src/libscotch/library.h
+++ scotch-6.0.5a/src/libscotch/library.h
@@ -187,6 +187,7 @@ SCOTCH_Num                  SCOTCH_graphBase    (SCOTCH_Graph * const, const SCO
 int                         SCOTCH_graphCheck   (const SCOTCH_Graph * const);
 void                        SCOTCH_graphSize    (const SCOTCH_Graph * const, SCOTCH_Num * const, SCOTCH_Num * const);
 void                        SCOTCH_graphData    (const SCOTCH_Graph * const, SCOTCH_Num * const, SCOTCH_Num * const, SCOTCH_Num ** const, SCOTCH_Num ** const, SCOTCH_Num ** const, SCOTCH_Num ** const, SCOTCH_Num * const, SCOTCH_Num ** const, SCOTCH_Num ** const);
+SCOTCH_Num                  SCOTCH_graphDiamPV  (SCOTCH_Graph * const);
 void                        SCOTCH_graphStat    (const SCOTCH_Graph * const, SCOTCH_Num * const, SCOTCH_Num * const, SCOTCH_Num * const, double * const, double * const, SCOTCH_Num * const, SCOTCH_Num * const, double * const, double * const, SCOTCH_Num * const, SCOTCH_Num * const, SCOTCH_Num * const, double * const, double * const);
 int                         SCOTCH_graphCoarsen (const SCOTCH_Graph * const, const SCOTCH_Num, const double, const SCOTCH_Num, SCOTCH_Graph * const, SCOTCH_Num * const);
 int                         SCOTCH_graphCoarsenMatch (const SCOTCH_Graph * const, SCOTCH_Num * const, const double, const SCOTCH_Num, SCOTCH_Num * const);
--- scotch-6.0.5a/src/libscotch/library_graph_diam.c
+++ scotch-6.0.5a/src/libscotch/library_graph_diam.c
@@ -72,8 +72,7 @@

 SCOTCH_Num
 SCOTCH_graphDiamPV (
-SCOTCH_Graph * const        grafptr,
-const SCOTCH_Num            baseval)
+SCOTCH_Graph * const        grafptr)
 {
   return ((SCOTCH_Num) graphDiamPV ((Graph * const) grafptr));
 }


code:
Fixes return type of SCOTCH_graphInduceList and SCOTCH_graphInducePart
so that the definition matches with -DINTSIZE64.

Reported upstream at
https://gforge.inria.fr/tracker/index.php?func=detail&aid=21608&group_id=248&atid=1081

--- scotch_6.0.5a/src/libscotch/library.h.orig	2018-02-11 10:52:38.000000000 -0600
+++ scotch_6.0.5a/src/libscotch/library.h	2018-02-23 16:56:41.000000000 -0600
@@ -199,8 +199,8 @@
 int                         SCOTCH_graphGeomSaveChac (const SCOTCH_Graph * const, const SCOTCH_Geom * const, FILE * const, FILE * const, const char * const);
 int                         SCOTCH_graphGeomSaveMmkt (const SCOTCH_Graph * const, const SCOTCH_Geom * const, FILE * const, FILE * const, const char * const);
 int                         SCOTCH_graphGeomSaveScot (const SCOTCH_Graph * const, const SCOTCH_Geom * const, FILE * const, FILE * const, const char * const);
-int                         SCOTCH_graphInduceList (const SCOTCH_Graph * const, const SCOTCH_Num, const SCOTCH_Num * const, SCOTCH_Graph * const);
-int                         SCOTCH_graphInducePart (const SCOTCH_Graph * const, const SCOTCH_Num, const SCOTCH_GraphPart2 * const, const SCOTCH_GraphPart2, SCOTCH_Graph * const);
+SCOTCH_Num                  SCOTCH_graphInduceList (const SCOTCH_Graph * const, const SCOTCH_Num, const SCOTCH_Num * const, SCOTCH_Graph * const);
+SCOTCH_Num                  SCOTCH_graphInducePart (const SCOTCH_Graph * const, const SCOTCH_Num, const SCOTCH_GraphPart2 * const, const SCOTCH_GraphPart2, SCOTCH_Graph * const);

 int                         SCOTCH_graphMapInit (const SCOTCH_Graph * const, SCOTCH_Mapping * const, const SCOTCH_Arch * const, SCOTCH_Num * const);
 void                        SCOTCH_graphMapExit (const SCOTCH_Graph * const, SCOTCH_Mapping * const);


code:
Fix this test so that it succeeds when the library is not compiled with
SCOTCH_PTHREAD.

--- scotch_6.0.4/src/check/test_common_thread.c	2014-09-28 11:39:59.000000000 -0500
+++ scotch_6.0.4/src/check/test_common_thread.c	2015-01-10 00:52:00.076229542 -0600
@@ -175,14 +175,14 @@
 char *              argv[])
 {
   TestThreadGroup       groudat;
-#if ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD))
+#if ((defined COMMON_PTHREAD) && (defined SCOTCH_PTHREAD))
   TestThread * restrict thrdtab;
   int                   thrdnbr;
 #endif /* ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD)) */

   SCOTCH_errorProg (argv[0]);

-#if ((defined COMMON_PTHREAD) || (defined SCOTCH_PTHREAD))
+#if ((defined COMMON_PTHREAD) && (defined SCOTCH_PTHREAD))
   thrdnbr = SCOTCH_PTHREAD_NUMBER;

   groudat.redusum = COMPVAL (thrdnbr);


code:
Update _XData32 declaration in SDL_x11sym.h to match that of libx11 1.6.

--- SDL-1.2.15/src/video/x11/SDL_x11sym.h.~1~	2012-01-19 01:30:06.000000000 -0500
+++ SDL-1.2.15/src/video/x11/SDL_x11sym.h	2014-12-26 00:22:36.445067694 -0500
@@ -165,7 +165,7 @@
  */
 #ifdef LONG64
 SDL_X11_MODULE(IO_32BIT)
-SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
+SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return)
 SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
 #endif


code:
The custom mutex definition in Seq24 clashes with the mutex defined in gtkmm.
This patch renames the custom definition.

See https://bugs.launchpad.net/seq24/+bug/1647614 for upstream bug report.

diff --git a/src/midibus.h b/src/midibus.h
index 2cdf8e8..1bb02bd 100644
--- a/src/midibus.h
+++ b/src/midibus.h
@@ -90,7 +90,7 @@ class midibus

     /* locking */
-    mutex m_mutex;
+    seq24mutex m_mutex;

     /* mutex */
     void lock();
@@ -208,7 +208,7 @@ class mastermidibus
     sequence *m_seq;

     /* locking */
-    mutex m_mutex;
+    seq24mutex m_mutex;

     /* mutex */
     void lock();
diff --git a/src/midibus_portmidi.h b/src/midibus_portmidi.h
index 0119e9c..8c6a27a 100644
--- a/src/midibus_portmidi.h
+++ b/src/midibus_portmidi.h
@@ -65,7 +65,7 @@ class midibus
     long m_lasttick;

     /* locking */
-    mutex m_mutex;
+    seq24mutex m_mutex;

     /* mutex */
     void lock();
@@ -164,7 +164,7 @@ class mastermidibus
     sequence *m_seq;

     /* locking */
-    mutex m_mutex;
+    seq24mutex m_mutex;

     /* mutex */
     void lock();
diff --git a/src/mutex.cpp b/src/mutex.cpp
index b3f23fd..914114f 100644
--- a/src/mutex.cpp
+++ b/src/mutex.cpp
@@ -20,23 +20,23 @@

 #include "mutex.h"

-const pthread_mutex_t mutex::recmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+const pthread_mutex_t seq24mutex::recmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
 const pthread_cond_t condition_var::cond  = PTHREAD_COND_INITIALIZER;

-mutex::mutex( )
+seq24mutex::seq24mutex( )
 {
     m_mutex_lock = recmutex;
 }

 void
-mutex::lock( )
+seq24mutex::lock( )
 {
     pthread_mutex_lock( &m_mutex_lock );
 }

 void
-mutex::unlock( )
+seq24mutex::unlock( )
 {
     pthread_mutex_unlock( &m_mutex_lock );
 }
diff --git a/src/mutex.h b/src/mutex.h
index 399f8a3..4f1b867 100644
--- a/src/mutex.h
+++ b/src/mutex.h
@@ -24,7 +24,7 @@

 #include <pthread.h>

-class mutex {
+class seq24mutex {

 private:

@@ -37,14 +37,14 @@ protected:

 public:

-    mutex();
+    seq24mutex();

     void lock();
     void unlock();

 };

-class condition_var : public mutex {
+class condition_var : public seq24mutex {

 private:

diff --git a/src/sequence.h b/src/sequence.h
index 2943946..9da8700 100644
--- a/src/sequence.h
+++ b/src/sequence.h
@@ -153,7 +153,7 @@ class sequence
     long m_rec_vol;

     /* locking */
-    mutex m_mutex;
+    seq24mutex m_mutex;

     /* used to idenfity which events are ours in the out queue */
     //unsigned char m_tag;


code:
Fix CVE-2018-1000097:

https://security-tracker.debian.org/tracker/CVE-2018-1000097
https://nvd.nist.gov/vuln/detail/CVE-2018-1000097

Patch taken from upstream bug report:
https://lists.gnu.org/archive/html/bug-gnu-utils/2018-02/msg00005.html

diff --git a/src/unshar.c b/src/unshar.c
index 80bc3a9..0fc3773 100644
--- a/src/unshar.c
+++ b/src/unshar.c
@@ -240,7 +240,7 @@ find_archive (char const * name, FILE * file, off_t start)
       off_t position = ftello (file);

       /* Read next line, fail if no more and no previous process.  */
-      if (!fgets (rw_buffer, BUFSIZ, file))
+      if (!fgets (rw_buffer, rw_base_size, file))
 	{
 	  if (!start)
 	    error (0, 0, _("Found no shell commands in %s"), name);


code:
Fix building of Shishi with libgcrypt 1.6 and later.

Patch copied from Debian:

https://anonscm.debian.org/cgit/collab-maint/shishi.git/tree/debian/patches/fix_gcrypt_detection.diff?id=948301ae648a542a408da250755aeed58a6e3542

Description: Fix autoconf gnutls detection to also accept gcrypt 1.6.
Author: Andreas Metzler <ametzler@debian.org>
Bug-Debian: http://bugs.debian.org/753150
Origin: vendor
Forwarded: no
Last-Update: 2014-07-18

--- shishi-1.0.2.orig/gl/m4/gc.m4
+++ shishi-1.0.2/gl/m4/gc.m4
@@ -12,10 +12,12 @@ AC_DEFUN([gl_GC],
   if test "$libgcrypt" != no; then
     AC_LIB_HAVE_LINKFLAGS([gcrypt], [gpg-error], [
 #include <gcrypt.h>
-/* GCRY_MODULE_ID_USER was added in 1.4.4 and gc-libgcrypt.c
-   will fail on startup if we don't have 1.4.4 or later, so
-   test for it early. */
-#if !defined GCRY_MODULE_ID_USER
+/* gc-libgcrypt.c will fail on startup if we don't have libgcrypt 1.4.4 or
+   later, test for it early. by checking for either
+   - GCRY_MODULE_ID_USER which was added in 1.4.4 and dropped in 1.6 or
+   - GCRYPT_VERSION_NUMBER which was added in 1.6.
+   */
+#if !defined GCRY_MODULE_ID_USER && !defined GCRYPT_VERSION_NUMBER
 error too old libgcrypt
 #endif
 ])


code:
Allow the configuration file and theme directory to be specified at run time.
Patch by Eelco Dolstra, from Nixpkgs.

--- slim-1.3.6/app.cpp	2013-10-02 00:38:05.000000000 +0200
+++ slim-1.3.6/app.cpp	2013-10-15 11:02:55.629263422 +0200
@@ -200,7 +200,9 @@

 	/* Read configuration and theme */
 	cfg = new Cfg;
-	cfg->readConf(CFGFILE);
+	char *cfgfile = getenv("SLIM_CFGFILE");
+	if (!cfgfile) cfgfile = CFGFILE;
+	cfg->readConf(cfgfile);
 	string themebase = "";
 	string themefile = "";
 	string themedir = "";
@@ -208,7 +210,9 @@
 	if (testing) {
 		themeName = testtheme;
 	} else {
-		themebase = string(THEMESDIR) + "/";
+		char *themesdir = getenv("SLIM_THEMESDIR");
+		if (!themesdir) themesdir = THEMESDIR;
+		themebase = string(themesdir) + "/";
 		themeName = cfg->getOption("current_theme");
 		string::size_type pos;
 		if ((pos = themeName.find(",")) != string::npos) {


code:
Display configurable login message after successful authentication.

Patch by E. Bavier

--- slim-1.3.6/panel.cpp.orig	1969-12-31 18:00:00.000000000 -0600
+++ slim-1.3.6/panel.cpp	2016-10-17 17:00:07.259649063 -0500
@@ -260,6 +260,7 @@

 void Panel::ClosePanel() {
 	XUngrabKeyboard(Dpy, CurrentTime);
+	XClearWindow(Dpy, Root);
 	XUnmapWindow(Dpy, Win);
 	XDestroyWindow(Dpy, Win);
 	XFlush(Dpy);
--- slim-1.3.6/cfg.cpp.orig	2016-10-17 17:08:06.767666139 -0500
+++ slim-1.3.6/cfg.cpp	2016-10-17 17:06:53.115663516 -0500
@@ -52,6 +52,7 @@
 	options.insert(option("lockfile","/var/run/slim.lock"));
 	options.insert(option("logfile","/var/log/slim.log"));
 	options.insert(option("authfile","/var/run/slim.auth"));
+	options.insert(option("login_msg","Logging in..."));
 	options.insert(option("shutdown_msg","The system is halting..."));
 	options.insert(option("reboot_msg","The system is rebooting..."));
 	options.insert(option("sessiondir",""));
--- slim-1.3.6/app.cpp.orig	2016-10-17 17:08:41.731667384 -0500
+++ slim-1.3.6/app.cpp	2016-10-17 17:07:48.415665486 -0500
@@ -520,6 +520,8 @@
 	struct passwd *pw;
 	pid_t pid;

+	LoginPanel->Message((char*)cfg->getOption("login_msg").c_str());
+
 #ifdef USE_PAM
 	try{
 		pam.open_session();


code:
Do not reset chosen session and maintain the session-choser dialog after a
failed login attempt.

Patch by E. Bavier

--- slim-1.3.6/panel.cpp.orig	1969-12-31 18:00:00.000000000 -0600
+++ slim-1.3.6/panel.cpp	2016-10-17 17:00:07.259649063 -0500
@@ -260,13 +260,12 @@
 }

 void Panel::ClearPanel() {
-	session_name = "";
-    session_exec = "";
 	Reset();
 	XClearWindow(Dpy, Root);
 	XClearWindow(Dpy, Win);
 	Cursor(SHOW);
 	ShowText();
+	ShowSession();
 	XFlush(Dpy);
 }

@@ -760,9 +760,7 @@
         pair<string,string> ses = cfg->nextSession();
         session_name = ses.first;
         session_exec = ses.second;
-        if (session_name.size() > 0) {
-                ShowSession();
-        }
+        ShowSession();
  }

 /* Display session type on the screen */


code:
Exit after the user's session has finished.  This works around slim's broken
PAM session handling (see
http://developer.berlios.de/bugs/?func=detailbug&bug_id=19102&group_id=2663).

Patch by Eelco Dolstra, from Nixpkgs.

--- slim-1.3.6/app.cpp	2013-10-15 11:02:55.629263422 +0200
+++ slim-1.3.6/app.cpp	2013-10-15 13:00:10.141210784 +0200
@@ -816,7 +822,7 @@
 	StopServer();
 	RemoveLock();
 	while (waitpid(-1, NULL, WNOHANG) > 0); /* Collects all dead childrens */
-	Run();
+	exit(OK_EXIT);
 }

 void App::KillAllClients(Bool top) {


code:
This patch fixes SLiM so it really waits for the X server to be ready
before attempting to connect to it.  Indeed, the X server notices that
its parent process has a handler for SIGUSR1, and consequently sends it
SIGUSR1 when it's ready to accept connections.

The problem was that SLiM doesn't pay attention to SIGUSR1.  So in practice,
if X starts slowly, then SLiM gets ECONNREFUSED a couple of time on
/tmp/.X11-unix/X0, then goes on trying to connect to localhost:6000,
where nobody answers; eventually, it times out and tries again on
/tmp/.X11-unix/X0, and finally it shows up on the screen.

Patch by L. Courtès.

--- slim-1.3.6/app.cpp	2014-02-05 15:27:20.000000000 +0100
+++ slim-1.3.6/app.cpp	2014-02-09 22:42:04.000000000 +0100
@@ -119,7 +119,9 @@ void CatchSignal(int sig) {
 	exit(ERR_EXIT);
 }

+static volatile int got_sigusr1 = 0;
 void User1Signal(int sig) {
+	got_sigusr1 = 1;
 	signal(sig, User1Signal);
 }

@@ -884,6 +886,7 @@ int App::WaitForServer() {
 	int	ncycles	 = 120;
 	int	cycles;

+	while (!got_sigusr1);
 	for(cycles = 0; cycles < ncycles; cycles++) {
 		if((Dpy = XOpenDisplay(DisplayName))) {
 			XSetIOErrorHandler(xioerror);


code:
Downloaded from https://anonscm.debian.org/cgit/pkg-multimedia/sooperlooper.git/plain/debian/patches/04-build_with_wx_30.patch -O gnu/packages/patches/sooperlooper-build-with-wx-30.patch

Author: Jaromír Mikeš <mira.mikes@seznam.cz>, Olly Betts <olly@survex.com>
Description: build against wx 3.0.
Forwarded: yes

Index: sooperlooper/src/gui/main_panel.cpp
===================================================================
--- sooperlooper.orig/src/gui/main_panel.cpp
+++ sooperlooper/src/gui/main_panel.cpp
@@ -448,7 +448,7 @@ MainPanel::init_loopers (int count)
 		while (count < (int)_looper_panels.size()) {
 			looperpan = _looper_panels.back();
 			_looper_panels.pop_back();
-			_main_sizer->Remove(looperpan);
+			_main_sizer->Detach(looperpan);
 			looperpan->Destroy();
 		}
 	}
@@ -1277,7 +1277,7 @@ void MainPanel::misc_action (bool releas
 		}

-		wxString filename = do_file_selector (wxT("Choose file to save loop"), wxT("wav"), wxT("WAVE files (*.wav)|*.wav;*.WAV;*.Wav"),  wxSAVE|wxCHANGE_DIR|wxOVERWRITE_PROMPT);
+		wxString filename = do_file_selector (wxT("Choose file to save loop"), wxT("wav"), wxT("WAVE files (*.wav)|*.wav;*.WAV;*.Wav"),  wxFD_SAVE|wxFD_CHANGE_DIR|wxFD_OVERWRITE_PROMPT);

 		if ( !filename.empty() )
 		{
@@ -1296,7 +1296,7 @@ void MainPanel::misc_action (bool releas
 			index = 0;
 		}

-		wxString filename = do_file_selector (wxT("Choose file to open"), wxT(""), wxT("*.slsess"), wxOPEN|wxCHANGE_DIR);
+		wxString filename = do_file_selector (wxT("Choose file to open"), wxT(""), wxT("*.slsess"), wxFD_OPEN|wxFD_CHANGE_DIR);

 		if ( !filename.empty() )
 		{
@@ -1408,7 +1408,7 @@ void MainPanel::set_curr_loop (int index

 void MainPanel::do_load_session ()
 {
-	wxString filename = do_file_selector (wxT("Choose session to load"), wxT("*.slsess"), wxT("*.slsess"), wxOPEN|wxCHANGE_DIR);
+	wxString filename = do_file_selector (wxT("Choose session to load"), wxT("*.slsess"), wxT("*.slsess"), wxFD_OPEN|wxFD_CHANGE_DIR);

 	if ( !filename.empty() )
 	{
@@ -1419,7 +1419,7 @@ void MainPanel::do_load_session ()

 void MainPanel::do_save_session (bool write_audio)
 {
-	wxString filename = do_file_selector (wxT("Choose file to save session"), wxT("slsess"), wxT("*.slsess"), wxSAVE|wxCHANGE_DIR|wxOVERWRITE_PROMPT);
+	wxString filename = do_file_selector (wxT("Choose file to save session"), wxT("slsess"), wxT("*.slsess"), wxFD_SAVE|wxFD_CHANGE_DIR|wxFD_OVERWRITE_PROMPT);

 	if ( !filename.empty() )
 	{
Index: sooperlooper/src/gui/pix_button.cpp
===================================================================
--- sooperlooper.orig/src/gui/pix_button.cpp
+++ sooperlooper/src/gui/pix_button.cpp
@@ -250,7 +250,7 @@ PixButton::OnMouseEvents (wxMouseEvent &
 		pt.x += bounds.x;
 		pt.y += bounds.y;

-		if (bounds.Inside(pt)) {
+		if (bounds.Contains(pt)) {
 			clicked (get_mouse_button(ev)); // emit

 			if (ev.MiddleUp() && ev.ControlDown()) {
Index: sooperlooper/src/gui/looper_panel.cpp
===================================================================
--- sooperlooper.orig/src/gui/looper_panel.cpp
+++ sooperlooper/src/gui/looper_panel.cpp
@@ -1428,7 +1428,7 @@ LooperPanel::clicked_events (int button,
 	if (cmd == wxT("save"))
 	{
 		wxString filename = _mainpanel->do_file_selector (wxT("Choose file to save loop"),
-											      wxT("wav"), wxT("WAVE files (*.wav)|*.wav;*.WAV;*.Wav"),  wxSAVE|wxCHANGE_DIR|wxOVERWRITE_PROMPT);
+											      wxT("wav"), wxT("WAVE files (*.wav)|*.wav;*.WAV;*.Wav"),  wxFD_SAVE|wxFD_CHANGE_DIR|wxFD_OVERWRITE_PROMPT);

 		if ( !filename.empty() )
 		{
@@ -1442,7 +1442,7 @@ LooperPanel::clicked_events (int button,
 	}
 	else if (cmd == wxT("load"))
 	{
-		wxString filename = _mainpanel->do_file_selector(wxT("Choose file to open"), wxT(""), wxT("Audio files (*.wav,*.aif)|*.wav;*.WAV;*.Wav;*.aif;*.aiff;*.AIF;*.AIFF|All files (*.*)|*.*"), wxOPEN|wxCHANGE_DIR);
+		wxString filename = _mainpanel->do_file_selector(wxT("Choose file to open"), wxT(""), wxT("Audio files (*.wav,*.aif)|*.wav;*.WAV;*.Wav;*.aif;*.aiff;*.AIF;*.AIFF|All files (*.*)|*.*"), wxFD_OPEN|wxFD_CHANGE_DIR);

 		if ( !filename.empty() )
 		{
Index: sooperlooper/src/gui/keyboard_target.cpp
===================================================================
--- sooperlooper.orig/src/gui/keyboard_target.cpp
+++ sooperlooper/src/gui/keyboard_target.cpp
@@ -553,10 +553,10 @@ KeyboardTarget::keycode_from_name (const
                         keycode = WXK_RETURN;
                     }
                     else if ( keyname == wxT("PGUP") ) {
-                        keycode = WXK_PRIOR;
+                        keycode = WXK_PAGEUP;
                     }
                     else if ( keyname == wxT("PGDN") ) {
-                        keycode = WXK_NEXT;
+                        keycode = WXK_PAGEDOWN;
                     }
                     else if ( keyname == wxT("LEFT") ) {
                         keycode = WXK_LEFT;
@@ -630,10 +630,10 @@ wxString KeyboardTarget::name_from_keyco
 	case WXK_RETURN:
 		text += wxT("return");
 		break;
-	case WXK_PRIOR:
+	case WXK_PAGEUP:
 		text += wxT("pageup");
 		break;
-	case WXK_NEXT:
+	case WXK_PAGEDOWN:
 		text += wxT("pagedown");
 		break;
 	case WXK_LEFT:
Index: sooperlooper/src/gui/check_box.cpp
===================================================================
--- sooperlooper.orig/src/gui/check_box.cpp
+++ sooperlooper/src/gui/check_box.cpp
@@ -237,7 +237,7 @@ CheckBox::OnMouseEvents (wxMouseEvent &e
 	}
 	else if (ev.LeftUp())
 	{
-		if (bounds.Inside(ev.GetPosition())) {
+		if (bounds.Contains(ev.GetPosition())) {
 			// toggle value
 			_value = !_value;

Index: sooperlooper/src/gui/midi_bind_panel.cpp
===================================================================
--- sooperlooper.orig/src/gui/midi_bind_panel.cpp
+++ sooperlooper/src/gui/midi_bind_panel.cpp
@@ -880,7 +880,7 @@ void MidiBindPanel::on_button (wxCommand
 	}
 	else if (ev.GetId() == ID_LoadButton)
 	{
-		wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to open"), wxT(""), wxT("*.slb"), wxOPEN|wxCHANGE_DIR);
+		wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to open"), wxT(""), wxT("*.slb"), wxFD_OPEN|wxFD_CHANGE_DIR);
 		if ( !filename.empty() )
 		{
 			_parent->get_loop_control().load_midi_bindings(filename,  _append_check->GetValue());
@@ -888,7 +888,7 @@ void MidiBindPanel::on_button (wxCommand
 	}
 	else if (ev.GetId() == ID_SaveButton)
 	{
-		wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to save"), wxT(""), wxT("*.slb"), wxSAVE|wxCHANGE_DIR|wxOVERWRITE_PROMPT);
+		wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to save"), wxT(""), wxT("*.slb"), wxFD_SAVE|wxFD_CHANGE_DIR|wxFD_OVERWRITE_PROMPT);

 		if ( !filename.empty() )
 		{
Index: sooperlooper/src/gui/config_panel.cpp
===================================================================
--- sooperlooper.orig/src/gui/config_panel.cpp
+++ sooperlooper/src/gui/config_panel.cpp
@@ -378,7 +378,7 @@ void ConfigPanel::on_button (wxCommandEv
 	else if (ev.GetId() == ID_MidiBrowseButton) {

 		_parent->get_keyboard().set_enabled(false);
-		wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to use"), wxT(""), wxT("*.slb"), wxOPEN|wxCHANGE_DIR);
+		wxString filename = _parent->do_file_selector(wxT("Choose midi binding file to use"), wxT(""), wxT("*.slb"), wxFD_OPEN|wxFD_CHANGE_DIR);
 		_parent->get_keyboard().set_enabled(true);

 		if ( !filename.empty() )
@@ -389,8 +389,8 @@ void ConfigPanel::on_button (wxCommandEv
 	else if (ev.GetId() == ID_SessionBrowseButton) {

 		_parent->get_keyboard().set_enabled(false);
-		wxString filename = _parent->do_file_selector(wxT("Choose session file to use"), wxT(""), wxT("*.slsess"), wxOPEN|wxCHANGE_DIR);
-		//wxString filename = wxFileSelector(wxT("Choose session file to use"), wxT(""), wxT(""), wxT(""), wxT("*.slsess"), wxOPEN|wxCHANGE_DIR);
+		wxString filename = _parent->do_file_selector(wxT("Choose session file to use"), wxT(""), wxT("*.slsess"), wxFD_OPEN|wxFD_CHANGE_DIR);
+		//wxString filename = wxFileSelector(wxT("Choose session file to use"), wxT(""), wxT(""), wxT(""), wxT("*.slsess"), wxFD_OPEN|wxFD_CHANGE_DIR);
 		_parent->get_keyboard().set_enabled(true);

 		if ( !filename.empty() )


code:
Fix CVE-2018-1000223:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000223
https://gitlab.com/soundtouch/soundtouch/issues/6

Patches copied from upstream source repository:

https://gitlab.com/soundtouch/soundtouch/commit/9e02d9b04fda6c1f44336ff00bb5af1e2ffc039e
https://gitlab.com/soundtouch/soundtouch/commit/e0240689056e4182fffdc2a16aa6e3425a15e275
https://gitlab.com/soundtouch/soundtouch/commit/46531e5b92dd80dd9a7947463d6224fc7cb21967

From 9e02d9b04fda6c1f44336ff00bb5af1e2ffc039e Mon Sep 17 00:00:00 2001
From: oparviainen <oparviai@iki.fi>
Date: Sun, 12 Aug 2018 20:24:37 +0300
Subject: [PATCH] Added minimum size check for WAV header block lengh values

---
 source/SoundStretch/WavFile.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/source/SoundStretch/WavFile.cpp b/source/SoundStretch/WavFile.cpp
index 7e7ade2..68818c9 100644
--- a/source/SoundStretch/WavFile.cpp
+++ b/source/SoundStretch/WavFile.cpp
@@ -530,7 +530,11 @@ int WavInFile::readHeaderBlock()
         // read length of the format field
         if (fread(&nLen, sizeof(int), 1, fptr) != 1) return -1;
         // swap byte order if necessary
-        _swap32(nLen); // int format_len;
+        _swap32(nLen);
+
+        // verify that header length isn't smaller than expected
+        if (nLen < sizeof(header.format) - 8) return -1;
+
         header.format.format_len = nLen;

         // calculate how much length differs from expected
@@ -572,6 +576,10 @@ int WavInFile::readHeaderBlock()
         if (fread(&nLen, sizeof(int), 1, fptr) != 1) return -1;
         // swap byte order if necessary
         _swap32(nLen); // int fact_len;
+
+        // verify that fact length isn't smaller than expected
+        if (nLen < sizeof(header.fact) - 8) return -1;
+
         header.fact.fact_len = nLen;

         // calculate how much length differs from expected
--
2.18.0

From e0240689056e4182fffdc2a16aa6e3425a15e275 Mon Sep 17 00:00:00 2001
From: oparviainen <oparviai@iki.fi>
Date: Mon, 13 Aug 2018 19:16:16 +0300
Subject: [PATCH] Fixed WavFile header/fact not-too-small check

---
 source/SoundStretch/WavFile.cpp | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/source/SoundStretch/WavFile.cpp b/source/SoundStretch/WavFile.cpp
index 4af7a4c..3421bca 100644
--- a/source/SoundStretch/WavFile.cpp
+++ b/source/SoundStretch/WavFile.cpp
@@ -518,13 +518,13 @@ int WavInFile::readHeaderBlock()
         // swap byte order if necessary
         _swap32(nLen);

-        // verify that header length isn't smaller than expected
-        if (nLen < sizeof(header.format) - 8) return -1;
+        // calculate how much length differs from expected
+        nDump = nLen - ((int)sizeof(header.format) - 8);

-        header.format.format_len = nLen;
+        // verify that header length isn't smaller than expected structure
+        if (nDump < 0) return -1;

-        // calculate how much length differs from expected
-        nDump = nLen - ((int)sizeof(header.format) - 8);
+        header.format.format_len = nLen;

         // if format_len is larger than expected, read only as much data as we've space for
         if (nDump > 0)
@@ -561,16 +561,16 @@ int WavInFile::readHeaderBlock()
         // read length of the fact field
         if (fread(&nLen, sizeof(int), 1, fptr) != 1) return -1;
         // swap byte order if necessary
-        _swap32(nLen); // int fact_len;
-
-        // verify that fact length isn't smaller than expected
-        if (nLen < sizeof(header.fact) - 8) return -1;
-
-        header.fact.fact_len = nLen;
+        _swap32(nLen);

         // calculate how much length differs from expected
         nDump = nLen - ((int)sizeof(header.fact) - 8);

+        // verify that fact length isn't smaller than expected structure
+        if (nDump < 0) return -1;
+
+        header.fact.fact_len = nLen;
+
         // if format_len is larger than expected, read only as much data as we've space for
         if (nDump > 0)
         {
--
2.18.0

From 46531e5b92dd80dd9a7947463d6224fc7cb21967 Mon Sep 17 00:00:00 2001
From: olli <oparviai@iki.fi>
Date: Mon, 13 Aug 2018 19:42:58 +0300
Subject: [PATCH] Improved WavFile header/fact not-too-small check

---
 source/SoundStretch/WavFile.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source/SoundStretch/WavFile.cpp b/source/SoundStretch/WavFile.cpp
index 3421bca..9d90b8a 100644
--- a/source/SoundStretch/WavFile.cpp
+++ b/source/SoundStretch/WavFile.cpp
@@ -522,7 +522,7 @@ int WavInFile::readHeaderBlock()
         nDump = nLen - ((int)sizeof(header.format) - 8);

         // verify that header length isn't smaller than expected structure
-        if (nDump < 0) return -1;
+        if ((nLen < 0) || (nDump < 0)) return -1;

         header.format.format_len = nLen;

@@ -567,7 +567,7 @@ int WavInFile::readHeaderBlock()
         nDump = nLen - ((int)sizeof(header.fact) - 8);

         // verify that fact length isn't smaller than expected structure
-        if (nDump < 0) return -1;
+        if ((nLen < 0) || (nDump < 0)) return -1;

         header.fact.fact_len = nLen;

--
2.18.0