code:
Index: akonadi-19.08.0/src/server/storage/dbconfigmysql.cpp
===================================================================
--- akonadi-19.08.0.orig/src/server/storage/dbconfigmysql.cpp
+++ akonadi-19.08.0/src/server/storage/dbconfigmysql.cpp
@@ -235,8 +235,7 @@ bool DbConfigMysql::startInternalServer(
     bool confUpdate = false;
     QFile actualFile(actualConfig);
     // update conf only if either global (or local) is newer than actual
-    if ((QFileInfo(globalConfig).lastModified() > QFileInfo(actualFile).lastModified()) ||
-            (QFileInfo(localConfig).lastModified()  > QFileInfo(actualFile).lastModified())) {
+    if (true) {
         QFile globalFile(globalConfig);
         QFile localFile(localConfig);
         if (globalFile.open(QFile::ReadOnly) && actualFile.open(QFile::WriteOnly)) {


code:
Fixes compilation with Mesa >= 18.2.5.

Taken from upstream:

https://github.com/liballeg/allegro5/commit/a40d30e21802ecf5c9382cf34af9b01bd3781e47

diff --git a/include/allegro5/allegro_opengl.h b/include/allegro5/allegro_opengl.h
index 0f86a6768..652dd024e 100644
--- a/include/allegro5/allegro_opengl.h
+++ b/include/allegro5/allegro_opengl.h
@@ -103,10 +103,14 @@

 /* HACK: Prevent both Mesa and SGI's broken headers from screwing us */
 #define __glext_h_
+#define __gl_glext_h_
 #define __glxext_h_
+#define __glx_glxext_h_
 #include <GL/gl.h>
 #undef  __glext_h_
+#undef  __gl_glext_h_
 #undef  __glxext_h_
+#undef  __glx_glxext_h_

 #endif /* ALLEGRO_MACOSX */

diff --git a/include/allegro5/opengl/GLext/glx_ext_defs.h b/include/allegro5/opengl/GLext/glx_ext_defs.h
index 49c502091..fba8aea5d 100644
--- a/include/allegro5/opengl/GLext/glx_ext_defs.h
+++ b/include/allegro5/opengl/GLext/glx_ext_defs.h
@@ -1,7 +1,9 @@
 /* HACK: Prevent both Mesa and SGI's broken headers from screwing us */
 #define __glxext_h_
+#define __glx_glxext_h_
 #include <GL/glx.h>
 #undef __glxext_h_
+#undef __glx_glxext_h_

 #ifndef GLX_VERSION_1_3
 #define _ALLEGRO_GLX_VERSION_1_3
--
2.20.0

repo_name: maximed/guix

license: mit


code:
Modified from upstream commit:
https://github.com/ankitects/anki/commit/ccd715013609133c55e83924734efa78abc03326
Fixes mpv argument syntax (support for old syntax removed in mpv 0.31):
https://anki.tenderapp.com/discussions/ankidesktop/38186-mpvprocesserror-unable-to-start-process
Necessary because we are currently unable to upgrade anki to the
latest version in guix (NPM dependencies currently unpackaged).
---
 anki/mpv.py   | 4 ++--
 anki/sound.py | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/anki/mpv.py b/anki/mpv.py
index f53d9d0..563fddc 100644
--- a/anki/mpv.py
+++ b/anki/mpv.py
@@ -104,9 +104,9 @@ class MPVBase:
         """
         self.argv = [self.executable]
         self.argv += self.default_argv
-        self.argv += ["--input-ipc-server", self._sock_filename]
+        self.argv += ["--input-ipc-server="+self._sock_filename]
         if self.window_id is not None:
-            self.argv += ["--wid", str(self.window_id)]
+            self.argv += ["--wid="+str(self.window_id)]

     def _start_process(self):
         """Start the mpv process.
diff --git a/anki/sound.py b/anki/sound.py
index aa3431b..a5fce44 100644
--- a/anki/sound.py
+++ b/anki/sound.py
@@ -124,7 +124,6 @@ class MpvManager(MPV):
 def setMpvConfigBase(base):
     mpvConfPath = os.path.join(base, "mpv.conf")
     MpvManager.default_argv += [
-        "--no-config",
         "--include="+mpvConfPath,
     ]

--
2.25.1


code:
Description: Add check for buffer overflow with malformed input files
 This was later re-found and became CVE-2014-8123.
Author: <eriks@debian.org>
Bug-Debian: http://bugs.debian.org/407015
Bug-Debian: https://bugs.debian.org/771768
Forwarded: http://seclists.org/oss-sec/2014/q4/870
Last-Update: 2016-01-11

--- antiword-0.37~/wordole.c	2005-08-26 21:49:57.000000000 +0200
+++ antiword-0.37/wordole.c	2009-06-03 22:31:15.948014682 +0200
@@ -259,6 +259,10 @@
 		}
 		tNameSize = (size_t)usGetWord(0x40, aucBytes);
 		tNameSize = (tNameSize + 1) / 2;
+		if ( tNameSize > sizeof(atPPSlist[iIndex].szName)) {
+			werr(0, "Name Size of PPS %d is too large", iIndex);
+			tNameSize = sizeof(atPPSlist[iIndex].szName);
+		}
 		vName2String(atPPSlist[iIndex].szName, aucBytes, tNameSize);
 		atPPSlist[iIndex].ucType = ucGetByte(0x42, aucBytes);
 		if (atPPSlist[iIndex].ucType == 5) {


code:
Based on the upstream fix for the java8 compilation issue.
Simplified patch.
Upstream version of patch does not work with this source tree.

The issue is that in java8 it is an error to pass null to
removeAll. Results in null pointer exception. java7
behaviour was to return the list unmodified.

From db2a350c6d90efaa8dde949fa76005c2c5af45c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= <boskovits@gmail.com>
Date: Fri, 5 Jan 2018 17:05:31 +0100
Subject: [PATCH] Fix java8 compilation.

---
 src/org/antlr/tool/CompositeGrammar.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/org/antlr/tool/CompositeGrammar.java b/src/org/antlr/tool/CompositeGrammar.java
index f1408e7..7e02431 100644
--- a/src/org/antlr/tool/CompositeGrammar.java
+++ b/src/org/antlr/tool/CompositeGrammar.java
@@ -218,7 +218,9 @@ public class CompositeGrammar {
 	public List<Grammar> getIndirectDelegates(Grammar g) {
 		List<Grammar> direct = getDirectDelegates(g);
 		List<Grammar> delegates = getDelegates(g);
-		delegates.removeAll(direct);
+		if (direct != null) {
+			delegates.removeAll(direct);
+		}
 		return delegates;
 	}

--
2.15.1


code:
Based on the upstream fix for the java8 compilation issue.
Simplified patch.
Upstream version of patch does not work with this source tree.

The issue is that in java8 it is an error to pass null to
removeAll. Results in null pointer exception. java7
behaviour was to return the list unmodified.

From 43867d50c05d1c06ab7220eb974a8874ae10c308 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= <boskovits@gmail.com>
Date: Fri, 5 Jan 2018 19:08:24 +0100
Subject: [PATCH] Fix java8 complilation error.

---
 tool/src/main/java/org/antlr/tool/CompositeGrammar.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tool/src/main/java/org/antlr/tool/CompositeGrammar.java b/tool/src/main/java/org/antlr/tool/CompositeGrammar.java
index f34ea73..63740a6 100644
--- a/tool/src/main/java/org/antlr/tool/CompositeGrammar.java
+++ b/tool/src/main/java/org/antlr/tool/CompositeGrammar.java
@@ -226,7 +226,9 @@ public class CompositeGrammar {
 	public List<Grammar> getIndirectDelegates(Grammar g) {
 		List<Grammar> direct = getDirectDelegates(g);
 		List<Grammar> delegates = getDelegates(g);
-		delegates.removeAll(direct);
+		if(direct != null) {
+		        delegates.removeAll(direct);
+		}
 		return delegates;
 	}

--
2.15.1


code:
--- test/testsock.c	2013-01-24 06:57:21.000000000 +0100
+++ test/testsock.c	2013-01-24 17:24:54.000000000 +0100
@@ -90,16 +90,22 @@
     rv = apr_sockaddr_info_get(&sa, NULL, APR_UNSPEC, 0, 0, p);
     APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv);

+    /* /etc/services is not available while compiling, so apr_getservbyname
+     * will always return APR_ENOENT. */
+#if 0
     rv = apr_getservbyname(sa, "ftp");
     APR_ASSERT_SUCCESS(tc, "Problem getting ftp service", rv);
     ABTS_INT_EQUAL(tc, 21, sa->port);
+#endif

     rv = apr_getservbyname(sa, "complete_and_utter_rubbish");
     APR_ASSERT_SUCCESS(tc, "Problem getting non-existent service", !rv);

+#if 0
     rv = apr_getservbyname(sa, "telnet");
     APR_ASSERT_SUCCESS(tc, "Problem getting telnet service", rv);
     ABTS_INT_EQUAL(tc, 23, sa->port);
+#endif
 }

 static apr_socket_t *setup_socket(abts_case *tc)


code:
Guix libarchive no support xar.

--- ark-20.04.1.orig/autotests/kerfuffle/loadtest.cpp	2020-12-23 08:46:15.780782601 +0800
+++ ark-20.04.1/autotests/kerfuffle/loadtest.cpp	2020-12-23 11:13:17.101724042 +0800
@@ -181,13 +181,6 @@
         qDebug() << "lz4 executable not found in path. Skipping lz4 test.";
     }

-    QTest::newRow("xar archive")
-            << QFINDTESTDATA("data/simplearchive.xar")
-            << QStringLiteral("simplearchive")
-            << true << false << false << false << false << 0 << Archive::Unencrypted
-            << QStringLiteral("simplearchive")
-            << QString();
-
     QTest::newRow("mimetype child of application/zip")
             << QFINDTESTDATA("data/test.odt")
             << QStringLiteral("test")
--- ark-20.04.1.orig/autotests/kerfuffle/extracttest.cpp	2020-12-23 08:46:15.780782601 +0800
+++ ark-20.04.1/autotests/kerfuffle/extracttest.cpp	2020-12-23 11:14:02.801809620 +0800
@@ -350,23 +350,6 @@
         qDebug() << "lz4 executable not found in path. Skipping lz4 test.";
     }

-    archivePath = QFINDTESTDATA("data/simplearchive.xar");
-    QTest::newRow("extract selected entries from a xar archive without path")
-            << archivePath
-            << QVector<Archive::Entry*> {
-                   new Archive::Entry(this, QStringLiteral("dir1/file11.txt"), QString()),
-                   new Archive::Entry(this, QStringLiteral("file4.txt"), QString())
-               }
-            << optionsNoPaths
-            << 2;
-
-    archivePath = QFINDTESTDATA("data/simplearchive.xar");
-    QTest::newRow("extract all entries from a xar archive with path")
-            << archivePath
-            << QVector<Archive::Entry*>()
-            << optionsPreservePaths
-            << 6;
-
     archivePath = QFINDTESTDATA("data/hello-1.0-x86_64.AppImage");
     QTest::newRow("extract all entries from an AppImage with path")
             << archivePath


code:
This patch changes the default value of 'dict-dir' to correspond
to ~/.guix-profile/lib/aspell rather than $prefix/lib/aspell-X.Y.

This is not strictly necessary for the 'aspell' program itself since
one can simply set "ASPELL_CONF=dict-dir $HOME/.guix-profile/lib/aspell".
However it is necessary for applications that use libaspell since
'ASPELL_CONF' is not honored in this case.  See <https://bugs.gnu.org/25836>.

--- a/common/config.cpp
+++ b/common/config.cpp
@@ -651,7 +651,20 @@ namespace acommon {
 	  } else { // sep == '|'
 	    assert(replace[0] == '$');
 	    const char * env = getenv(replace.c_str()+1);
-	    final_str += env ? env : second;
+	    if (env) {
+	      final_str += env;
+	    } else if (second[0] == '$') {
+	      // Expand the right-hand side of '|', which starts with a
+	      // reference to an environment variable.
+	      auto slash = second.find('/');
+	      String variable = second.substr(1, slash - 1);
+	      const char * env = getenv(variable.c_str());
+	      String value = env ? String(env) : "";
+	      value += second.substr(slash, second.size() - slash);
+	      final_str += value;
+	    } else {
+	      final_str += second;
+	    }
 	  }
 	  replace = "";
 	  in_replace = false;
@@ -1349,6 +1349,9 @@ namespace acommon {
 #  define REPL     ".aspell.<lang>.prepl"
 #endif

+#undef DICT_DIR
+#define DICT_DIR "<$ASPELL_DICT_DIR|$HOME/.guix-profile/lib/aspell>"
+
   static const KeyInfo config_keys[] = {
     // the description should be under 50 chars
     {"actual-dict-dir", KeyInfoString, "<dict-dir^master>", 0}


code:
Fixes for compiling with -fno-common, default in GCC 10.

Taken from upstream:
https://github.com/qca/open-ath9k-htc-firmware/commit/559e3eba3b4cf103da6b8d022f3e1387278b9db8

diff --git a/target_firmware/magpie_fw_dev/target/init/app_start.c b/target_firmware/magpie_fw_dev/target/init/app_start.c
--- a/target_firmware/magpie_fw_dev/target/init/app_start.c
+++ b/target_firmware/magpie_fw_dev/target/init/app_start.c
@@ -52,6 +52,8 @@
 #define ALLOCRAM_START       ( ((unsigned int)&_fw_image_end) + 4)
 #define ALLOCRAM_SIZE        ( SYS_RAM_SZIE - ( ALLOCRAM_START - SYS_D_RAM_REGION_0_BASE) - SYS_D_RAM_STACK_SIZE)

+void (* _assfail_ori)(struct register_dump_s *);
+
 // support for more than 64 bytes on command pipe
 extern void usb_reg_out_patch(void);
 extern int _HIFusb_get_max_msg_len_patch(hif_handle_t handle, int pipe);
diff --git a/target_firmware/magpie_fw_dev/target/init/init.h b/target_firmware/magpie_fw_dev/target/init/init.h
--- a/target_firmware/magpie_fw_dev/target/init/init.h
+++ b/target_firmware/magpie_fw_dev/target/init/init.h
@@ -46,7 +46,7 @@
 void AR6002_fatal_exception_handler_patch(CPU_exception_frame_t *exc_frame);
 void exception_reset(struct register_dump_s *dump);

-void (* _assfail_ori)(struct register_dump_s *);
+extern void (* _assfail_ori)(struct register_dump_s *);
 void HTCMsgRecvHandler_patch(adf_nbuf_t hdr_buf, adf_nbuf_t buffer, void *context);
 void HTCControlSvcProcessMsg_patch(HTC_ENDPOINT_ID EndpointID, adf_nbuf_t hdr_buf,
 				   adf_nbuf_t pBuffers, void *arg);


code:
This GCC patch is from the ath9k-htc-firmware repository (version 1.3.2).
Not applying it (apparently) leads to miscompiled firmware, and loading it
fails with a "Target is unresponsive" message from the 'ath9k_htc' module.

From c7162b8a3db42e7faf47606d3aa3dd61e64aea17 Mon Sep 17 00:00:00 2001
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Date: Mon, 7 Jan 2013 16:06:28 +0530
Subject: [PATCH] gcc: AR9271/AR7010 config

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 include/xtensa-config.h | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/include/xtensa-config.h b/include/xtensa-config.h
index 30f4f41..fe9b051 100644
--- a/include/xtensa-config.h
+++ b/include/xtensa-config.h
@@ -44,10 +44,7 @@
 #define XCHAL_HAVE_L32R			1

 #undef XSHAL_USE_ABSOLUTE_LITERALS
-#define XSHAL_USE_ABSOLUTE_LITERALS	0
-
-#undef XSHAL_HAVE_TEXT_SECTION_LITERALS
-#define XSHAL_HAVE_TEXT_SECTION_LITERALS 1 /* Set if there is some memory that allows both code and literals.  */
+#define XSHAL_USE_ABSOLUTE_LITERALS	1

 #undef XCHAL_HAVE_MAC16
 #define XCHAL_HAVE_MAC16		0
@@ -59,10 +56,10 @@
 #define XCHAL_HAVE_MUL32		1

 #undef XCHAL_HAVE_MUL32_HIGH
-#define XCHAL_HAVE_MUL32_HIGH		0
+#define XCHAL_HAVE_MUL32_HIGH		1

 #undef XCHAL_HAVE_DIV32
-#define XCHAL_HAVE_DIV32		1
+#define XCHAL_HAVE_DIV32		0

 #undef XCHAL_HAVE_NSA
 #define XCHAL_HAVE_NSA			1
@@ -103,8 +100,6 @@
 #undef XCHAL_HAVE_FP_RSQRT
 #define XCHAL_HAVE_FP_RSQRT		0

-#undef XCHAL_HAVE_DFP_accel
-#define XCHAL_HAVE_DFP_accel			0
 #undef XCHAL_HAVE_WINDOWED
 #define XCHAL_HAVE_WINDOWED		1

@@ -119,32 +114,32 @@

 #undef XCHAL_ICACHE_SIZE
-#define XCHAL_ICACHE_SIZE		16384
+#define XCHAL_ICACHE_SIZE		0

 #undef XCHAL_DCACHE_SIZE
-#define XCHAL_DCACHE_SIZE		16384
+#define XCHAL_DCACHE_SIZE		0

 #undef XCHAL_ICACHE_LINESIZE
-#define XCHAL_ICACHE_LINESIZE		32
+#define XCHAL_ICACHE_LINESIZE		16

 #undef XCHAL_DCACHE_LINESIZE
-#define XCHAL_DCACHE_LINESIZE		32
+#define XCHAL_DCACHE_LINESIZE		16

 #undef XCHAL_ICACHE_LINEWIDTH
-#define XCHAL_ICACHE_LINEWIDTH		5
+#define XCHAL_ICACHE_LINEWIDTH		4

 #undef XCHAL_DCACHE_LINEWIDTH
-#define XCHAL_DCACHE_LINEWIDTH		5
+#define XCHAL_DCACHE_LINEWIDTH		4

 #undef XCHAL_DCACHE_IS_WRITEBACK
-#define XCHAL_DCACHE_IS_WRITEBACK	1
+#define XCHAL_DCACHE_IS_WRITEBACK	0

 #undef XCHAL_HAVE_MMU
 #define XCHAL_HAVE_MMU			1

 #undef XCHAL_MMU_MIN_PTE_PAGE_SIZE
-#define XCHAL_MMU_MIN_PTE_PAGE_SIZE	12
+#define XCHAL_MMU_MIN_PTE_PAGE_SIZE	29

 #undef XCHAL_HAVE_DEBUG
@@ -157,8 +152,11 @@
 #define XCHAL_NUM_DBREAK		2

 #undef XCHAL_DEBUGLEVEL
-#define XCHAL_DEBUGLEVEL		6
+#define XCHAL_DEBUGLEVEL		4
+

+#undef XCHAL_EXCM_LEVEL
+#define XCHAL_EXCM_LEVEL                3

 #undef XCHAL_MAX_INSTRUCTION_SIZE
 #define XCHAL_MAX_INSTRUCTION_SIZE	3
--
1.8.1


code:
The firmware is cross-compiled, but the build system ends up using
'objcopy' instead of 'xtensa-elf-objcopy' by default.  Force it to
use the right one.

--- source/target_firmware/configure	2014-10-28 20:57:26.834436561 +0100
+++ source/target_firmware/configure	2014-10-28 20:57:29.666436530 +0100
@@ -11,6 +11,7 @@ mkdir -p build
 cat > "$TOOLCHAIN_FILE" <<EOF
 INCLUDE(CMakeForceCompiler)

+SET(CMAKE_OBJCOPY xtensa-elf-objcopy)
 SET(CMAKE_SYSTEM_PROCESSOR xtensa)
 SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/$TARGET)
 SET(CMAKE_STRIP :)


code:
Without <sys/time.h>, gettimeofday is undefined.

diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp
index 0187e3962..e15d55f4c 100644
--- a/src/AudioIO.cpp
+++ b/src/AudioIO.cpp
@@ -479,6 +479,8 @@ time warp info and AudioIOListener and whether the playback is looped.
 #include "../lib-src/portmidi/porttime/porttime.h"
 #include "../lib-src/header-substitutes/allegro.h"

+#include <sys/time.h>
+
    #define MIDI_SLEEP 10 /* milliseconds */
    // how long do we think the thread that fills MIDI buffers,
    // if it is separate from the portaudio thread,


code:
Downloaded from here:
https://sourceforge.net/p/audacity/mailman/message/36106562/

Modified for use on later versions of audacity.

>From 5f9482a191359f2c477763a36d2c865c5f186602 Mon Sep 17 00:00:00 2001
From: Antonio Ospite <ao2@ao2.it>
Date: Tue, 7 Nov 2017 13:06:33 +0100
Subject: [PATCH] Fix building against the system portaudio library

Building against the system portaudio results in this error:

./src/AudioIO.cpp:983: undefined reference to `PaUtil_GetTime'
audacity-AudioIO.o: In function `audacityAudioCallback(void const*, void*,
unsigned long, PaStreamCallbackTimeInfo const*, unsigned long, void*)':
./src/AudioIO.cpp:4630: undefined reference to `PaUtil_GetTime'
collect2: error: ld returned 1 exit status
Makefile:2349: recipe for target 'audacity' failed
make[3]: *** [audacity] Error 1

This is because PaUtil_GetTime is declared as a C symbol in pa_util.h
but is resolved as a C++ symbol at link time.

Audacity fixes this in the local tree with this change:
https://github.com/audacity/audacity/commit/38fd97b8e26060332ab3e9e000a8882326a70ba7

However this is not general enough for the portaudio debian package.

Since PaUtil_GetTime() is the only function causing problems, just copy
over the code where it's used.
---
 src/AudioIO.cpp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp
index 48715869c..bb4bf472c 100644
--- a/src/AudioIO.cpp
+++ b/src/AudioIO.cpp
@@ -480,9 +480,22 @@ time warp info and AudioIOListener and whether the playback is looped.
    #define ROUND(x) (int) ((x)+0.5)
    //#include <string.h>
 //   #include "../lib-src/portmidi/pm_common/portmidi.h"
-   #include "../lib-src/portaudio-v19/src/common/pa_util.h"
    #include "NoteTrack.h"
 #endif
+PaTime PaUtil_GetTime( void )
+{
+#ifdef HAVE_MACH_ABSOLUTE_TIME
+    return mach_absolute_time() * machSecondsConversionScaler_;
+#elif defined(HAVE_CLOCK_GETTIME)
+    struct timespec tp;
+    clock_gettime(CLOCK_REALTIME, &tp);
+    return (PaTime)(tp.tv_sec + tp.tv_nsec * 1e-9);
+#else
+    struct timeval tv;
+    gettimeofday( &tv, NULL );
+    return (PaTime) tv.tv_usec * 1e-6 + tv.tv_sec;
+#endif
+}

 #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
    #define LOWER_BOUND 0.0


code:
Description: fix buffer overflow when changing both sample format and
 number of channels
Origin: https://github.com/mpruett/audiofile/pull/25
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/audiofile/+bug/1502721
Bug-Debian: https://bugs.debian.org/801102

--- a/libaudiofile/modules/ModuleState.cpp
+++ b/libaudiofile/modules/ModuleState.cpp
@@ -402,7 +402,7 @@ status ModuleState::arrange(AFfilehandle
 		addModule(new Transform(outfc, in.pcm, out.pcm));

 	if (in.channelCount != out.channelCount)
-		addModule(new ApplyChannelMatrix(infc, isReading,
+		addModule(new ApplyChannelMatrix(outfc, isReading,
 			in.channelCount, out.channelCount,
 			in.pcm.minClip, in.pcm.maxClip,
 			track->channelMatrix));
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -26,6 +26,7 @@ TESTS = \
 	VirtualFile \
 	floatto24 \
 	query2 \
+	sixteen-stereo-to-eight-mono \
 	sixteen-to-eight \
 	testchannelmatrix \
 	testdouble \
@@ -139,6 +140,7 @@ printmarkers_SOURCES = printmarkers.c
 printmarkers_LDADD = $(LIBAUDIOFILE) -lm

 sixteen_to_eight_SOURCES = sixteen-to-eight.c TestUtilities.cpp TestUtilities.h
+sixteen_stereo_to_eight_mono_SOURCES = sixteen-stereo-to-eight-mono.c TestUtilities.cpp TestUtilities.h

 testchannelmatrix_SOURCES = testchannelmatrix.c TestUtilities.cpp TestUtilities.h

--- /dev/null
+++ b/test/sixteen-stereo-to-eight-mono.c
@@ -0,0 +1,118 @@
+/*
+	Audio File Library
+
+	Copyright 2000, Silicon Graphics, Inc.
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License along
+	with this program; if not, write to the Free Software Foundation, Inc.,
+	51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+/*
+	sixteen-stereo-to-eight-mono.c
+
+	This program tests the conversion from 2-channel 16-bit integers to
+	1-channel 8-bit	integers.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <limits.h>
+
+#include <audiofile.h>
+
+#include "TestUtilities.h"
+
+int main (int argc, char **argv)
+{
+	AFfilehandle file;
+	AFfilesetup setup;
+	int16_t frames16[] = {14298, 392, 3923, -683, 958, -1921};
+	int8_t frames8[] = {28, 6, -2};
+	int i, frameCount = 3;
+	int8_t byte;
+	AFframecount result;
+
+	setup = afNewFileSetup();
+
+	afInitFileFormat(setup, AF_FILE_WAVE);
+
+	afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
+	afInitChannels(setup, AF_DEFAULT_TRACK, 2);
+
+	char *testFileName;
+	if (!createTemporaryFile("sixteen-to-eight", &testFileName))
+	{
+		fprintf(stderr, "Could not create temporary file.\n");
+		exit(EXIT_FAILURE);
+	}
+
+	file = afOpenFile(testFileName, "w", setup);
+	if (file == AF_NULL_FILEHANDLE)
+	{
+		fprintf(stderr, "could not open file for writing\n");
+		exit(EXIT_FAILURE);
+	}
+
+	afFreeFileSetup(setup);
+
+	afWriteFrames(file, AF_DEFAULT_TRACK, frames16, frameCount);
+
+	afCloseFile(file);
+
+	file = afOpenFile(testFileName, "r", AF_NULL_FILESETUP);
+	if (file == AF_NULL_FILEHANDLE)
+	{
+		fprintf(stderr, "could not open file for reading\n");
+		exit(EXIT_FAILURE);
+	}
+
+	afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 8);
+	afSetVirtualChannels(file, AF_DEFAULT_TRACK, 1);
+
+	for (i=0; i<frameCount; i++)
+	{
+		/* Read one frame. */
+		result = afReadFrames(file, AF_DEFAULT_TRACK, &byte, 1);
+
+		if (result != 1)
+			break;
+
+		/* Compare the byte read with its precalculated value. */
+		if (memcmp(&byte, &frames8[i], 1) != 0)
+		{
+			printf("error\n");
+			printf("expected %d, got %d\n", frames8[i], byte);
+			exit(EXIT_FAILURE);
+		}
+		else
+		{
+#ifdef DEBUG
+			printf("got what was expected: %d\n", byte);
+#endif
+		}
+	}
+
+	afCloseFile(file);
+	unlink(testFileName);
+	free(testFileName);
+
+	exit(EXIT_SUCCESS);
+}


code:
From fde6d79fb8363c4a329a184ef0b107156602b225 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Thu, 27 Sep 2018 10:48:45 +0200
Subject: [PATCH] ModuleState: handle compress/decompress init failure

When the unit initcompress or initdecompress function fails,
m_fileModule is NULL. Return AF_FAIL in that case instead of
causing NULL pointer dereferences later.

Fixes #49
---
 libaudiofile/modules/ModuleState.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libaudiofile/modules/ModuleState.cpp b/libaudiofile/modules/ModuleState.cpp
index 0c29d7a..070fd9b 100644
--- a/libaudiofile/modules/ModuleState.cpp
+++ b/libaudiofile/modules/ModuleState.cpp
@@ -75,6 +75,9 @@ status ModuleState::initFileModule(AFfilehandle file, Track *track)
 		m_fileModule = unit->initcompress(track, file->m_fh, file->m_seekok,
 			file->m_fileFormat == AF_FILE_RAWDATA, &chunkFrames);

+	if (!m_fileModule)
+		return AF_FAIL;
+
 	if (unit->needsRebuffer)
 	{
 		assert(unit->nativeSampleFormat == AF_SAMPFMT_TWOSCOMP);


code:
From 822b732fd31ffcb78f6920001e9b1fbd815fa712 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Thu, 27 Sep 2018 12:11:12 +0200
Subject: [PATCH] SimpleModule: set output chunk framecount after pull

After pulling the data, set the output chunk to the amount of
frames we pulled so that the next module in the chain has the correct
frame count.

Fixes #50 and #51
---
 libaudiofile/modules/SimpleModule.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libaudiofile/modules/SimpleModule.cpp b/libaudiofile/modules/SimpleModule.cpp
index 2bae1eb..e87932c 100644
--- a/libaudiofile/modules/SimpleModule.cpp
+++ b/libaudiofile/modules/SimpleModule.cpp
@@ -26,6 +26,7 @@
 void SimpleModule::runPull()
 {
 	pull(m_outChunk->frameCount);
+	m_outChunk->frameCount = m_inChunk->frameCount;
 	run(*m_inChunk, *m_outChunk);
 }


code:
From: Antonio Larrosa <larrosa@kde.org>
Date: Mon, 6 Mar 2017 18:59:26 +0100
Subject: Actually fail when error occurs in parseFormat

When there's an unsupported number of bits per sample or an invalid
number of samples per block, don't only print an error message using
the error handler, but actually stop parsing the file.

This fixes #35 (also reported at
https://bugzilla.opensuse.org/show_bug.cgi?id=1026983 and
https://blogs.gentoo.org/ago/2017/02/20/audiofile-heap-based-buffer-overflow-in-imadecodeblockwave-ima-cpp/
)
---
 libaudiofile/WAVE.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libaudiofile/WAVE.cpp b/libaudiofile/WAVE.cpp
index 0fc48e8..d04b796 100644
--- a/libaudiofile/WAVE.cpp
+++ b/libaudiofile/WAVE.cpp
@@ -332,6 +332,7 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)
 			{
 				_af_error(AF_BAD_NOT_IMPLEMENTED,
 					"IMA ADPCM compression supports only 4 bits per sample");
+				return AF_FAIL;
 			}

 			int bytesPerBlock = (samplesPerBlock + 14) / 8 * 4 * channelCount;
@@ -339,6 +340,7 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)
 			{
 				_af_error(AF_BAD_CODEC_CONFIG,
 					"Invalid samples per block for IMA ADPCM compression");
+				return AF_FAIL;
 			}

 			track->f.sampleWidth = 16;


code:
From: Antonio Larrosa <larrosa@kde.org>
Date: Mon, 6 Mar 2017 18:02:31 +0100
Subject: clamp index values to fix index overflow in IMA.cpp

This fixes #33
(also reported at https://bugzilla.opensuse.org/show_bug.cgi?id=1026981
and https://blogs.gentoo.org/ago/2017/02/20/audiofile-global-buffer-overflow-in-decodesample-ima-cpp/)
---
 libaudiofile/modules/IMA.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libaudiofile/modules/IMA.cpp b/libaudiofile/modules/IMA.cpp
index 7476d44..df4aad6 100644
--- a/libaudiofile/modules/IMA.cpp
+++ b/libaudiofile/modules/IMA.cpp
@@ -169,7 +169,7 @@ int IMA::decodeBlockWAVE(const uint8_t *encoded, int16_t *decoded)
 		if (encoded[1] & 0x80)
 			m_adpcmState[c].previousValue -= 0x10000;

-		m_adpcmState[c].index = encoded[2];
+		m_adpcmState[c].index = clamp(encoded[2], 0, 88);

 		*decoded++ = m_adpcmState[c].previousValue;

@@ -210,7 +210,7 @@ int IMA::decodeBlockQT(const uint8_t *encoded, int16_t *decoded)
 			predictor -= 0x10000;

 		state.previousValue = clamp(predictor, MIN_INT16, MAX_INT16);
-		state.index = encoded[1] & 0x7f;
+		state.index = clamp(encoded[1] & 0x7f, 0, 88);
 		encoded += 2;

 		for (int n=0; n<m_framesPerPacket; n+=2)


code:
From: Antonio Larrosa <larrosa@kde.org>
Date: Mon, 6 Mar 2017 12:51:22 +0100
Subject: Always check the number of coefficients

When building the library with NDEBUG, asserts are eliminated
so it's better to always check that the number of coefficients
is inside the array range.

This fixes the 00191-audiofile-indexoob issue in #41
---
 libaudiofile/WAVE.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libaudiofile/WAVE.cpp b/libaudiofile/WAVE.cpp
index 9dd8511..0fc48e8 100644
--- a/libaudiofile/WAVE.cpp
+++ b/libaudiofile/WAVE.cpp
@@ -281,6 +281,12 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size)

 			/* numCoefficients should be at least 7. */
 			assert(numCoefficients >= 7 && numCoefficients <= 255);
+			if (numCoefficients < 7 || numCoefficients > 255)
+			{
+				_af_error(AF_BAD_HEADER,
+						"Bad number of coefficients");
+				return AF_FAIL;
+			}

 			m_msadpcmNumCoefficients = numCoefficients;


code:
From: Antonio Larrosa <larrosa@kde.org>
Date: Thu, 9 Mar 2017 10:21:18 +0100
Subject: Check for division by zero in BlockCodec::runPull

---
 libaudiofile/modules/BlockCodec.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libaudiofile/modules/BlockCodec.cpp b/libaudiofile/modules/BlockCodec.cpp
index 4731be1..eb2fb4d 100644
--- a/libaudiofile/modules/BlockCodec.cpp
+++ b/libaudiofile/modules/BlockCodec.cpp
@@ -47,7 +47,7 @@ void BlockCodec::runPull()

 	// Read the compressed data.
 	ssize_t bytesRead = read(m_inChunk->buffer, m_bytesPerPacket * blockCount);
-	int blocksRead = bytesRead >= 0 ? bytesRead / m_bytesPerPacket : 0;
+	int blocksRead = (bytesRead >= 0 && m_bytesPerPacket > 0) ? bytesRead / m_bytesPerPacket : 0;

 	// Decompress into m_outChunk.
 	for (int i=0; i<blocksRead; i++)


code:
Based on (hunks for changelog and Identy.cpp removed)
From ecbc07f0ed336187cc9a67c3363f89681b8b8f52 Mon Sep 17 00:00:00 2001
From: Michael Pruett <michael@68k.org>
Date: Tue, 5 Jul 2016 23:26:16 -0500
Subject: [PATCH] Fix type of test data arrays.

---
 ChangeLog         | 6 ++++++
 test/Identify.cpp | 3 ++-
 test/NeXT.cpp     | 7 ++++---
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/test/NeXT.cpp b/test/NeXT.cpp
index 7e39850..29af877 100644
--- a/test/NeXT.cpp
+++ b/test/NeXT.cpp
@@ -30,6 +30,7 @@
 #include <audiofile.h>
 #include <fcntl.h>
 #include <gtest/gtest.h>
+#include <stdint.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -37,7 +38,7 @@

 #include "TestUtilities.h"

-const char kDataUnspecifiedLength[] =
+const uint8_t kDataUnspecifiedLength[] =
 {
 	'.', 's', 'n', 'd',
 	0, 0, 0, 24, // offset of 24 bytes
@@ -57,7 +58,7 @@ const char kDataUnspecifiedLength[] =
 	0, 55
 };

-const char kDataTruncated[] =
+const uint8_t kDataTruncated[] =
 {
 	'.', 's', 'n', 'd',
 	0, 0, 0, 24, // offset of 24 bytes
@@ -152,7 +153,7 @@ TEST(NeXT, Truncated)
 	ASSERT_EQ(::unlink(testFileName.c_str()), 0);
 }

-const char kDataZeroChannels[] =
+const uint8_t kDataZeroChannels[] =
 {
 	'.', 's', 'n', 'd',
 	0, 0, 0, 24, // offset of 24 bytes


code:
Based on (hunk for changelog removed)
From b62c902dd258125cac86cd2df21fc898035a43d3 Mon Sep 17 00:00:00 2001
From: Michael Pruett <michael@68k.org>
Date: Mon, 29 Aug 2016 23:08:26 -0500
Subject: [PATCH] Fix undefined behavior in sign conversion.

---
 ChangeLog                           | 5 +++++
 libaudiofile/modules/SimpleModule.h | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/libaudiofile/modules/SimpleModule.h b/libaudiofile/modules/SimpleModule.h
index 03c6c69..bad85ad 100644
--- a/libaudiofile/modules/SimpleModule.h
+++ b/libaudiofile/modules/SimpleModule.h
@@ -123,7 +123,8 @@ struct signConverter
 	typedef typename IntTypes<Format>::UnsignedType UnsignedType;

 	static const int kScaleBits = (Format + 1) * CHAR_BIT - 1;
-	static const int kMinSignedValue = -1 << kScaleBits;
+	static const int kMaxSignedValue = (((1 << (kScaleBits - 1)) - 1) << 1) + 1;
+	static const int kMinSignedValue = -kMaxSignedValue - 1;

 	struct signedToUnsigned : public std::unary_function<SignedType, UnsignedType>
 	{


code:
From: Antonio Larrosa <larrosa@kde.org>
Date: Fri, 10 Mar 2017 15:40:02 +0100
Subject: Fix signature of multiplyCheckOverflow. It returns a bool, not an int

---
 libaudiofile/modules/MSADPCM.cpp | 2 +-
 sfcommands/sfconvert.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libaudiofile/modules/MSADPCM.cpp b/libaudiofile/modules/MSADPCM.cpp
index ef9c38c..d8c9553 100644
--- a/libaudiofile/modules/MSADPCM.cpp
+++ b/libaudiofile/modules/MSADPCM.cpp
@@ -116,7 +116,7 @@ int firstBitSet(int x)
 #define __has_builtin(x) 0
 #endif

-int multiplyCheckOverflow(int a, int b, int *result)
+bool multiplyCheckOverflow(int a, int b, int *result)
 {
 #if (defined __GNUC__ && __GNUC__ >= 5) || ( __clang__ && __has_builtin(__builtin_mul_overflow))
 	return __builtin_mul_overflow(a, b, result);
diff --git a/sfcommands/sfconvert.c b/sfcommands/sfconvert.c
index 970a3e4..367f7a5 100644
--- a/sfcommands/sfconvert.c
+++ b/sfcommands/sfconvert.c
@@ -60,7 +60,7 @@ int firstBitSet(int x)
 #define __has_builtin(x) 0
 #endif

-int multiplyCheckOverflow(int a, int b, int *result)
+bool multiplyCheckOverflow(int a, int b, int *result)
 {
 #if (defined __GNUC__ && __GNUC__ >= 5) || ( __clang__ && __has_builtin(__builtin_mul_overflow))
 	return __builtin_mul_overflow(a, b, result);


code:
Description: Remove usage of PATH_MAX in tests to fix FTBFS on Hurd.
 jcowgill: Removed Changelog changes
Author: Pino Toscano <toscano.pino@tiscali.it>
Origin: backport, https://github.com/mpruett/audiofile/commit/34c261034f1193a783196618f0052112e00fbcfe
Bug: https://github.com/mpruett/audiofile/pull/17
Bug-Debian: https://bugs.debian.org/762595
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/

--- a/test/TestUtilities.cpp
+++ b/test/TestUtilities.cpp
@@ -21,8 +21,8 @@
 #include "TestUtilities.h"

 #include <limits.h>
-#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>

 bool createTemporaryFile(const std::string &prefix, std::string *path)
@@ -35,12 +35,12 @@ bool createTemporaryFile(const std::stri
 	return true;
 }

-bool createTemporaryFile(const char *prefix, char *path)
+bool createTemporaryFile(const char *prefix, char **path)
 {
-	snprintf(path, PATH_MAX, "/tmp/%s-XXXXXX", prefix);
-	int fd = ::mkstemp(path);
-	if (fd < 0)
-		return false;
-	::close(fd);
-	return true;
+	*path = NULL;
+	std::string pathString;
+	bool result = createTemporaryFile(prefix, &pathString);
+	if (result)
+		*path = ::strdup(pathString.c_str());
+	return result;
 }
--- a/test/TestUtilities.h
+++ b/test/TestUtilities.h
@@ -53,7 +53,7 @@ extern "C" {

 #include <stdbool.h>

-bool createTemporaryFile(const char *prefix, char *path);
+bool createTemporaryFile(const char *prefix, char **path);

 #ifdef __cplusplus
 }
--- a/test/floatto24.c
+++ b/test/floatto24.c
@@ -86,8 +86,8 @@ int main (int argc, char **argv)
 	afInitChannels(setup, AF_DEFAULT_TRACK, 1);
 	afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_FLOAT, 32);

-	char testFileName[PATH_MAX];
-	if (!createTemporaryFile("floatto24", testFileName))
+	char *testFileName;
+	if (!createTemporaryFile("floatto24", &testFileName))
 	{
 		fprintf(stderr, "Could not create temporary file.\n");
 		exit(EXIT_FAILURE);
@@ -182,6 +182,7 @@ int main (int argc, char **argv)
 	}

 	unlink(testFileName);
+	free(testFileName);

 	exit(EXIT_SUCCESS);
 }
--- a/test/sixteen-to-eight.c
+++ b/test/sixteen-to-eight.c
@@ -57,8 +57,8 @@ int main (int argc, char **argv)
 	afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_UNSIGNED, 8);
 	afInitChannels(setup, AF_DEFAULT_TRACK, 1);

-	char testFileName[PATH_MAX];
-	if (!createTemporaryFile("sixteen-to-eight", testFileName))
+	char *testFileName;
+	if (!createTemporaryFile("sixteen-to-eight", &testFileName))
 	{
 		fprintf(stderr, "Could not create temporary file.\n");
 		exit(EXIT_FAILURE);
@@ -113,6 +113,7 @@ int main (int argc, char **argv)

 	afCloseFile(file);
 	unlink(testFileName);
+	free(testFileName);

 	exit(EXIT_SUCCESS);
 }
--- a/test/testchannelmatrix.c
+++ b/test/testchannelmatrix.c
@@ -39,7 +39,7 @@

 #include "TestUtilities.h"

-static char sTestFileName[PATH_MAX];
+static char *sTestFileName;

 const short samples[] = {300, -300, 515, -515, 2315, -2315, 9154, -9154};
 #define SAMPLE_COUNT (sizeof (samples) / sizeof (short))
@@ -47,7 +47,11 @@ const short samples[] = {300, -300, 515,

 void cleanup (void)
 {
-	unlink(sTestFileName);
+	if (sTestFileName)
+	{
+		unlink(sTestFileName);
+		free(sTestFileName);
+	}
 }

 void ensure (int condition, const char *message)
@@ -76,7 +80,7 @@ int main (void)
 	afInitFileFormat(setup, AF_FILE_AIFFC);

 	/* Write stereo data to test file. */
-	ensure(createTemporaryFile("testchannelmatrix", sTestFileName),
+	ensure(createTemporaryFile("testchannelmatrix", &sTestFileName),
 		"could not create temporary file");
 	file = afOpenFile(sTestFileName, "w", setup);
 	ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing");
--- a/test/testdouble.c
+++ b/test/testdouble.c
@@ -38,7 +38,7 @@

 #include "TestUtilities.h"

-static char sTestFileName[PATH_MAX];
+static char *sTestFileName;

 const double samples[] =
 	{1.0, 0.6, -0.3, 0.95, 0.2, -0.6, 0.9, 0.4, -0.22, 0.125, 0.1, -0.4};
@@ -48,7 +48,11 @@ void testdouble (int fileFormat);

 void cleanup (void)
 {
-	unlink(sTestFileName);
+	if (sTestFileName)
+	{
+		unlink(sTestFileName);
+		free(sTestFileName);
+	}
 }

 void ensure (int condition, const char *message)
@@ -96,7 +100,7 @@ void testdouble (int fileFormat)
 	afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_DOUBLE, 64);
 	afInitChannels(setup, AF_DEFAULT_TRACK, 2);

-	ensure(createTemporaryFile("testdouble", sTestFileName),
+	ensure(createTemporaryFile("testdouble", &sTestFileName),
 		"could not create temporary file");
 	file = afOpenFile(sTestFileName, "w", setup);
 	ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing");
--- a/test/testfloat.c
+++ b/test/testfloat.c
@@ -38,7 +38,7 @@

 #include "TestUtilities.h"

-static char sTestFileName[PATH_MAX];
+static char *sTestFileName;

 const float samples[] =
 	{1.0, 0.6, -0.3, 0.95, 0.2, -0.6, 0.9, 0.4, -0.22, 0.125, 0.1, -0.4};
@@ -48,7 +48,11 @@ void testfloat (int fileFormat);

 void cleanup (void)
 {
-	unlink(sTestFileName);
+	if (sTestFileName)
+	{
+		unlink(sTestFileName);
+		free(sTestFileName);
+	}
 }

 void ensure (int condition, const char *message)
@@ -96,7 +100,7 @@ void testfloat (int fileFormat)
 	afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_FLOAT, 32);
 	afInitChannels(setup, AF_DEFAULT_TRACK, 2);

-	ensure(createTemporaryFile("testfloat", sTestFileName),
+	ensure(createTemporaryFile("testfloat", &sTestFileName),
 		"could not create temporary file");
 	file = afOpenFile(sTestFileName, "w", setup);
 	ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing");
--- a/test/testmarkers.c
+++ b/test/testmarkers.c
@@ -32,15 +32,19 @@

 #include "TestUtilities.h"

-static char sTestFileName[PATH_MAX];
+static char *sTestFileName;

 #define FRAME_COUNT 200

 void cleanup (void)
 {
+	if (sTestFileName)
+	{
 #ifndef DEBUG
-	unlink(sTestFileName);
+		unlink(sTestFileName);
 #endif
+		free(sTestFileName);
+	}
 }

 void ensure (int condition, const char *message)
@@ -127,7 +131,7 @@ int testmarkers (int fileformat)

 int main (void)
 {
-	ensure(createTemporaryFile("testmarkers", sTestFileName),
+	ensure(createTemporaryFile("testmarkers", &sTestFileName),
 		"could not create temporary file");

 	testmarkers(AF_FILE_AIFF);
--- a/test/twentyfour.c
+++ b/test/twentyfour.c
@@ -71,8 +71,8 @@ int main (int argc, char **argv)
 	afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 24);
 	afInitChannels(setup, AF_DEFAULT_TRACK, 1);

-	char testFileName[PATH_MAX];
-	if (!createTemporaryFile("twentyfour", testFileName))
+	char *testFileName;
+	if (!createTemporaryFile("twentyfour", &testFileName))
 	{
 		fprintf(stderr, "could not create temporary file\n");
 		exit(EXIT_FAILURE);
@@ -239,6 +239,7 @@ int main (int argc, char **argv)
 		exit(EXIT_FAILURE);
 	}
 	unlink(testFileName);
+	free(testFileName);

 	exit(EXIT_SUCCESS);
 }
--- a/test/twentyfour2.c
+++ b/test/twentyfour2.c
@@ -45,15 +45,19 @@

 #include "TestUtilities.h"

-static char sTestFileName[PATH_MAX];
+static char *sTestFileName;

 #define FRAME_COUNT 10000

 void cleanup (void)
 {
+	if (sTestFileName)
+	{
 #ifndef DEBUG
-	unlink(sTestFileName);
+		unlink(sTestFileName);
 #endif
+		free(sTestFileName);
+	}
 }

 void ensure (int condition, const char *message)
@@ -78,7 +82,7 @@ int main (void)
 	afInitChannels(setup, AF_DEFAULT_TRACK, 1);
 	afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 24);

-	ensure(createTemporaryFile("twentyfour2", sTestFileName),
+	ensure(createTemporaryFile("twentyfour2", &sTestFileName),
 		"could not create temporary file");
 	file = afOpenFile(sTestFileName, "w", setup);
 	ensure(file != NULL, "could not open test file for writing");
--- a/test/writealaw.c
+++ b/test/writealaw.c
@@ -53,7 +53,7 @@

 #include "TestUtilities.h"

-static char sTestFileName[PATH_MAX];
+static char *sTestFileName;

 #define FRAME_COUNT 16
 #define SAMPLE_COUNT FRAME_COUNT
@@ -62,9 +62,13 @@ void testalaw (int fileFormat);

 void cleanup (void)
 {
+	if (sTestFileName)
+	{
 #ifndef DEBUG
-	unlink(sTestFileName);
+		unlink(sTestFileName);
 #endif
+		free(sTestFileName);
+	}
 }

 void ensure (int condition, const char *message)
@@ -113,7 +117,7 @@ void testalaw (int fileFormat)
 	afInitFileFormat(setup, fileFormat);
 	afInitChannels(setup, AF_DEFAULT_TRACK, 1);

-	ensure(createTemporaryFile("writealaw", sTestFileName),
+	ensure(createTemporaryFile("writealaw", &sTestFileName),
 		"could not create temporary file");
 	file = afOpenFile(sTestFileName, "w", setup);
 	afFreeFileSetup(setup);
--- a/test/writeraw.c
+++ b/test/writeraw.c
@@ -44,13 +44,17 @@

 #include "TestUtilities.h"

-static char sTestFileName[PATH_MAX];
+static char *sTestFileName;

 void cleanup (void)
 {
+	if (sTestFileName)
+	{
 #ifndef DEBUG
-	unlink(sTestFileName);
+		unlink(sTestFileName);
 #endif
+		free(sTestFileName);
+	}
 }

 void ensure (int condition, const char *message)
@@ -84,7 +88,7 @@ int main (int argc, char **argv)
 	afInitChannels(setup, AF_DEFAULT_TRACK, 1);
 	afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);

-	ensure(createTemporaryFile("writeraw", sTestFileName),
+	ensure(createTemporaryFile("writeraw", &sTestFileName),
 		"could not create temporary file");
 	file = afOpenFile(sTestFileName, "w", setup);
 	ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing");
--- a/test/writeulaw.c
+++ b/test/writeulaw.c
@@ -53,7 +53,7 @@

 #include "TestUtilities.h"

-static char sTestFileName[PATH_MAX];
+static char *sTestFileName;

 #define FRAME_COUNT 16
 #define SAMPLE_COUNT FRAME_COUNT
@@ -62,9 +62,13 @@ void testulaw (int fileFormat);

 void cleanup (void)
 {
+	if (sTestFileName)
+	{
 #ifndef DEBUG
-	unlink(sTestFileName);
+		unlink(sTestFileName);
 #endif
+		free(sTestFileName);
+	}
 }

 void ensure (int condition, const char *message)
@@ -113,7 +117,7 @@ void testulaw (int fileFormat)
 	afInitFileFormat(setup, fileFormat);
 	afInitChannels(setup, AF_DEFAULT_TRACK, 1);

-	ensure(createTemporaryFile("writeulaw", sTestFileName),
+	ensure(createTemporaryFile("writeulaw", &sTestFileName),
 		"could not create temporary file");
 	file = afOpenFile(sTestFileName, "w", setup);
 	afFreeFileSetup(setup);


code:
From: Antonio Larrosa <larrosa@kde.org>
Date: Mon, 6 Mar 2017 13:54:52 +0100
Subject: Check for multiplication overflow in sfconvert

Checks that a multiplication doesn't overflow when
calculating the buffer size, and if it overflows,
reduce the buffer size instead of failing.

This fixes the 00192-audiofile-signintoverflow-sfconvert case
in #41
---
 sfcommands/sfconvert.c | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/sfcommands/sfconvert.c b/sfcommands/sfconvert.c
index 80a1bc4..970a3e4 100644
--- a/sfcommands/sfconvert.c
+++ b/sfcommands/sfconvert.c
@@ -45,6 +45,33 @@ void printusage (void);
 void usageerror (void);
 bool copyaudiodata (AFfilehandle infile, AFfilehandle outfile, int trackid);

+int firstBitSet(int x)
+{
+        int position=0;
+        while (x!=0)
+        {
+                x>>=1;
+                ++position;
+        }
+        return position;
+}
+
+#ifndef __has_builtin
+#define __has_builtin(x) 0
+#endif
+
+int multiplyCheckOverflow(int a, int b, int *result)
+{
+#if (defined __GNUC__ && __GNUC__ >= 5) || ( __clang__ && __has_builtin(__builtin_mul_overflow))
+	return __builtin_mul_overflow(a, b, result);
+#else
+	if (firstBitSet(a)+firstBitSet(b)>31) // int is signed, so we can't use 32 bits
+		return true;
+	*result = a * b;
+	return false;
+#endif
+}
+
 int main (int argc, char **argv)
 {
 	if (argc == 2)
@@ -323,8 +350,11 @@ bool copyaudiodata (AFfilehandle infile, AFfilehandle outfile, int trackid)
 {
 	int frameSize = afGetVirtualFrameSize(infile, trackid, 1);

-	const int kBufferFrameCount = 65536;
-	void *buffer = malloc(kBufferFrameCount * frameSize);
+	int kBufferFrameCount = 65536;
+	int bufferSize;
+	while (multiplyCheckOverflow(kBufferFrameCount, frameSize, &bufferSize))
+		kBufferFrameCount /= 2;
+	void *buffer = malloc(bufferSize);

 	AFframecount totalFrames = afGetFrameCount(infile, AF_DEFAULT_TRACK);
 	AFframecount totalFramesWritten = 0;


code:
From: Antonio Larrosa <larrosa@kde.org>
Date: Mon, 6 Mar 2017 13:43:53 +0100
Subject: Check for multiplication overflow in MSADPCM decodeSample

Check for multiplication overflow (using __builtin_mul_overflow
if available) in MSADPCM.cpp decodeSample and return an empty
decoded block if an error occurs.

This fixes the 00193-audiofile-signintoverflow-MSADPCM case of #41
---
 libaudiofile/modules/BlockCodec.cpp |  5 ++--
 libaudiofile/modules/MSADPCM.cpp    | 47 +++++++++++++++++++++++++++++++++----
 2 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/libaudiofile/modules/BlockCodec.cpp b/libaudiofile/modules/BlockCodec.cpp
index 45925e8..4731be1 100644
--- a/libaudiofile/modules/BlockCodec.cpp
+++ b/libaudiofile/modules/BlockCodec.cpp
@@ -52,8 +52,9 @@ void BlockCodec::runPull()
 	// Decompress into m_outChunk.
 	for (int i=0; i<blocksRead; i++)
 	{
-		decodeBlock(static_cast<const uint8_t *>(m_inChunk->buffer) + i * m_bytesPerPacket,
-			static_cast<int16_t *>(m_outChunk->buffer) + i * m_framesPerPacket * m_track->f.channelCount);
+		if (decodeBlock(static_cast<const uint8_t *>(m_inChunk->buffer) + i * m_bytesPerPacket,
+			static_cast<int16_t *>(m_outChunk->buffer) + i * m_framesPerPacket * m_track->f.channelCount)==0)
+			break;

 		framesRead += m_framesPerPacket;
 	}
diff --git a/libaudiofile/modules/MSADPCM.cpp b/libaudiofile/modules/MSADPCM.cpp
index 8ea3c85..ef9c38c 100644
--- a/libaudiofile/modules/MSADPCM.cpp
+++ b/libaudiofile/modules/MSADPCM.cpp
@@ -101,24 +101,60 @@ static const int16_t adaptationTable[] =
 	768, 614, 512, 409, 307, 230, 230, 230
 };

+int firstBitSet(int x)
+{
+        int position=0;
+        while (x!=0)
+        {
+                x>>=1;
+                ++position;
+        }
+        return position;
+}
+
+#ifndef __has_builtin
+#define __has_builtin(x) 0
+#endif
+
+int multiplyCheckOverflow(int a, int b, int *result)
+{
+#if (defined __GNUC__ && __GNUC__ >= 5) || ( __clang__ && __has_builtin(__builtin_mul_overflow))
+	return __builtin_mul_overflow(a, b, result);
+#else
+	if (firstBitSet(a)+firstBitSet(b)>31) // int is signed, so we can't use 32 bits
+		return true;
+	*result = a * b;
+	return false;
+#endif
+}
+
+
 // Compute a linear PCM value from the given differential coded value.
 static int16_t decodeSample(ms_adpcm_state &state,
-	uint8_t code, const int16_t *coefficient)
+	uint8_t code, const int16_t *coefficient, bool *ok=NULL)
 {
 	int linearSample = (state.sample1 * coefficient[0] +
 		state.sample2 * coefficient[1]) >> 8;
+	int delta;

 	linearSample += ((code & 0x08) ? (code - 0x10) : code) * state.delta;

 	linearSample = clamp(linearSample, MIN_INT16, MAX_INT16);

-	int delta = (state.delta * adaptationTable[code]) >> 8;
+	if (multiplyCheckOverflow(state.delta, adaptationTable[code], &delta))
+	{
+                if (ok) *ok=false;
+		_af_error(AF_BAD_COMPRESSION, "Error decoding sample");
+		return 0;
+	}
+	delta >>= 8;
 	if (delta < 16)
 		delta = 16;

 	state.delta = delta;
 	state.sample2 = state.sample1;
 	state.sample1 = linearSample;
+	if (ok) *ok=true;

 	return static_cast<int16_t>(linearSample);
 }
@@ -212,13 +248,16 @@ int MSADPCM::decodeBlock(const uint8_t *encoded, int16_t *decoded)
 	{
 		uint8_t code;
 		int16_t newSample;
+		bool ok;

 		code = *encoded >> 4;
-		newSample = decodeSample(*state[0], code, coefficient[0]);
+		newSample = decodeSample(*state[0], code, coefficient[0], &ok);
+		if (!ok) return 0;
 		*decoded++ = newSample;

 		code = *encoded & 0x0f;
-		newSample = decodeSample(*state[1], code, coefficient[1]);
+		newSample = decodeSample(*state[1], code, coefficient[1], &ok);
+		if (!ok) return 0;
 		*decoded++ = newSample;

 		encoded++;


code:
Skip tests that rely on the `amhello' tarball that comes with Automake.
That tarball's `configure' uses #!/bin/sh, but we can't easily patch it.

diff --git a/t/amhello-binpkg.sh b/t/amhello-binpkg.sh
index fa88cc6..d988cee 100755
--- a/t/amhello-binpkg.sh
+++ b/t/amhello-binpkg.sh
@@ -17,6 +17,7 @@
 # Test an example from the manual about the 'amhello' package:
 # using DESTDIR to build simple, no-frills binary packages.

+exit 77
 am_create_testdir=empty
 . ./defs || exit 1

diff --git a/t/amhello-cflags.sh b/t/amhello-cflags.sh
index 666011f..2a95e3c 100755
--- a/t/amhello-cflags.sh
+++ b/t/amhello-cflags.sh
@@ -18,6 +18,7 @@
 # using VPATH builds to configure the same package with different
 # options.

+exit 77
 am_create_testdir=empty
 required=gcc
 . ./defs || exit 1
diff --git a/t/amhello-cross-compile.sh b/t/amhello-cross-compile.sh
index 708abda..2ee4292 100755
--- a/t/amhello-cross-compile.sh
+++ b/t/amhello-cross-compile.sh
@@ -17,6 +17,7 @@
 # Test an example from the manual about the 'amhello' package:
 # cross-compiling a package from Linux/Unix to MinGW.

+exit 77
 am_create_testdir=empty
 required=i586-mingw32msvc-gcc
 . ./defs || exit 1


code:
Fix build with GLib 2.68 and later.

Taken from upstream pull request:
https://github.com/autotrace/autotrace/pull/41

diff --git a/src/autotrace.h b/src/autotrace.h
--- a/src/autotrace.h
+++ b/src/autotrace.h
@@ -23,6 +23,9 @@

 #include <stdio.h>

+#include "types.h"
+#include "color.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif                          /* __cplusplus */
@@ -35,9 +38,6 @@ extern "C" {
  * Typedefs
  * ===================================================================== */

-#include "types.h"
-#include "color.h"
-
 /* Third degree is the highest we deal with.  */
   enum _at_polynomial_degree {
     AT_LINEARTYPE = 1,
diff --git a/src/color.h b/src/color.h
--- a/src/color.h
+++ b/src/color.h
@@ -24,6 +24,10 @@
 #include <glib.h>
 #include <glib-object.h>

+#ifdef __cplusplus
+extern "C" {
+#endif                          /* __cplusplus */
+
 typedef struct _at_color at_color;
 struct _at_color {
   guint8 r;
@@ -43,4 +47,7 @@ void at_color_free(at_color * color);
 GType at_color_get_type(void);
 #define AT_TYPE_COLOR (at_color_get_type ())

+#ifdef __cplusplus
+}
+#endif                          /* __cplusplus */
 #endif /* not AT_COLOR_H */


code:
Don't "mkdir $(localstatedir)" since we can't do it (/var).

--- avahi-0.6.27/avahi-daemon/Makefile.in	2010-07-13 05:06:35.000000000 +0200
+++ avahi-0.6.27/avahi-daemon/Makefile.in	2010-07-13 18:03:45.000000000 +0200
@@ -1625,7 +1625,6 @@
 	done

 install-data-local:
-	test -z "$(avahi_runtime_dir)" || $(MKDIR_P) "$(DESTDIR)$(avahi_runtime_dir)"

 update-systemd:
 	curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c > sd-daemon.c


code:
Patch by Andreas Enge to force installation of libraries into lib
independently of the architecture, instead of lib32 or lib64.
On x86_64, the C library path coded in CMAKE_C_IMPLICIT_LINK_DIRECTORIES
contains a library (jack) installed into lib64, which forces lib64
for avidemux with the original code.

diff -u -r avidemux_2.6.8.orig/cmake/admInstallDir.cmake avidemux_2.6.8/cmake/admInstallDir.cmake
--- avidemux_2.6.8.orig/cmake/admInstallDir.cmake	2014-03-12 07:15:23.000000000 +0100
+++ avidemux_2.6.8/cmake/admInstallDir.cmake	2015-07-26 14:31:10.418459984 +0200
@@ -16,13 +16,7 @@
                 MESSAGE(STATUS "No install dir provided, using /usr/local")
         ENDIF(NOT AVIDEMUX_INSTALL_DIR )
         SET(AVIDEMUX_BIN_DIR ${AVIDEMUX_INSTALL_DIR}/bin)
-        IF(CMAKE_C_IMPLICIT_LINK_DIRECTORIES MATCHES "\\/lib64([; ]|$)")
-                SET(AVIDEMUX_RELATIVE_LIB_DIR lib64)
-        ELSEIF(CMAKE_C_IMPLICIT_LINK_DIRECTORIES MATCHES "\\/lib32([; ]|$)")
-                SET(AVIDEMUX_RELATIVE_LIB_DIR lib32)
-        ELSE(CMAKE_C_IMPLICIT_LINK_DIRECTORIES MATCHES "\\/lib64([; ]|$)")
-                SET(AVIDEMUX_RELATIVE_LIB_DIR lib)
-        ENDIF(CMAKE_C_IMPLICIT_LINK_DIRECTORIES MATCHES "\\/lib64([; ]|$)")
+        SET(AVIDEMUX_RELATIVE_LIB_DIR lib)
         SET(AVIDEMUX_LIB_DIR ${AVIDEMUX_INSTALL_DIR}/${AVIDEMUX_RELATIVE_LIB_DIR})
 ENDIF(WIN32)
 SET(AVIDEMUX_INCLUDE_DIR ${AVIDEMUX_INSTALL_DIR}/include)


code:
Do not introduce timestamps in PNG files (for icons).
See <https://wiki.debian.org/ReproducibleBuilds/TimestampsInPNG>.

--- awesome-3.4.15/CMakeLists.txt	2013-02-11 14:50:21.000000000 +0100
+++ awesome-3.4.15/CMakeLists.txt	2016-06-16 13:59:30.528125439 +0200
@@ -295,7 +295,7 @@ macro(a_icon_convert match replacement i
         set(ALL_ICONS ${ALL_ICONS} ${output})

         add_custom_command(
-            COMMAND ${CONVERT_EXECUTABLE} ${input} -strip ${ARGN} ${output}
+            COMMAND ${CONVERT_EXECUTABLE} +set date:create +set date:modify -define png:exclude-chunk=time ${input} -strip ${ARGN} ${output}
             OUTPUT  ${output}
             DEPENDS ${input}
             VERBATIM)


code:
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,10 @@ endif()

 option(BYO_CRYPTO "Set this if you want to provide your own cryptography implementation. This will cause the defaults to not be compiled." OFF)

+if (DEFINED ENV{CMAKE_PREFIX_PATH})
+    set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
+endif()
+
 if (DEFINED CMAKE_PREFIX_PATH)
     file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
 endif()


code:
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,10 @@
 cmake_minimum_required (VERSION 3.1)
 project (aws-c-event-stream C)

+if (DEFINED ENV{CMAKE_PREFIX_PATH})
+    set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
+endif()
+
 if (DEFINED CMAKE_PREFIX_PATH)
     file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
 endif()


code:
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,10 @@ if (POLICY CMP0069)
     cmake_policy(SET CMP0069 NEW) # Enable LTO/IPO if available in the compiler, see AwsCFlags
 endif()

+if (DEFINED ENV{CMAKE_PREFIX_PATH})
+    set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
+endif()
+
 if (DEFINED CMAKE_PREFIX_PATH)
     file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
 endif()


code:
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -52,8 +52,8 @@ add_test_case(local_socket_communication)
 add_net_test_case(tcp_socket_communication)
 add_net_test_case(udp_socket_communication)
 add_test_case(udp_bind_connect_communication)
-add_net_test_case(connect_timeout)
-add_net_test_case(connect_timeout_cancelation)
+#add_net_test_case(connect_timeout)
+#add_net_test_case(connect_timeout_cancelation)
 if (USE_VSOCK)
 	add_test_case(vsock_loopback_socket_communication)
 endif ()
@@ -64,7 +64,7 @@ add_test_case(incoming_tcp_sock_errors)
 add_test_case(incoming_duplicate_tcp_bind_errors)
 add_test_case(incoming_udp_sock_errors)
 add_test_case(wrong_thread_read_write_fails)
-add_net_test_case(cleanup_before_connect_or_timeout_doesnt_explode)
+#add_net_test_case(cleanup_before_connect_or_timeout_doesnt_explode)
 add_test_case(cleanup_in_accept_doesnt_explode)
 add_test_case(cleanup_in_write_cb_doesnt_explode)
 add_test_case(sock_write_cb_is_async)
@@ -81,21 +81,21 @@ add_test_case(channel_tasks_run)
 add_test_case(channel_rejects_post_shutdown_tasks)
 add_test_case(channel_cancels_pending_tasks)
 add_test_case(channel_duplicate_shutdown)
-add_net_test_case(channel_connect_some_hosts_timeout)
+#add_net_test_case(channel_connect_some_hosts_timeout)

-add_net_test_case(test_default_with_ipv6_lookup)
+#add_net_test_case(test_default_with_ipv6_lookup)
 add_test_case(test_resolver_ipv6_address_lookup)
-add_net_test_case(test_default_with_multiple_lookups)
+#add_net_test_case(test_default_with_multiple_lookups)
 add_test_case(test_resolver_ipv4_address_lookup)
-add_net_test_case(test_default_with_ipv4_only_lookup)
+#add_net_test_case(test_default_with_ipv4_only_lookup)
 add_test_case(test_resolver_ttls)
 add_test_case(test_resolver_connect_failure_recording)
 add_test_case(test_resolver_ttl_refreshes_on_resolve)

 add_net_test_case(test_resolver_listener_create_destroy)
-add_net_test_case(test_resolver_add_listener_before_host)
-add_net_test_case(test_resolver_add_listener_after_host)
-add_net_test_case(test_resolver_add_multiple_listeners_fn)
+#add_net_test_case(test_resolver_add_listener_before_host)
+#add_net_test_case(test_resolver_add_listener_after_host)
+#add_net_test_case(test_resolver_add_multiple_listeners_fn)
 add_net_test_case(test_resolver_listener_host_re_add_fn)
 add_net_test_case(test_resolver_listener_multiple_results)
 add_net_test_case(test_resolver_listener_address_expired_fn)
@@ -119,20 +119,20 @@ add_test_case(socket_handler_close)
 if (NOT BYO_CRYPTO)
     add_net_test_case(test_concurrent_cert_import)
     add_test_case(tls_channel_echo_and_backpressure_test)
-    add_net_test_case(tls_client_channel_negotiation_error_expired)
-    add_net_test_case(tls_client_channel_negotiation_error_wrong_host)
-    add_net_test_case(tls_client_channel_negotiation_error_self_signed)
-    add_net_test_case(tls_client_channel_negotiation_error_untrusted_root)
+    #add_net_test_case(tls_client_channel_negotiation_error_expired)
+    #add_net_test_case(tls_client_channel_negotiation_error_wrong_host)
+    #add_net_test_case(tls_client_channel_negotiation_error_self_signed)
+    #add_net_test_case(tls_client_channel_negotiation_error_untrusted_root)
     #track these down in s2n and find out why that aren't failing.
     #add_net_test_case(tls_client_channel_negotiation_error_revoked)
     #add_net_test_case(tls_client_channel_negotiation_error_pinning)
-    add_net_test_case(tls_client_channel_negotiation_error_socket_closed)
-    add_net_test_case(tls_client_channel_negotiation_success)
-    add_net_test_case(tls_client_channel_negotiation_success_ecc256)
-    add_net_test_case(tls_client_channel_negotiation_success_ecc384)
+    #add_net_test_case(tls_client_channel_negotiation_error_socket_closed)
+    #add_net_test_case(tls_client_channel_negotiation_success)
+    #add_net_test_case(tls_client_channel_negotiation_success_ecc256)
+    #add_net_test_case(tls_client_channel_negotiation_success_ecc384)
     add_net_test_case(tls_server_multiple_connections)
     add_net_test_case(tls_server_hangup_during_negotiation)
-    add_net_test_case(tls_client_channel_no_verify)
+    #add_net_test_case(tls_client_channel_no_verify)
     add_net_test_case(test_tls_negotiation_timeout)
     add_net_test_case(tls_double_channel)
     add_net_test_case(alpn_successfully_negotiates)


code:
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,10 @@
     cmake_policy(SET CMP0069 NEW) # Enable LTO/IPO if available in the compiler, see AwsCFlags
 endif()

+if (DEFINED ENV{CMAKE_PREFIX_PATH})
+    set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
+endif()
+
 if (DEFINED CMAKE_PREFIX_PATH)
     file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
 endif()


code:
This patch adds the "sigc" and "std" namespace prefixes where needed.  It also
replaces a double single-argument "bind" with a single two-argument "bind",
because the former would confuse the compiler.

The patch has been sent to the developer on 2016-09-26.

--- azr3-jack-1.2.3/azr3/knob.cpp	2016-09-26 10:29:27.653375902 +0200
+++ azr3-jack-1.2.3/azr3/knob.cpp	2016-09-26 10:29:38.693430647 +0200
@@ -44,7 +44,7 @@
   set_size_request(44, 44);
   add_events(EXPOSURE_MASK | BUTTON1_MOTION_MASK |
              BUTTON_PRESS_MASK | SCROLL_MASK);
-  m_adj.signal_value_changed().connect(mem_fun(*this, &Knob::queue_draw));
+  m_adj.signal_value_changed().connect(sigc::mem_fun(*this, &Knob::queue_draw));
 }

--- azr3-jack-1.2.3/azr3/drawbar.cpp	2016-09-26 10:27:40.632845216 +0200
+++ azr3-jack-1.2.3/azr3/drawbar.cpp	2016-09-26 10:27:48.952886473 +0200
@@ -37,7 +37,7 @@
   set_size_request(22, 150);
   add_events(EXPOSURE_MASK | BUTTON1_MOTION_MASK |
              BUTTON_PRESS_MASK | SCROLL_MASK);
-  m_adj.signal_value_changed().connect(mem_fun(*this, &Drawbar::queue_draw));
+  m_adj.signal_value_changed().connect(sigc::mem_fun(*this, &Drawbar::queue_draw));
 }

--- azr3-jack-1.2.3/azr3/switch.cpp	2016-09-26 10:28:48.169180111 +0200
+++ azr3-jack-1.2.3/azr3/switch.cpp	2016-09-26 10:28:55.713217520 +0200
@@ -49,7 +49,7 @@
   }
   set_size_request(m_width, m_height);
   add_events(EXPOSURE_MASK | BUTTON_PRESS_MASK | SCROLL_MASK);
-  m_adj.signal_value_changed().connect(mem_fun(*this, &Switch::queue_draw));
+  m_adj.signal_value_changed().connect(sigc::mem_fun(*this, &Switch::queue_draw));
 }

--- azr3-jack-1.2.3/azr3/azr3gui.cpp	2016-09-26 09:05:10.106963561 +0200
+++ azr3-jack-1.2.3/azr3/azr3gui.cpp	2016-09-26 10:26:47.480581648 +0200
@@ -73,19 +73,19 @@
   m_tbox = add_textbox(m_fbox, pixmap, 391, 19, 3, 140, 39);
   m_tbox->add_events(SCROLL_MASK);
   m_tbox->signal_scroll_display.
-    connect(mem_fun(*this, &AZR3GUI::display_scroll));
+    connect(sigc::mem_fun(*this, &AZR3GUI::display_scroll));
   m_splitpoint_adj = new Adjustment(0, 0, 1);
   m_adj[n_splitpoint] = m_splitpoint_adj;
   m_splitpoint_adj->signal_value_changed().
-    connect(mem_fun(*this, &AZR3GUI::splitpoint_changed));
+    connect(sigc::mem_fun(*this, &AZR3GUI::splitpoint_changed));
   Menu* menu = create_menu();
   m_tbox->signal_button_press_event().
-    connect(bind(mem_fun(*this, &AZR3GUI::popup_menu), menu));
+    connect(sigc::bind(sigc::mem_fun(*this, &AZR3GUI::popup_menu), menu));

   // keyboard split switch
   m_splitswitch = add_switch(m_fbox, -1, 537, 49, Switch::Mini);
   m_splitswitch->get_adjustment().signal_value_changed().
-    connect(mem_fun(*this, &AZR3GUI::splitbox_clicked));
+    connect(sigc::mem_fun(*this, &AZR3GUI::splitbox_clicked));

   // upper knobs
   add_switch(m_fbox, n_mono, 61, 105, Switch::Mini);
@@ -141,8 +141,8 @@
   // mode switcher
   Widget* eb = add_clickbox(m_fbox, 14, 319, 14, 44);
   eb->signal_button_press_event().
-    connect(sigc::hide(bind(bind(mem_fun(*this, &AZR3GUI::change_mode),
-				 ref(m_fbox)), false)));
+    connect(sigc::hide(sigc::bind(sigc::mem_fun(*this, &AZR3GUI::change_mode),
+                                  false, std::ref(m_fbox))));
   m_fx_widgets.push_back(eb);

   // Mr Valve controls
@@ -182,8 +182,8 @@
   // mode switcher 2
   Widget* eb2 = add_clickbox(m_vbox, 14, 53, 14, 44);
   eb2->signal_button_press_event().
-    connect(sigc::hide(bind(bind(mem_fun(*this, &AZR3GUI::change_mode),
-				 ref(m_fbox)), true)));
+    connect(sigc::hide(sigc::bind(sigc::mem_fun(*this, &AZR3GUI::change_mode),
+                                  true, std::ref(m_fbox))));

   // vibrato controls
   add_switch(m_vbox, n_1_vibrato, 39, 17, Switch::Green);
@@ -352,9 +352,9 @@
   knob->set_style(s);
   if (port >= 0 && port < m_adj.size()) {
     knob->get_adjustment().signal_value_changed().
-      connect(compose(bind<0>(mem_fun(*this, &AZR3GUI::control_changed), port),
-		      mem_fun(knob->get_adjustment(),
-			      &Adjustment::get_value)));
+      connect(compose(sigc::bind<0>(sigc::mem_fun(*this, &AZR3GUI::control_changed), port),
+		      sigc::mem_fun(knob->get_adjustment(),
+                                    &Adjustment::get_value)));
     assert(m_adj[port] == 0);
     m_adj[port] = &knob->get_adjustment();
   }
@@ -382,8 +382,8 @@
   db->set_style(s);
   if (port >= 0 && port < m_adj.size()) {
     db->get_adjustment().signal_value_changed().
-      connect(compose(bind<0>(mem_fun(*this, &AZR3GUI::control_changed), port),
-		      mem_fun(db->get_adjustment(), &Adjustment::get_value)));
+      connect(compose(sigc::bind<0>(sigc::mem_fun(*this, &AZR3GUI::control_changed), port),
+		      sigc::mem_fun(db->get_adjustment(), &Adjustment::get_value)));
     assert(m_adj[port] == 0);
     m_adj[port] = &db->get_adjustment();
   }
@@ -397,8 +397,8 @@
   fbox.put(*sw, xoffset, yoffset);
   if (port >= 0 && port < m_adj.size()) {
     sw->get_adjustment().signal_value_changed().
-      connect(compose(bind<0>(mem_fun(*this, &AZR3GUI::control_changed),port),
-		      mem_fun(sw->get_adjustment(), &Adjustment::get_value)));
+      connect(compose(sigc::bind<0>(sigc::mem_fun(*this, &AZR3GUI::control_changed),port),
+		      sigc::mem_fun(sw->get_adjustment(), &Adjustment::get_value)));
     assert(m_adj[port] == 0);
     m_adj[port] = &sw->get_adjustment();
   }
@@ -489,7 +489,7 @@
     oss<<setw(2)<<setfill('0')<<iter->first<<' '<<iter->second.substr(0, 23);
     MenuItem* item = manage(new MenuItem(oss.str()));
     item->signal_activate().
-      connect(bind(mem_fun(*this, &AZR3GUI::program_changed), iter->first));
+      connect(sigc::bind(sigc::mem_fun(*this, &AZR3GUI::program_changed), iter->first));
     m_program_menu->items().push_back(*item);
     item->show();
     item->get_child()->modify_bg(STATE_NORMAL, m_menu_bg);
@@ -503,8 +503,8 @@
   for (int i = 0; i < 128; ++i) {
     MenuItem* item = manage(new MenuItem(note2str(i)));
     item->signal_activate().
-      connect(bind(mem_fun(*m_splitpoint_adj, &Adjustment::set_value),
-		   i / 128.0));
+      connect(sigc::bind(sigc::mem_fun(*m_splitpoint_adj, &Adjustment::set_value),
+                         i / 128.0));
     m_split_menu->items().push_back(*item);
     item->show();
     item->get_child()->modify_bg(STATE_NORMAL, m_menu_bg);
@@ -533,7 +533,7 @@

   MenuItem* save_item = manage(new MenuItem("Save program"));
   save_item->signal_activate().
-    connect(mem_fun(*this, &AZR3GUI::save_program));
+    connect(sigc::mem_fun(*this, &AZR3GUI::save_program));
   save_item->show();
   save_item->get_child()->modify_fg(STATE_NORMAL, m_menu_bg);
   save_item->get_child()->modify_fg(STATE_NORMAL, m_menu_fg);


code:
Bash-completion is written with FHS in mind where completion scripts
all get added to /usr/share/bash-completion/completions and are picked
up by the dynamic completion loader from there---whether they are
part of bash-completion or installed by another package.

On Guix systems, we want not only to search within bash-completion's own
directory, but also in the user's profile and in the system profile.
This is what this patch does.

--- a/bash_completion
+++ b/bash_completion
@@ -2016,7 +2016,13 @@ complete -F _minimal ''

 __load_completion()
 {
-    local -a dirs=( ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions )
+    local -a dirs=(
+        ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions
+        "$HOME/.guix-profile/share/bash-completion/completions/$base"
+        "$HOME/.guix-profile/etc/bash_completion.d/$base"
+        "/run/current-system/profile/share/bash-completion/completions/$base"
+        "/run/current-system/profile/etc/bash_completion.d/$base" )
+
     local OIFS=$IFS IFS=: dir cmd="${1##*/}" compfile
     for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do
         dirs+=( $dir/bash-completion/completions )


code:
Unconditionally enable PGRP_PIPE on Linux (the kernel), regardless of
the kernel version in use on the build machine.

--- configure.ac.orig	2019-01-02 09:38:44.000000000 -0500
+++ configure.ac	2019-08-15 16:40:24.271758379 -0400
@@ -1108,10 +1108,7 @@
 solaris2*)	LOCAL_CFLAGS=-DSOLARIS ;;
 lynxos*)	LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
 linux*)		LOCAL_LDFLAGS=-rdynamic		 # allow dynamic loading
-		case "`uname -r`" in
-		1.*|2.[[0123]]*)	: ;;
-		*)	AC_DEFINE(PGRP_PIPE) ;;
-		esac ;;
+		AC_DEFINE(PGRP_PIPE) ;;
 netbsd*|openbsd*)	LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
 *qnx[[67]]*)	LOCAL_LIBS="-lncurses" ;;
 *qnx*)		LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
--- configure.orig	2019-01-02 09:43:04.000000000 -0500
+++ configure	2019-08-15 16:41:44.440155912 -0400
@@ -16312,11 +16312,7 @@
 solaris2*)	LOCAL_CFLAGS=-DSOLARIS ;;
 lynxos*)	LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
 linux*)		LOCAL_LDFLAGS=-rdynamic		 # allow dynamic loading
-		case "`uname -r`" in
-		1.*|2.[0123]*)	: ;;
-		*)	$as_echo "#define PGRP_PIPE 1" >>confdefs.h
- ;;
-		esac ;;
+		$as_echo "#define PGRP_PIPE 1" >>confdefs.h ;;
 netbsd*|openbsd*)	LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
 *qnx[67]*)	LOCAL_LIBS="-lncurses" ;;
 *qnx*)		LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;


code:
Unconditionally enable PGRP_PIPE on Linux (the kernel), regardless of
the kernel version in use on the build machine.

diff -purN bash-5.0-orig/configure bash-5.0/configure
--- configure	1970-01-01 01:00:00.000000000 +0100
+++ configure	2019-09-29 11:51:42.664518665 +0200
@@ -16312,11 +16312,7 @@ solaris2.10*)	LOCAL_CFLAGS=-DSOLARIS  ;;
 solaris2*)	LOCAL_CFLAGS=-DSOLARIS ;;
 lynxos*)	LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
 linux*)		LOCAL_LDFLAGS=-rdynamic		 # allow dynamic loading
-		case "`uname -r`" in
-		1.*|2.[0123]*)	: ;;
-		*)	$as_echo "#define PGRP_PIPE 1" >>confdefs.h
- ;;
-		esac ;;
+		$as_echo "#define PGRP_PIPE 1" >>confdefs.h ;;
 netbsd*|openbsd*)	LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
 *qnx[67]*)	LOCAL_LIBS="-lncurses" ;;
 *qnx*)		LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
diff -purN bash-5.0-orig/configure.ac bash-5.0/configure.ac
--- configure.ac	1970-01-01 01:00:00.000000000 +0100
+++ configure.ac	2019-09-29 11:51:10.692026225 +0200
@@ -1108,10 +1108,7 @@ solaris2.10*)	LOCAL_CFLAGS=-DSOLARIS  ;;
 solaris2*)	LOCAL_CFLAGS=-DSOLARIS ;;
 lynxos*)	LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
 linux*)		LOCAL_LDFLAGS=-rdynamic		 # allow dynamic loading
-		case "`uname -r`" in
-		1.*|2.[[0123]]*)	: ;;
-		*)	AC_DEFINE(PGRP_PIPE) ;;
-		esac ;;
+		AC_DEFINE(PGRP_PIPE) ;;
 netbsd*|openbsd*)	LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
 *qnx[[67]]*)	LOCAL_LIBS="-lncurses" ;;
 *qnx*)		LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;


code:
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Wed, 3 Oct 2018 23:30:42 +0200
Subject: [PATCH] bastet: Change source of unordered_set.

This allows building bastet 0.43.2 with boost >=1.66.
It was backported verbatim from the upstream master branch.

From 0e03f8d4d6bc6949cf1c447e632ce0d1b98c4be1 Mon Sep 17 00:00:00 2001
From: Federico Poloni <fpoloni@di.unipi.it>
Date: Wed, 4 Oct 2017 19:35:01 +0200
Subject: [PATCH] Changed source of unordered_set (should hopefully fix #6
 without reopening #1)

---
 BastetBlockChooser.hpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/BastetBlockChooser.hpp b/BastetBlockChooser.hpp
index 992e556..7ee3b7c 100644
--- a/BastetBlockChooser.hpp
+++ b/BastetBlockChooser.hpp
@@ -23,8 +23,7 @@

 #include "Well.hpp"

-#include <boost/tr1/tr1/unordered_set>
-#include <set>
+#include <boost/unordered_set.hpp>
 #include <boost/functional/hash.hpp>

 namespace Bastet{
@@ -75,7 +74,7 @@ namespace Bastet{
   public:
     Searcher(BlockType b, const Well *well, Vertex v, WellVisitor *visitor);
   private:
-    std::tr1::unordered_set<Vertex> _visited;
+    boost::unordered_set<Vertex> _visited;
     //std::set<Vertex> _visited; ^^ the above is more efficient, we need to do many inserts
     BlockType _block;
     const Well *_well;


code:
Fix CVE-2017-14176:

https://bugs.launchpad.net/bzr/+bug/1710979
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14176

Patch copied from Debian's Bazaar package version bzr_2.7.0+bzr6619-7+deb9u1:

https://alioth.debian.org/scm/loggerhead/pkg-bazaar/bzr/2.7/revision/4204

Description: Prevent SSH command line options from being specified in bzr+ssh:// URLs
Bug: https://bugs.launchpad.net/brz/+bug/1710979
Bug-Debian: https://bugs.debian.org/874429
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-14176
Forwarded: no
Author: Jelmer Vernooĳ <jelmer@jelmer.uk>
Last-Update: 2017-11-26

=== modified file 'bzrlib/tests/test_ssh_transport.py'
--- old/bzrlib/tests/test_ssh_transport.py	2010-10-07 12:45:51 +0000
+++ new/bzrlib/tests/test_ssh_transport.py	2017-08-20 01:59:20 +0000
@@ -22,6 +22,7 @@
     SSHCorpSubprocessVendor,
     LSHSubprocessVendor,
     SSHVendorManager,
+    StrangeHostname,
     )

@@ -161,6 +162,19 @@

 class SubprocessVendorsTests(TestCase):

+    def test_openssh_command_tricked(self):
+        vendor = OpenSSHSubprocessVendor()
+        self.assertEqual(
+            vendor._get_vendor_specific_argv(
+                "user", "-oProxyCommand=blah", 100, command=["bzr"]),
+            ["ssh", "-oForwardX11=no", "-oForwardAgent=no",
+                "-oClearAllForwardings=yes",
+                "-oNoHostAuthenticationForLocalhost=yes",
+                "-p", "100",
+                "-l", "user",
+                "--",
+                "-oProxyCommand=blah", "bzr"])
+
     def test_openssh_command_arguments(self):
         vendor = OpenSSHSubprocessVendor()
         self.assertEqual(
@@ -171,6 +185,7 @@
                 "-oNoHostAuthenticationForLocalhost=yes",
                 "-p", "100",
                 "-l", "user",
+                "--",
                 "host", "bzr"]
             )

@@ -184,9 +199,16 @@
                 "-oNoHostAuthenticationForLocalhost=yes",
                 "-p", "100",
                 "-l", "user",
-                "-s", "host", "sftp"]
+                "-s", "--", "host", "sftp"]
             )

+    def test_openssh_command_tricked(self):
+        vendor = SSHCorpSubprocessVendor()
+        self.assertRaises(
+            StrangeHostname,
+            vendor._get_vendor_specific_argv,
+                "user", "-oProxyCommand=host", 100, command=["bzr"])
+
     def test_sshcorp_command_arguments(self):
         vendor = SSHCorpSubprocessVendor()
         self.assertEqual(
@@ -209,6 +231,13 @@
                 "-s", "sftp", "host"]
             )

+    def test_lsh_command_tricked(self):
+        vendor = LSHSubprocessVendor()
+        self.assertRaises(
+            StrangeHostname,
+            vendor._get_vendor_specific_argv,
+                "user", "-oProxyCommand=host", 100, command=["bzr"])
+
     def test_lsh_command_arguments(self):
         vendor = LSHSubprocessVendor()
         self.assertEqual(
@@ -231,6 +260,13 @@
                 "--subsystem", "sftp", "host"]
             )

+    def test_plink_command_tricked(self):
+        vendor = PLinkSubprocessVendor()
+        self.assertRaises(
+            StrangeHostname,
+            vendor._get_vendor_specific_argv,
+                "user", "-oProxyCommand=host", 100, command=["bzr"])
+
     def test_plink_command_arguments(self):
         vendor = PLinkSubprocessVendor()
         self.assertEqual(

=== modified file 'bzrlib/transport/ssh.py'
--- old/bzrlib/transport/ssh.py	2015-07-31 01:04:41 +0000
+++ new/bzrlib/transport/ssh.py	2017-08-20 01:59:20 +0000
@@ -46,6 +46,10 @@
     from paramiko.sftp_client import SFTPClient

+class StrangeHostname(errors.BzrError):
+    _fmt = "Refusing to connect to strange SSH hostname %(hostname)s"
+
+
 SYSTEM_HOSTKEYS = {}
 BZR_HOSTKEYS = {}

@@ -360,6 +364,11 @@
     # tests, but beware of using PIPE which may hang due to not being read.
     _stderr_target = None

+    @staticmethod
+    def _check_hostname(arg):
+        if arg.startswith('-'):
+            raise StrangeHostname(hostname=arg)
+
     def _connect(self, argv):
         # Attempt to make a socketpair to use as stdin/stdout for the SSH
         # subprocess.  We prefer sockets to pipes because they support
@@ -424,9 +433,9 @@
         if username is not None:
             args.extend(['-l', username])
         if subsystem is not None:
-            args.extend(['-s', host, subsystem])
+            args.extend(['-s', '--', host, subsystem])
         else:
-            args.extend([host] + command)
+            args.extend(['--', host] + command)
         return args

 register_ssh_vendor('openssh', OpenSSHSubprocessVendor())
@@ -439,6 +448,7 @@

     def _get_vendor_specific_argv(self, username, host, port, subsystem=None,
                                   command=None):
+        self._check_hostname(host)
         args = [self.executable_path, '-x']
         if port is not None:
             args.extend(['-p', str(port)])
@@ -460,6 +470,7 @@

     def _get_vendor_specific_argv(self, username, host, port, subsystem=None,
                                   command=None):
+        self._check_hostname(host)
         args = [self.executable_path]
         if port is not None:
             args.extend(['-p', str(port)])
@@ -481,6 +492,7 @@

     def _get_vendor_specific_argv(self, username, host, port, subsystem=None,
                                   command=None):
+        self._check_hostname(host)
         args = [self.executable_path, '-x', '-a', '-ssh', '-2', '-batch']
         if port is not None:
             args.extend(['-P', str(port)])


code:
Patch taken from nix.

commit fdda59736ddc048cf38a2c7103f4f5d9eeaf995e
Author: Ben Gamari <ben@smart-cactus.org>
Date:   Tue Oct 17 10:51:34 2017 -0400

    Try implementing cross-compilation

diff --git a/bc/Makefile.am b/bc/Makefile.am
index d9d412e..fdef633 100644
--- a/bc/Makefile.am
+++ b/bc/Makefile.am
@@ -17,6 +17,7 @@ MAINTAINERCLEANFILES = Makefile.in bc.c bc.h scan.c \

 AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../h
 LIBBC = ../lib/libbc.a
+LIBBC_HOST = ../lib/libbc_host.a
 LIBL = @LEXLIB@
 LDADD = $(LIBBC) $(LIBL) @READLINELIB@

@@ -29,12 +30,20 @@ $(PROGRAMS): libmath.h $(LIBBC)
 scan.o: bc.h
 global.o: libmath.h
+
+main_host.c : main.c
+	cp $< $@

-fbcOBJ = main.o bc.o scan.o execute.o load.o storage.o util.o warranty.o
+fbcOBJ = $(addsuffix _host,main.o bc.o scan.o execute.o load.o storage.o util.o warranty.o)
+
+%.o_host : CC:=$(CC_FOR_BUILD)
+
+%.o_host : %.c
+	$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<

-libmath.h: libmath.b $(fbcOBJ) $(LIBBC)
+libmath.h: libmath.b $(fbcOBJ) $(LIBBC_HOST)
 	echo '{0}' > libmath.h
-	$(MAKE) global.o
-	$(LINK) -o fbc $(fbcOBJ) global.o $(LIBBC) $(LIBL) $(READLINELIB) $(LIBS)
+	$(MAKE) global.o_host
+	$(CC_FOR_BUILD) -o fbc $(fbcOBJ) global.o_host $(LIBBC_HOST) $(LIBL) ${READLINELIB} $(LIBS)
 	./fbc -c $(srcdir)/libmath.b </dev/null >libmath.h
 	$(srcdir)/fix-libmath_h
 	rm -f ./fbc ./global.o
diff --git a/configure.ac b/configure.ac
index fc74573..5cabb73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,7 @@ m4_define([dc_version], 1.4.1)

 AC_INIT([bc],[bc_version])
 AC_CONFIG_SRCDIR(doc/bc.1)
+AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([dist-bzip2])
 AC_CONFIG_HEADERS(config.h)

@@ -35,6 +36,7 @@ AC_DEFINE([DC_COPYRIGHT],
 	  [Define the dc copyright line.])

 AC_PROG_CC
+AX_CC_FOR_BUILD
 AC_USE_SYSTEM_EXTENSIONS

 AM_PROG_LEX
diff --git a/lib/Makefile.am b/lib/Makefile.am
index ec4bf59..c670f5b 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
-noinst_LIBRARIES = libbc.a
+noinst_LIBRARIES = libbc.a libbc_host.a

 AM_CPPFLAGS = -I. -I.. -I$(srcdir)/../h

@@ -24,3 +24,11 @@ testmul: testmul.o number.o

 specialnumber: newnumber.o
 	cp newnumber.o number.o
+
+%.o_host : CC:=$(CC_FOR_BUILD)
+%.o_host : %.c
+	$(COMPILE) -c $(CFLAGS) $(INCLUDES) -o $@ $<
+
+libbc_host.a : $(addsuffix _host,$(libbc_a_OBJECTS))
+	ar cru $@ $+
+	ranlib $@
diff --git a/m4/cc_for_build.m4 b/m4/cc_for_build.m4
new file mode 100644
index 0000000..c62ffad
--- /dev/null
+++ b/m4/cc_for_build.m4
@@ -0,0 +1,77 @@
+# ===========================================================================
+#     https://www.gnu.org/software/autoconf-archive/ax_cc_for_build.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CC_FOR_BUILD
+#
+# DESCRIPTION
+#
+#   Find a build-time compiler. Sets CC_FOR_BUILD and EXEEXT_FOR_BUILD.
+#
+# LICENSE
+#
+#   Copyright (c) 2010 Reuben Thomas <rrt@sc3d.org>
+#   Copyright (c) 1999 Richard Henderson <rth@redhat.com>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 3
+
+dnl Get a default for CC_FOR_BUILD to put into Makefile.
+AC_DEFUN([AX_CC_FOR_BUILD],
+[# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+  if test "x$cross_compiling" = "xno"; then
+    CC_FOR_BUILD='$(CC)'
+  else
+    CC_FOR_BUILD=gcc
+  fi
+fi
+AC_SUBST(CC_FOR_BUILD)
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+  EXEEXT_FOR_BUILD='$(EXEEXT)'
+else
+  AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
+    [rm -f conftest*
+     echo 'int main () { return 0; }' > conftest.c
+     bfd_cv_build_exeext=
+     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+     for file in conftest.*; do
+       case $file in
+       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
+       *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+       esac
+     done
+     rm -f conftest*
+     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
+  EXEEXT_FOR_BUILD=""
+  test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
+fi
+AC_SUBST(EXEEXT_FOR_BUILD)])dnl


code:
https://sources.debian.org/data/main/b/beancount/2.2.0-3/debian/patches/0001-Remove-fonts.googleapis.com-links-for-the-bean-web-t.patch

From: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date: Tue, 1 May 2018 04:49:55 +0200
Subject: Remove fonts.googleapis.com links for the bean-web template

---
 beancount/web/web.html | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/beancount/web/web.html b/beancount/web/web.html
index 3995ce2..ec9e707 100644
--- a/beancount/web/web.html
+++ b/beancount/web/web.html
@@ -3,10 +3,6 @@
   <head>
     <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

-    <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:400italic,700italic,700,400" rel="stylesheet" type="text/css" />
-    <link href="https://fonts.googleapis.com/css?family=Roboto:400italic,700italic,700,400" rel="stylesheet" type="text/css" />
-    <link href='https://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css' />
-
     <link href="/resources/web.css" rel="stylesheet" type="text/css" />
     <title>{{title}}: {{pagetitle}}</title>


code:
From d7d0cdd48017679e8529f8475d1b9902944cf243 Mon Sep 17 00:00:00 2001
From: Brett Gilio <brettg@gnu.org>
Date: Sun, 20 Dec 2020 14:43:30 -0600
Subject: [PATCH] Disallow Pre-install Checks

---
 CMakeLists.txt | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 45c6d27..73b4ace 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,10 +58,6 @@ ExternalProject_Add(BearSource
             -DROOT_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
             -DENABLE_UNIT_TESTS:BOOL=${ENABLE_UNIT_TESTS}
-        TEST_BEFORE_INSTALL
-            1
-        TEST_COMMAND
-            ctest # or `ctest -T memcheck`
         )

 # Run the functional tests
@@ -73,12 +69,8 @@ if (ENABLE_FUNC_TESTS)
                 BearSource
             CMAKE_CACHE_ARGS
                 -DSTAGED_INSTALL_PREFIX:PATH=${STAGED_INSTALL_PREFIX}
-            TEST_BEFORE_INSTALL
-                1
             INSTALL_COMMAND
                 ""
-            TEST_COMMAND
-                ctest --verbose
             )
 endif ()

--
2.29.2


code:
Be compatible with python-werkzeug 1.0.0.

Taken from upstream:
https://github.com/beetbox/beets/commit/d43d54e21cde97f57f19486925ab56b419254cc8

diff --git a/beetsplug/web/__init__.py b/beetsplug/web/__init__.py
index f53fb3a954..21ff5d94ed 100644
--- a/beetsplug/web/__init__.py
+++ b/beetsplug/web/__init__.py
@@ -169,7 +169,7 @@ def to_python(self, value):
         return ids

     def to_url(self, value):
-        return ','.join(value)
+        return ','.join(str(v) for v in value)

 class QueryConverter(PathConverter):