aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/alsa-lib-add-environment-variable.patch110
-rw-r--r--gnu/packages/patches/binutils-ld-new-dtags.patch16
-rw-r--r--gnu/packages/patches/boost-fix-icu-build.patch53
-rw-r--r--gnu/packages/patches/btrfs-progs-e-value-block.patch37
-rw-r--r--gnu/packages/patches/cmake-fix-tests.patch120
-rw-r--r--gnu/packages/patches/e2fsprogs-glibc-2.27.patch56
-rw-r--r--gnu/packages/patches/elogind-glibc-2.27.patch22
-rw-r--r--gnu/packages/patches/fontconfig-remove-debug-printf.patch18
-rw-r--r--gnu/packages/patches/gawk-shell.patch30
-rw-r--r--gnu/packages/patches/gcc-strmov-store-file-names.patch50
-rw-r--r--gnu/packages/patches/ghostscript-no-header-id.patch13
-rw-r--r--gnu/packages/patches/glib-respect-datadir.patch21
-rw-r--r--gnu/packages/patches/glibc-2.27-git-fixes.patch702
-rw-r--r--gnu/packages/patches/glibc-bootstrap-system.patch14
-rw-r--r--gnu/packages/patches/glibc-hidden-visibility-ldconfig.patch16
-rw-r--r--gnu/packages/patches/glibc-reinstate-prlimit64-fallback.patch127
-rw-r--r--gnu/packages/patches/graphite2-ffloat-store.patch34
-rw-r--r--gnu/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch53
-rw-r--r--gnu/packages/patches/lcms-CVE-2016-10165.patch36
-rw-r--r--gnu/packages/patches/libgpg-error-aarch64-logging-fix.patch58
-rw-r--r--gnu/packages/patches/libtasn1-CVE-2017-10790.patch63
-rw-r--r--gnu/packages/patches/libtasn1-CVE-2018-6003.patch73
-rw-r--r--gnu/packages/patches/libvorbis-CVE-2017-14632.patch63
-rw-r--r--gnu/packages/patches/libvorbis-CVE-2017-14633.patch43
-rw-r--r--gnu/packages/patches/libxcb-python-3.5-compat.patch64
-rw-r--r--gnu/packages/patches/make-glibc-compat.patch52
-rw-r--r--gnu/packages/patches/patch-hurd-path-max.patch15
-rw-r--r--gnu/packages/patches/pcre2-CVE-2017-7186.patch68
-rw-r--r--gnu/packages/patches/pcre2-CVE-2017-8786.patch155
-rw-r--r--gnu/packages/patches/pulseaudio-glibc-2.27.patch67
-rw-r--r--gnu/packages/patches/pycairo-wscript.patch31
-rw-r--r--gnu/packages/patches/python-3-search-paths.patch13
-rw-r--r--gnu/packages/patches/qemu-glibc-2.27.patch55
-rw-r--r--gnu/packages/patches/tar-CVE-2016-6321.patch51
-rw-r--r--gnu/packages/patches/tar-remove-wholesparse-check.patch68
-rw-r--r--gnu/packages/patches/util-linux-CVE-2018-7738.patch49
-rw-r--r--gnu/packages/patches/util-linux-tests.patch8
-rw-r--r--gnu/packages/patches/xcb-proto-python3-print.patch75
-rw-r--r--gnu/packages/patches/xcb-proto-python3-whitespace.patch217
39 files changed, 1571 insertions, 1245 deletions
diff --git a/gnu/packages/patches/alsa-lib-add-environment-variable.patch b/gnu/packages/patches/alsa-lib-add-environment-variable.patch
new file mode 100644
index 0000000000..a468a7fc4f
--- /dev/null
+++ b/gnu/packages/patches/alsa-lib-add-environment-variable.patch
@@ -0,0 +1,110 @@
+From 1822fb453128a1b5de93b4c590cd272d6488a077 Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Fri, 25 May 2018 19:26:58 +0200
+Subject: [PATCH] Add support for a ALSA_PLUGIN_DIR environment variable.
+
+If it is not set, default to previous behavior.
+---
+ src/control/control.c | 6 +++++-
+ src/dlmisc.c | 9 +++++++--
+ src/pcm/pcm.c | 9 +++++++--
+ src/pcm/pcm_rate.c | 13 +++++++++----
+ 4 files changed, 28 insertions(+), 9 deletions(-)
+
+diff --git a/src/control/control.c b/src/control/control.c
+index 11f7815..9dba7dd 100644
+--- a/src/control/control.c
++++ b/src/control/control.c
+@@ -1331,7 +1331,11 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
+ build_in++;
+ }
+ if (*build_in == NULL) {
+- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32);
++ char* plugdir = ALSA_PLUGIN_DIR;
++ char* envplugdir = getenv("ALSA_PLUGIN_DIR");
++ if(envplugdir != NULL)
++ plugdir = envplugdir;
++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32);
+ if (buf1 == NULL) {
+ err = -ENOMEM;
+ goto _err;
+diff --git a/src/dlmisc.c b/src/dlmisc.c
+index 3757d33..92aa864 100644
+--- a/src/dlmisc.c
++++ b/src/dlmisc.c
+@@ -82,9 +82,14 @@ void *snd_dlopen(const char *name, int mode, char *errbuf, size_t errbuflen)
+ char *filename = NULL;
+
+ if (name && name[0] != '/') {
+- filename = alloca(sizeof(ALSA_PLUGIN_DIR) + 1 + strlen(name) + 1);
++ char* plugdir = ALSA_PLUGIN_DIR;
++ char* envplugdir = getenv("ALSA_PLUGIN_DIR");
++ if(envplugdir != NULL)
++ plugdir = envplugdir;
++
++ filename = malloc(strlen(plugdir) + 1 + strlen(name) + 1);
+ if (filename) {
+- strcpy(filename, ALSA_PLUGIN_DIR);
++ strcpy(filename, plugdir);
+ strcat(filename, "/");
+ strcat(filename, name);
+ handle = dlopen(filename, mode);
+diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
+index 11aec80..590e8b6 100644
+--- a/src/pcm/pcm.c
++++ b/src/pcm/pcm.c
+@@ -2496,13 +2496,18 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
+ build_in++;
+ }
+ if (*build_in == NULL) {
+- buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32);
++ char* plugdir = ALSA_PLUGIN_DIR;
++ char* envplugdir = getenv("ALSA_PLUGIN_DIR");
++ if(envplugdir != NULL)
++ plugdir = envplugdir;
++ buf1 = malloc(strlen(str) + strlen(plugdir) + 32);
++
+ if (buf1 == NULL) {
+ err = -ENOMEM;
+ goto _err;
+ }
+ lib = buf1;
+- sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str);
++ sprintf(buf1, "%s/libasound_module_pcm_%s.so", plugdir, str);
+ }
+ }
+ #ifndef PIC
+diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
+index 4e0c7ca..8694a38 100644
+--- a/src/pcm/pcm_rate.c
++++ b/src/pcm/pcm_rate.c
+@@ -1260,7 +1260,8 @@ static const char *const default_rate_plugins[] = {
+
+ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_config_t *converter_conf, int verbose)
+ {
+- char open_name[64], open_conf_name[64], lib_name[128], *lib = NULL;
++ char open_name[64], open_conf_name[64], *lib = NULL;
++ char *buf1;
+ snd_pcm_rate_open_func_t open_func;
+ snd_pcm_rate_open_conf_func_t open_conf_func;
+ int err;
+@@ -1268,9 +1269,13 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type, const snd_conf
+ snprintf(open_name, sizeof(open_name), "_snd_pcm_rate_%s_open", type);
+ snprintf(open_conf_name, sizeof(open_conf_name), "_snd_pcm_rate_%s_open_conf", type);
+ if (!is_builtin_plugin(type)) {
+- snprintf(lib_name, sizeof(lib_name),
+- "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type);
+- lib = lib_name;
++ char* plugdir = ALSA_PLUGIN_DIR;
++ char* envplugdir = getenv("ALSA_PLUGIN_DIR");
++ if(envplugdir != NULL)
++ plugdir = envplugdir;
++ buf1 = malloc(strlen(type) + strlen(plugdir) + 32);
++ sprintf(buf1, "%s/libasound_module_rate_%s.so", plugdir, type);
++ lib = buf1;
+ }
+
+ rate->rate_min = SND_PCM_PLUGIN_RATE_MIN;
+--
+2.17.0
+
diff --git a/gnu/packages/patches/binutils-ld-new-dtags.patch b/gnu/packages/patches/binutils-ld-new-dtags.patch
deleted file mode 100644
index 5f7a03fc38..0000000000
--- a/gnu/packages/patches/binutils-ld-new-dtags.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Turn on --enable-new-dtags by default to make the linker set RUNPATH
-instead of RPATH on binaries. This is important because RUNPATH can
-be overriden using LD_LIBRARY_PATH at runtime.
-
-Patch from Nixpkgs by Eelco Dolstra <eelco.dolstra@logicblox.com>.
-
---- binutils/ld/ldmain.c
-+++ binutils/ld/ldmain.c
-@@ -296,6 +296,7 @@ main (int argc, char **argv)
-
- link_info.allow_undefined_version = TRUE;
- link_info.keep_memory = TRUE;
-+ link_info.new_dtags = TRUE;
- link_info.combreloc = TRUE;
- link_info.strip_discarded = TRUE;
- link_info.callbacks = &link_callbacks;
diff --git a/gnu/packages/patches/boost-fix-icu-build.patch b/gnu/packages/patches/boost-fix-icu-build.patch
new file mode 100644
index 0000000000..556f91b8f7
--- /dev/null
+++ b/gnu/packages/patches/boost-fix-icu-build.patch
@@ -0,0 +1,53 @@
+Pass -std=c++11 when compiling files that include the ICU headers. Without
+this flag, compilation fails and causes Boost's build system to remove ICU
+support. Note that $(pkg-config --variable=CXXFLAGS icu-uc) includes
+"-std=c++11", but Boost's build system does not use 'pkg-config'.
+
+--- boost_1_66_0/libs/locale/build/Jamfile.v2.orig 2017-12-13 18:56:44.000000000 -0500
++++ boost_1_66_0/libs/locale/build/Jamfile.v2 2018-04-08 15:18:58.673025760 -0400
+@@ -65,8 +65,8 @@
+
+ if $(ICU_LINK)
+ {
+- ICU_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <runtime-link>shared ;
+- ICU64_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin64 <runtime-link>shared ;
++ ICU_OPTS = <include>$(ICU_PATH)/include <cxxflags>-std=c++11 <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <runtime-link>shared ;
++ ICU64_OPTS = <include>$(ICU_PATH)/include <cxxflags>-std=c++11 <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin64 <runtime-link>shared ;
+ }
+ else
+ {
+@@ -121,6 +121,7 @@
+ explicit icuuc icudt icuin ;
+
+ ICU_OPTS = <include>$(ICU_PATH)/include
++ <cxxflags>-std=c++11
+ <library>icuuc/<link>shared/<runtime-link>shared
+ <library>icudt/<link>shared/<runtime-link>shared
+ <library>icuin/<link>shared/<runtime-link>shared
+@@ -180,6 +181,7 @@
+ explicit icuuc_64 icudt_64 icuin_64 ;
+
+ ICU64_OPTS = <include>$(ICU_PATH)/include
++ <cxxflags>-std=c++11
+ <library>icuuc_64/<link>shared/<runtime-link>shared
+ <library>icudt_64/<link>shared/<runtime-link>shared
+ <library>icuin_64/<link>shared/<runtime-link>shared
+--- boost_1_66_0/libs/regex/build/Jamfile.v2.orig 2017-12-13 18:56:48.000000000 -0500
++++ boost_1_66_0/libs/regex/build/Jamfile.v2 2018-04-08 15:20:40.865532505 -0400
+@@ -44,7 +44,7 @@
+
+ if $(ICU_LINK)
+ {
+- ICU_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <define>BOOST_HAS_ICU=1 <runtime-link>shared ;
++ ICU_OPTS = <include>$(ICU_PATH)/include <cxxflags>-std=c++11 <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <define>BOOST_HAS_ICU=1 <runtime-link>shared ;
+ }
+ else
+ {
+@@ -78,6 +78,7 @@
+
+ ICU_OPTS =
+ <include>$(ICU_PATH)/include
++ <cxxflags>-std=c++11
+ <runtime-link>shared:<library>icuuc/<link>shared
+ <runtime-link>shared:<library>icudt/<link>shared
+ <runtime-link>shared:<library>icuin/<link>shared
diff --git a/gnu/packages/patches/btrfs-progs-e-value-block.patch b/gnu/packages/patches/btrfs-progs-e-value-block.patch
new file mode 100644
index 0000000000..6365146431
--- /dev/null
+++ b/gnu/packages/patches/btrfs-progs-e-value-block.patch
@@ -0,0 +1,37 @@
+From c78f59a971ce4b543f3177e383b677862b2d9fb5 Mon Sep 17 00:00:00 2001
+From: Qu Wenruo <wqu@suse.com>
+Date: Wed, 14 Mar 2018 08:56:57 +0800
+Subject: [PATCH] btrfs-progs: convert/ext2: Remove check for
+ ext2_ext_attr_entry->e_value_block
+
+In latest e2fsprogs (1.44.0) definition of ext2_ext_attr_entry has
+removed member e_value_block, as currently ext* doesn't support it set
+anyway.
+
+So remove such check so that we can pass compile.
+
+Issue: #110
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199071
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+---
+ convert/source-ext2.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/convert/source-ext2.c b/convert/source-ext2.c
+index b1492c78..070126ec 100644
+--- a/convert/source-ext2.c
++++ b/convert/source-ext2.c
+@@ -422,8 +422,7 @@ static int ext2_xattr_check_entry(struct ext2_ext_attr_entry *entry,
+ {
+ size_t value_size = entry->e_value_size;
+
+- if (entry->e_value_block != 0 || value_size > size ||
+- entry->e_value_offs + value_size > size)
++ if (value_size > size || entry->e_value_offs + value_size > size)
+ return -EIO;
+ return 0;
+ }
+--
+2.16.3
+
diff --git a/gnu/packages/patches/cmake-fix-tests.patch b/gnu/packages/patches/cmake-fix-tests.patch
deleted file mode 100644
index 732b0023ab..0000000000
--- a/gnu/packages/patches/cmake-fix-tests.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-From af0a62dadfb3db25880bc653e2e4c97435a604c9 Mon Sep 17 00:00:00 2001
-From: Efraim Flashner <efraim@flashner.co.il>
-Date: Mon, 29 Aug 2016 20:07:58 +0300
-Subject: [PATCH] cmake-fix-tests
-
----
- Tests/CMakeLists.txt | 83 ++++++++++++++++++++++++++++------------------------
- 1 file changed, 44 insertions(+), 39 deletions(-)
-
-diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
-index f21e430..56014a2 100644
---- a/Tests/CMakeLists.txt
-+++ b/Tests/CMakeLists.txt
-@@ -416,10 +416,12 @@ if(BUILD_TESTING)
- endif()
-
- # run test for BundleUtilities on supported platforms/compilers
-- if(MSVC OR
-- MINGW OR
-- CMAKE_SYSTEM_NAME MATCHES "Linux" OR
-- CMAKE_SYSTEM_NAME MATCHES "Darwin")
-+# if(MSVC OR
-+# MINGW OR
-+# CMAKE_SYSTEM_NAME MATCHES "Linux" OR
-+# CMAKE_SYSTEM_NAME MATCHES "Darwin")
-+# This test fails on Guix: skip it.
-+ if(FALSE)
- if(NOT "${CMAKE_GENERATOR}" STREQUAL "Watcom WMake")
-
- add_test(BundleUtilities ${CMAKE_CTEST_COMMAND}
-@@ -2481,30 +2483,32 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
- PASS_REGULAR_EXPRESSION "Could not find executable"
- FAIL_REGULAR_EXPRESSION "SegFault")
-
-- configure_file(
-- "${CMake_SOURCE_DIR}/Tests/CTestTestUpload/test.cmake.in"
-- "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake"
-- @ONLY ESCAPE_QUOTES)
-- add_test(CTestTestUpload ${CMAKE_CTEST_COMMAND}
-- -S "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" -V
-- --output-log "${CMake_BINARY_DIR}/Tests/CTestTestUpload/testOut.log"
-- )
-- set_tests_properties(CTestTestUpload PROPERTIES
-- PASS_REGULAR_EXPRESSION "Upload\\.xml")
--
-- configure_file(
-- "${CMake_SOURCE_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake.in"
-- "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake"
-- @ONLY ESCAPE_QUOTES)
-- add_test(CTestCoverageCollectGCOV ${CMAKE_CTEST_COMMAND}
-- -C \${CTEST_CONFIGURATION_TYPE}
-- -S "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake" -VV
-- --output-log "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/testOut.log"
-- )
-- set_tests_properties(CTestCoverageCollectGCOV PROPERTIES
-- PASS_REGULAR_EXPRESSION
-- "PASSED with correct output.*Testing/CoverageInfo/main.cpp.gcov")
-- set_property(TEST CTestCoverageCollectGCOV PROPERTY ENVIRONMENT CTEST_PARALLEL_LEVEL=)
-+# This test requires network connectivity: skip it.
-+# configure_file(
-+# "${CMake_SOURCE_DIR}/Tests/CTestTestUpload/test.cmake.in"
-+# "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake"
-+# @ONLY ESCAPE_QUOTES)
-+# add_test(CTestTestUpload ${CMAKE_CTEST_COMMAND}
-+# -S "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" -V
-+# --output-log "${CMake_BINARY_DIR}/Tests/CTestTestUpload/testOut.log"
-+# )
-+# set_tests_properties(CTestTestUpload PROPERTIES
-+# PASS_REGULAR_EXPRESSION "Upload\\.xml")
-+
-+# This test times out
-+# configure_file(
-+# "${CMake_SOURCE_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake.in"
-+# "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake"
-+# @ONLY ESCAPE_QUOTES)
-+# add_test(CTestCoverageCollectGCOV ${CMAKE_CTEST_COMMAND}
-+# -C \${CTEST_CONFIGURATION_TYPE}
-+# -S "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake" -VV
-+# --output-log "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/testOut.log"
-+# )
-+# set_tests_properties(CTestCoverageCollectGCOV PROPERTIES
-+# PASS_REGULAR_EXPRESSION
-+# "PASSED with correct output.*Testing/CoverageInfo/main.cpp.gcov")
-+# set_property(TEST CTestCoverageCollectGCOV PROPERTY ENVIRONMENT CTEST_PARALLEL_LEVEL=)
-
- configure_file(
- "${CMake_SOURCE_DIR}/Tests/CTestTestEmptyBinaryDirectory/test.cmake.in"
-@@ -2860,17 +2864,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
- set_tests_properties(CTestTestStopTime PROPERTIES
- PASS_REGULAR_EXPRESSION "The stop time has been passed")
-
-- configure_file(
-- "${CMake_SOURCE_DIR}/Tests/CTestTestSubdir/test.cmake.in"
-- "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake"
-- @ONLY ESCAPE_QUOTES)
-- add_test(CTestTestSubdir ${CMAKE_CTEST_COMMAND}
-- -S "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake" -V
-- --output-log "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/testOutput.log"
-- )
-- #make sure all 3 subdirs were added
-- set_tests_properties(CTestTestSubdir PROPERTIES
-- PASS_REGULAR_EXPRESSION "0 tests failed out of 3")
-+# This test fails to build 2 of the 3 tests
-+# configure_file(
-+# "${CMake_SOURCE_DIR}/Tests/CTestTestSubdir/test.cmake.in"
-+# "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake"
-+# @ONLY ESCAPE_QUOTES)
-+# add_test(CTestTestSubdir ${CMAKE_CTEST_COMMAND}
-+# -S "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake" -V
-+# --output-log "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/testOutput.log"
-+# )
-+# #make sure all 3 subdirs were added
-+# set_tests_properties(CTestTestSubdir PROPERTIES
-+# PASS_REGULAR_EXPRESSION "0 tests failed out of 3")
-
- configure_file(
- "${CMake_SOURCE_DIR}/Tests/CTestTestTimeout/test.cmake.in"
---
-2.9.3
-
diff --git a/gnu/packages/patches/e2fsprogs-glibc-2.27.patch b/gnu/packages/patches/e2fsprogs-glibc-2.27.patch
new file mode 100644
index 0000000000..f0bc7130c0
--- /dev/null
+++ b/gnu/packages/patches/e2fsprogs-glibc-2.27.patch
@@ -0,0 +1,56 @@
+Copied from:
+https://github.com/openwrt/openwrt/blob/58a95f0f8ff768b43d68eed2b6a786e0f40f723b/tools/e2fsprogs/patches/005-misc-rename-copy_file_range-to-copy_file_chunk.patch
+
+From 01551bdba16ab16512a01affe02ade32c41ede8a Mon Sep 17 00:00:00 2001
+From: Palmer Dabbelt <palmer@dabbelt.com>
+Date: Fri, 29 Dec 2017 10:19:51 -0800
+Subject: [PATCH] misc: rename copy_file_range to copy_file_chunk
+
+As of 2.27, glibc will have a copy_file_range library call to wrap the
+new copy_file_range system call. This conflicts with the function in
+misc/create_inode.c, which this patch renames _copy_file_range.
+
+Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+---
+ misc/create_inode.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/misc/create_inode.c
++++ b/misc/create_inode.c
+@@ -392,7 +392,7 @@ static ssize_t my_pread(int fd, void *bu
+ }
+ #endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */
+
+-static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
++static errcode_t copy_file_chunk(ext2_filsys fs, int fd, ext2_file_t e2_file,
+ off_t start, off_t end, char *buf,
+ char *zerobuf)
+ {
+@@ -466,7 +466,7 @@ static errcode_t try_lseek_copy(ext2_fil
+
+ data_blk = data & ~(fs->blocksize - 1);
+ hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1);
+- err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
++ err = copy_file_chunk(fs, fd, e2_file, data_blk, hole_blk, buf,
+ zerobuf);
+ if (err)
+ return err;
+@@ -516,7 +516,7 @@ static errcode_t try_fiemap_copy(ext2_fi
+ }
+ for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents;
+ i++, ext++) {
+- err = copy_file_range(fs, fd, e2_file, ext->fe_logical,
++ err = copy_file_chunk(fs, fd, e2_file, ext->fe_logical,
+ ext->fe_logical + ext->fe_length,
+ buf, zerobuf);
+ if (err)
+@@ -569,7 +569,7 @@ static errcode_t copy_file(ext2_filsys f
+ goto out;
+ #endif
+
+- err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
++ err = copy_file_chunk(fs, fd, e2_file, 0, statbuf->st_size, buf,
+ zerobuf);
+ out:
+ ext2fs_free_mem(&zerobuf);
diff --git a/gnu/packages/patches/elogind-glibc-2.27.patch b/gnu/packages/patches/elogind-glibc-2.27.patch
new file mode 100644
index 0000000000..4ade587b5e
--- /dev/null
+++ b/gnu/packages/patches/elogind-glibc-2.27.patch
@@ -0,0 +1,22 @@
+Look for memfd_create in sys/mman.h instead of linux/memfd.h.
+Needed to build with glibc-2.27.
+
+--- a/configure.ac 1969-12-31 19:00:00.000000000 -0500
++++ b/configure.ac 2018-03-27 23:54:15.414589005 -0400
+@@ -360,7 +360,7 @@
+ # ------------------------------------------------------------------------------
+
+ AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
+-AC_CHECK_HEADERS([linux/memfd.h], [], [])
++AC_CHECK_HEADERS([sys/mman.h], [], [])
+
+ AC_CHECK_HEADERS([printf.h], [have_printf_h=yes], [have_printf_h=no])
+ AS_IF([test x$have_printf_h = xyes], [
+@@ -395,6 +395,7 @@
+ [], [], [[
+ #include <sys/types.h>
+ #include <unistd.h>
++#include <sys/mman.h>
+ #include <sys/mount.h>
+ #include <fcntl.h>
+ #include <sched.h>
diff --git a/gnu/packages/patches/fontconfig-remove-debug-printf.patch b/gnu/packages/patches/fontconfig-remove-debug-printf.patch
deleted file mode 100644
index 04924a45a4..0000000000
--- a/gnu/packages/patches/fontconfig-remove-debug-printf.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Fontconfig 2.12.5 and 2.12.6 was released with a stray debugging statement.
-See <https://lists.freedesktop.org/archives/fontconfig/2017-October/006079.html>.
-
-Patch copied from upstream source repository:
-https://cgit.freedesktop.org/fontconfig/commit/?id=b56207a069be2574df455ede0a6ab61f44d5ca2b
-
-diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c
-index 842a8b6..6cd5abd 100644
---- a/fc-query/fc-query.c
-+++ b/fc-query/fc-query.c
-@@ -170,7 +170,6 @@ main (int argc, char **argv)
- FcPattern *pat;
-
- id = ((instance_num << 16) + face_num);
-- printf("id %d\n", id);
- if (FT_New_Face (ftLibrary, argv[i], id, &face))
- break;
- num_faces = face->num_faces;
diff --git a/gnu/packages/patches/gawk-shell.patch b/gnu/packages/patches/gawk-shell.patch
index 80e9c65475..46ca5e451f 100644
--- a/gnu/packages/patches/gawk-shell.patch
+++ b/gnu/packages/patches/gawk-shell.patch
@@ -4,31 +4,39 @@ absolute file name of `sh'.
--- gawk-4.1.3/io.c 2015-05-19 15:37:20.000000000 +0200
+++ gawk-4.1.3/io.c 2015-06-09 18:39:36.918414881 +0200
-@@ -1945,7 +1945,7 @@ two_way_open(const char *str, struct red
+@@ -2025,7 +2025,7 @@
- signal(SIGPIPE, SIG_DFL);
+ set_sigpipe_to_default();
-- execl("/bin/sh", "sh", "-c", str, NULL);
-+ execlp("sh", "sh", "-c", str, NULL);
- _exit(errno == ENOENT ? 127 : 126);
+- execl("/bin/sh", "sh", "-c", command, NULL);
++ execlp("sh", "sh", "-c", command, NULL);
+ _exit(errno == ENOENT ? 127 : 126);
+
+ case -1:
+@@ -2077,7 +2077,7 @@
- case -1:
-@@ -2129,7 +2129,7 @@ use_pipes:
+ signal(SIGPIPE, SIG_DFL);
+
+- execl("/bin/sh", "sh", "-c", command, NULL);
++ execlp("sh", "sh", "-c", command, NULL);
+ _exit(errno == ENOENT ? 127 : 126);
+
+ case -1:
+@@ -2422,7 +2422,7 @@
fatal(_("close of pipe failed (%s)"), strerror(errno));
/* stderr does NOT get dup'ed onto child's stdout */
- signal(SIGPIPE, SIG_DFL);
+ set_sigpipe_to_default();
- execl("/bin/sh", "sh", "-c", str, NULL);
+ execlp("sh", "sh", "-c", str, NULL);
_exit(errno == ENOENT ? 127 : 126);
}
#endif /* NOT __EMX__, NOT __MINGW32__ */
-@@ -2323,7 +2323,7 @@ gawk_popen(const char *cmd, struct redir
+@@ -2659,7 +2659,7 @@
if (close(p[0]) == -1 || close(p[1]) == -1)
fatal(_("close of pipe failed (%s)"), strerror(errno));
- signal(SIGPIPE, SIG_DFL);
+ set_sigpipe_to_default();
- execl("/bin/sh", "sh", "-c", cmd, NULL);
+ execlp("sh", "sh", "-c", cmd, NULL);
_exit(errno == ENOENT ? 127 : 126);
}
#endif /* NOT __EMX__, NOT __MINGW32__ */
-
diff --git a/gnu/packages/patches/gcc-strmov-store-file-names.patch b/gnu/packages/patches/gcc-strmov-store-file-names.patch
index 7951b87616..9f9162855d 100644
--- a/gnu/packages/patches/gcc-strmov-store-file-names.patch
+++ b/gnu/packages/patches/gcc-strmov-store-file-names.patch
@@ -2,23 +2,43 @@ Make sure that statements such as:
strcpy (dst, "/gnu/store/…");
+or
+
+ static const char str[] = "/gnu/store/…";
+ …
+ strcpy (dst, str);
+
do not result in chunked /gnu/store strings that are undetectable by
-Guix's GC and its grafting code. See <http://bugs.gnu.org/24703>.
+Guix's GC and its grafting code. See <https://bugs.gnu.org/24703>
+and <https://bugs.gnu.org/30395>.
+
--- gcc-5.3.0/gcc/builtins.c 2016-10-18 10:50:46.080616285 +0200
+++ gcc-5.3.0/gcc/builtins.c 2016-11-09 15:26:43.693042737 +0100
-@@ -3192,6 +3192,42 @@ determine_block_size (tree len, rtx len_
+@@ -3192,6 +3192,54 @@ determine_block_size (tree len, rtx len_
GET_MODE_MASK (GET_MODE (len_rtx)));
}
++extern void debug_tree (tree);
++
+/* Return true if STR contains the string "/gnu/store". */
+
-+static bool
++bool
+store_reference_p (tree str)
+{
++ if (getenv ("GUIX_GCC_DEBUG") != NULL)
++ debug_tree (str);
++
+ if (TREE_CODE (str) == ADDR_EXPR)
+ str = TREE_OPERAND (str, 0);
+
++ if (TREE_CODE (str) == VAR_DECL
++ && TREE_STATIC (str)
++ && TREE_READONLY (str))
++ /* STR may be a 'static const' variable whose initial value
++ is a string constant. See <https://bugs.gnu.org/30395>. */
++ str = DECL_INITIAL (str);
++
+ if (TREE_CODE (str) != STRING_CST)
+ return false;
+
@@ -57,10 +77,32 @@ Guix's GC and its grafting code. See <http://bugs.gnu.org/24703>.
+ /* Do not emit block moves, which translate to the 'movabs' instruction on
+ x86_64, when SRC refers to store items. That way, store references
+ remain visible to the Guix GC and grafting code. See
-+ <http://bugs.gnu.org/24703>. */
++ <https://bugs.gnu.org/24703>. */
+ if (store_reference_p (src))
+ return NULL_RTX;
+
/* If DEST is not a pointer type, call the normal function. */
if (dest_align == 0)
return NULL_RTX;
+
+--- gcc-5.5.0/gcc/gimple-fold.c 2018-03-20 11:36:16.709442004 +0100
++++ gcc-5.5.0/gcc/gimple-fold.c 2018-03-20 11:46:43.838487065 +0100
+@@ -769,6 +769,8 @@ var_decl_component_p (tree var)
+ return SSA_VAR_P (inner);
+ }
+
++extern bool store_reference_p (tree);
++
+ /* Fold function call to builtin mem{{,p}cpy,move}. Return
+ false if no simplification can be made.
+ If ENDP is 0, return DEST (like memcpy).
+@@ -1099,6 +1101,9 @@ gimple_fold_builtin_memory_op (gimple_st
+ if (!srctype)
+ return false;
+
++ if (store_reference_p (src))
++ return false;
++
+ src_align = get_pointer_alignment (src);
+ dest_align = get_pointer_alignment (dest);
+ if (dest_align < TYPE_ALIGN (desttype)
diff --git a/gnu/packages/patches/ghostscript-no-header-id.patch b/gnu/packages/patches/ghostscript-no-header-id.patch
index 19b71aadb5..da1aa5530f 100644
--- a/gnu/packages/patches/ghostscript-no-header-id.patch
+++ b/gnu/packages/patches/ghostscript-no-header-id.patch
@@ -9,7 +9,7 @@ See: https://bugs.ghostscript.com/show_bug.cgi?id=698208
diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c
--- orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c 2017-07-09 23:30:28.960479189 +0200
+++ gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c 2017-07-09 23:34:34.306524488 +0200
-@@ -1580,8 +1580,11 @@
+@@ -1785,8 +1785,11 @@
* +1 for the linearisation dict and +1 for the primary hint stream.
*/
linear_params->FirsttrailerOffset = gp_ftell_64(linear_params->Lin_File.file);
@@ -23,10 +23,10 @@ diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c gnu-ghostscript-9.
fwrite(LDict, strlen(LDict), 1, linear_params->Lin_File.file);
/* Write document catalog (Part 4) */
-@@ -2102,8 +2105,11 @@
- * in the missing values.
- */
- code = gp_fseek_64(linear_params->sfile, linear_params->FirsttrailerOffset, SEEK_SET);
+@@ -2321,8 +2324,11 @@
+ if (code != 0)
+ return_error(gs_error_ioerror);
+
- gs_sprintf(LDict, "\ntrailer\n<</Size %ld/Info %d 0 R/Root %d 0 R/ID[%s%s]/Prev %"PRId64">>\nstartxref\r\n0\n%%%%EOF\n",
- linear_params->LastResource + 3, pdev->ResourceUsage[linear_params->Info_id].NewObjectNumber, pdev->ResourceUsage[linear_params->Catalog_id].NewObjectNumber, fileID, fileID, mainxref);
+ gs_sprintf(LDict, "\ntrailer\n<</Size %ld/Info %d 0 R/Root %d 0 R",
@@ -37,7 +37,7 @@ diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c gnu-ghostscript-9.
fwrite(LDict, strlen(LDict), 1, linear_params->sfile);
code = gp_fseek_64(linear_params->sfile, pdev->ResourceUsage[HintStreamObj].LinearisedOffset, SEEK_SET);
-@@ -2674,10 +2680,12 @@
+@@ -3016,10 +3022,12 @@
stream_puts(s, "trailer\n");
pprintld3(s, "<< /Size %ld /Root %ld 0 R /Info %ld 0 R\n",
pdev->next_id, Catalog_id, Info_id);
@@ -54,4 +54,3 @@ diff -ur orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdf.c gnu-ghostscript-9.
if (pdev->OwnerPassword.size > 0) {
pprintld1(s, "/Encrypt %ld 0 R ", Encrypt_id);
}
-Nur in gnu-ghostscript-9.14.0/devices/vector: gdevpdf.c.orig.
diff --git a/gnu/packages/patches/glib-respect-datadir.patch b/gnu/packages/patches/glib-respect-datadir.patch
deleted file mode 100644
index 309ce9fc0b..0000000000
--- a/gnu/packages/patches/glib-respect-datadir.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-On Guix, Python modules are in a different output from the executables,
-so searching "../share/glib-2.0" will not work.
-
-This patch restores behaviour prior to this commit:
-<https://git.gnome.org/browse/glib/commit/?id=fe2a9887a8ccb14f2386e01b14834e97a33bc2d7>
-
---- a/gio/gdbus-2.0/codegen/gdbus-codegen.in
-+++ b/gio/gdbus-2.0/codegen/gdbus-codegen.in
-@@ -25,9 +25,12 @@
-
- srcdir = os.getenv('UNINSTALLED_GLIB_SRCDIR', None)
- filedir = os.path.dirname(__file__)
-+datadir = os.path.join('@datadir@', 'glib-2.0')
-
- if srcdir is not None:
- path = os.path.join(srcdir, 'gio', 'gdbus-2.0')
-+elif os.path.exists(os.path.join(datadir, 'codegen')):
-+ path = datadir
- elif os.path.basename(filedir) == 'bin':
- # Make the prefix containing gdbus-codegen 'relocatable' at runtime by
- # adding /some/prefix/bin/../share/glib-2.0 to the python path
diff --git a/gnu/packages/patches/glibc-2.27-git-fixes.patch b/gnu/packages/patches/glibc-2.27-git-fixes.patch
new file mode 100644
index 0000000000..4ed67c7c25
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.27-git-fixes.patch
@@ -0,0 +1,702 @@
+These commits are cherry-picked from the "release/2.27/master" branch.
+
+https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.27/master
+
+Currently, we have the following (with NEWS and ChangeLog entries omitted).
+
+56170e064e2b21ce204f0817733e92f1730541ea
+516fa6080481a1433c173320b1c1432868e1e38a
+f36553bf6a4f69070f99badbdab5802b43e6e211
+7c6304182b9f422b782ace1cdd3efbde056aec36
+78a90c2f74a2012dd3eff302189e47ff6779a757
+1e52d8e65a58c49a48549053a1b89c06240e0c6c
+55ad82e45c313454de657931898e974a7a036cad
+
+From 56170e064e2b21ce204f0817733e92f1730541ea Mon Sep 17 00:00:00 2001
+From: Igor Gnatenko <ignatenko@redhat.com>
+Date: Wed, 7 Feb 2018 13:53:10 +0100
+Subject: [PATCH] Linux: use reserved name __key in pkey_get [BZ #22797]
+
+_key is not reserved name and we should avoid using that. It seems that
+it was simple typo when pkey_* was implemented.
+
+(cherry picked from commit 388ff7bd0d57d7061fdd39a2f26f65687e8058da)
+
+diff --git a/sysdeps/unix/sysv/linux/bits/mman-shared.h b/sysdeps/unix/sysv/linux/bits/mman-shared.h
+index 7715e680ca..d15ba95c9d 100644
+--- a/sysdeps/unix/sysv/linux/bits/mman-shared.h
++++ b/sysdeps/unix/sysv/linux/bits/mman-shared.h
+@@ -61,7 +61,7 @@ int pkey_set (int __key, unsigned int __access_rights) __THROW;
+
+ /* Return the access rights for the current thread for KEY, which must
+ have been allocated using pkey_alloc. */
+-int pkey_get (int _key) __THROW;
++int pkey_get (int __key) __THROW;
+
+ /* Free an allocated protection key, which must have been allocated
+ using pkey_alloc. */
+
+From 516fa6080481a1433c173320b1c1432868e1e38a Mon Sep 17 00:00:00 2001
+From: "Dmitry V. Levin" <ldv@altlinux.org>
+Date: Fri, 29 Dec 2017 23:19:32 +0000
+Subject: [PATCH] linux/aarch64: sync sys/ptrace.h with Linux 4.15 [BZ #22433]
+
+Remove compat-specific constants that were never exported by kernel
+headers under these names. Before linux commit v3.7-rc1~16^2~1 they
+were exported with COMPAT_ prefix, and since that commit they are not
+exported at all.
+
+* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h (__ptrace_request):
+Remove arm-specific PTRACE_GET_THREAD_AREA, PTRACE_GETHBPREGS,
+and PTRACE_SETHBPREGS.
+
+(cherry picked from commit 2fd4bbaa1446f1be700e10c526cf585a796c4991)
+
+diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h b/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
+index 4be45b95ff..444edbb702 100644
+--- a/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
++++ b/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
+@@ -78,18 +78,10 @@ enum __ptrace_request
+ PTRACE_DETACH = 17,
+ #define PT_DETACH PTRACE_DETACH
+
+- PTRACE_GET_THREAD_AREA = 22,
+-
+ /* Continue and stop at the next entry to or return from syscall. */
+ PTRACE_SYSCALL = 24,
+ #define PT_SYSCALL PTRACE_SYSCALL
+
+- /* Get all hardware breakpoint registers. */
+- PTRACE_GETHBPREGS = 29,
+-
+- /* Set all hardware breakpoint registers. */
+- PTRACE_SETHBPREGS = 30,
+-
+ /* Set ptrace filter options. */
+ PTRACE_SETOPTIONS = 0x4200,
+ #define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+From f36553bf6a4f69070f99badbdab5802b43e6e211 Mon Sep 17 00:00:00 2001
+From: Mike FABIAN <mfabian@redhat.com>
+Date: Mon, 19 Feb 2018 21:59:30 +0100
+Subject: [PATCH] =?UTF-8?q?Add=20missing=20=E2=80=9Creorder-end=E2=80=9D?=
+ =?UTF-8?q?=20in=20LC=5FCOLLATE=20of=20et=5FEE=20[BZ=20#22517]?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+ [BZ #22517]
+ * localedata/locales/et_EE (LC_COLLATE): add missing “reorder-end”
+
+(cherry picked from commit 7ec5f9465e732e668d0dc94ac078ba68056d6d0a)
+
+diff --git a/localedata/locales/et_EE b/localedata/locales/et_EE
+index 9cb55b568f..bab7493c98 100644
+--- a/localedata/locales/et_EE
++++ b/localedata/locales/et_EE
+@@ -103,6 +103,8 @@ reorder-after <w>
+ <U00FC> <u-diaresis>;<BAS>;<MIN>;IGNORE % ü
+ <U00DC> <u-diaresis>;<BAS>;<CAP>;IGNORE % Ü
+
++reorder-end
++
+ END LC_COLLATE
+
+ LC_CTYPE
+
+From 7c6304182b9f422b782ace1cdd3efbde056aec36 Mon Sep 17 00:00:00 2001
+From: DJ Delorie <dj@redhat.com>
+Date: Thu, 1 Mar 2018 23:20:45 -0500
+Subject: [PATCH] [BZ #22342] Fix netgroup cache keys.
+
+Unlike other nscd caches, the netgroup cache contains two types of
+records - those for "iterate through a netgroup" (i.e. setnetgrent())
+and those for "is this user in this netgroup" (i.e. innetgr()),
+i.e. full and partial records. The timeout code assumes these records
+have the same key for the group name, so that the collection of records
+that is "this netgroup" can be expired as a unit.
+
+However, the keys are not the same, as the in-netgroup key is generated
+by nscd rather than being passed to it from elsewhere, and is generated
+without the trailing NUL. All other keys have the trailing NUL, and as
+noted in the linked BZ, debug statements confirm that two keys for the
+same netgroup are added to the cache with two different lengths.
+
+The result of this is that as records in the cache expire, the purge
+code only cleans out one of the two types of entries, resulting in
+stale, possibly incorrect, and possibly inconsistent cache data.
+
+The patch simply includes the existing NUL in the computation for the
+key length ('key' points to the char after the NUL, and 'group' to the
+first char of the group, so 'key-group' includes the first char to the
+NUL, inclusive).
+
+ [BZ #22342]
+ * nscd/netgroupcache.c (addinnetgrX): Include trailing NUL in
+ key value.
+
+Reviewed-by: Carlos O'Donell <carlos@redhat.com>
+(cherry picked from commit 1c81d55fc4b07b51adf68558ba74ce975153e580)
+
+diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
+index b832c9315f..2f187b208c 100644
+--- a/nscd/netgroupcache.c
++++ b/nscd/netgroupcache.c
+@@ -480,7 +480,7 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
+ {
+ const char *group = key;
+ key = (char *) rawmemchr (key, '\0') + 1;
+- size_t group_len = key - group - 1;
++ size_t group_len = key - group;
+ const char *host = *key++ ? key : NULL;
+ if (host != NULL)
+ key = (char *) rawmemchr (key, '\0') + 1;
+
+From 78a90c2f74a2012dd3eff302189e47ff6779a757 Mon Sep 17 00:00:00 2001
+From: Andreas Schwab <schwab@linux-m68k.org>
+Date: Fri, 2 Mar 2018 23:07:14 +0100
+Subject: [PATCH] Fix multiple definitions of __nss_*_database (bug 22918)
+
+(cherry picked from commit eaf6753f8aac33a36deb98c1031d1bad7b593d2d)
+
+diff --git a/nscd/gai.c b/nscd/gai.c
+index d081747797..576fd0045b 100644
+--- a/nscd/gai.c
++++ b/nscd/gai.c
+@@ -45,3 +45,6 @@
+ #ifdef HAVE_LIBIDN
+ # include <libidn/idn-stub.c>
+ #endif
++
++/* Some variables normally defined in libc. */
++service_user *__nss_hosts_database attribute_hidden;
+diff --git a/nss/nsswitch.c b/nss/nsswitch.c
+index d5e655974f..b0f0c11a3e 100644
+--- a/nss/nsswitch.c
++++ b/nss/nsswitch.c
+@@ -62,7 +62,7 @@ static service_library *nss_new_service (name_database *database,
+
+ /* Declare external database variables. */
+ #define DEFINE_DATABASE(name) \
+- extern service_user *__nss_##name##_database attribute_hidden; \
++ service_user *__nss_##name##_database attribute_hidden; \
+ weak_extern (__nss_##name##_database)
+ #include "databases.def"
+ #undef DEFINE_DATABASE
+diff --git a/nss/nsswitch.h b/nss/nsswitch.h
+index eccb535ef5..63573b9ebc 100644
+--- a/nss/nsswitch.h
++++ b/nss/nsswitch.h
+@@ -226,10 +226,10 @@ libc_hidden_proto (__nss_hostname_digits_dots)
+ #define MAX_NR_ADDRS 48
+
+ /* Prototypes for __nss_*_lookup2 functions. */
+-#define DEFINE_DATABASE(arg) \
+- service_user *__nss_##arg##_database attribute_hidden; \
+- int __nss_##arg##_lookup2 (service_user **, const char *, \
+- const char *, void **); \
++#define DEFINE_DATABASE(arg) \
++ extern service_user *__nss_##arg##_database attribute_hidden; \
++ int __nss_##arg##_lookup2 (service_user **, const char *, \
++ const char *, void **); \
+ libc_hidden_proto (__nss_##arg##_lookup2)
+ #include "databases.def"
+ #undef DEFINE_DATABASE
+diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c
+index f509534ca9..8c64ac59ff 100644
+--- a/posix/tst-rfc3484-2.c
++++ b/posix/tst-rfc3484-2.c
+@@ -58,6 +58,7 @@ _res_hconf_init (void)
+ #undef USE_NSCD
+ #include "../sysdeps/posix/getaddrinfo.c"
+
++service_user *__nss_hosts_database attribute_hidden;
+
+ /* This is the beginning of the real test code. The above defines
+ (among other things) the function rfc3484_sort. */
+diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c
+index ae44087a10..1c61aaf844 100644
+--- a/posix/tst-rfc3484-3.c
++++ b/posix/tst-rfc3484-3.c
+@@ -58,6 +58,7 @@ _res_hconf_init (void)
+ #undef USE_NSCD
+ #include "../sysdeps/posix/getaddrinfo.c"
+
++service_user *__nss_hosts_database attribute_hidden;
+
+ /* This is the beginning of the real test code. The above defines
+ (among other things) the function rfc3484_sort. */
+diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
+index 7f191abbbc..8f45848e44 100644
+--- a/posix/tst-rfc3484.c
++++ b/posix/tst-rfc3484.c
+@@ -58,6 +58,7 @@ _res_hconf_init (void)
+ #undef USE_NSCD
+ #include "../sysdeps/posix/getaddrinfo.c"
+
++service_user *__nss_hosts_database attribute_hidden;
+
+ /* This is the beginning of the real test code. The above defines
+ (among other things) the function rfc3484_sort. */
+
+From 1e52d8e65a58c49a48549053a1b89c06240e0c6c Mon Sep 17 00:00:00 2001
+From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
+Date: Fri, 17 Nov 2017 16:04:29 -0200
+Subject: [PATCH] i386: Fix i386 sigaction sa_restorer initialization
+ (BZ#21269)
+
+This patch fixes the i386 sa_restorer field initialization for sigaction
+syscall for kernel with vDSO. As described in bug report, i386 Linux
+(and compat on x86_64) interprets SA_RESTORER clear with nonzero
+sa_restorer as a request for stack switching if the SS segment is 'funny'.
+This means that anything that tries to mix glibc's signal handling with
+segmentation (for instance through modify_ldt syscall) is randomly broken
+depending on what values lands in sa_restorer.
+
+The testcase added is based on Linux test tools/testing/selftests/x86/ldt_gdt.c,
+more specifically in do_multicpu_tests function. The main changes are:
+
+ - C11 atomics instead of plain access.
+
+ - Remove x86_64 support which simplifies the syscall handling and fallbacks.
+
+ - Replicate only the test required to trigger the issue.
+
+Checked on i686-linux-gnu.
+
+ [BZ #21269]
+ * sysdeps/unix/sysv/linux/i386/Makefile (tests): Add tst-bz21269.
+ * sysdeps/unix/sysv/linux/i386/sigaction.c (SET_SA_RESTORER): Clear
+ sa_restorer for vDSO case.
+ * sysdeps/unix/sysv/linux/i386/tst-bz21269.c: New file.
+
+(cherry picked from commit 68448be208ee06e76665918b37b0a57e3e00c8b4)
+
+diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
+index 4080b8c966..da716e2c1b 100644
+--- a/sysdeps/unix/sysv/linux/i386/Makefile
++++ b/sysdeps/unix/sysv/linux/i386/Makefile
+@@ -3,6 +3,9 @@ default-abi := 32
+
+ ifeq ($(subdir),misc)
+ sysdep_routines += ioperm iopl vm86
++
++tests += tst-bz21269
++$(objpfx)tst-bz21269: $(shared-thread-library)
+ endif
+
+ ifeq ($(subdir),elf)
+diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
+index a5eb9e0d3e..177ff60ee6 100644
+--- a/sysdeps/unix/sysv/linux/i386/sigaction.c
++++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
+@@ -42,7 +42,6 @@ extern void restore_rt (void) asm ("__restore_rt") attribute_hidden;
+ #endif
+ extern void restore (void) asm ("__restore") attribute_hidden;
+
+-
+ /* If ACT is not NULL, change the action for SIG to *ACT.
+ If OACT is not NULL, put the old action for SIG in *OACT. */
+ int
+@@ -65,6 +64,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
+ kact.sa_restorer = ((act->sa_flags & SA_SIGINFO)
+ ? &restore_rt : &restore);
+ }
++ else
++ kact.sa_restorer = NULL;
+ }
+
+ /* XXX The size argument hopefully will have to be changed to the
+diff --git a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
+new file mode 100644
+index 0000000000..353e36507d
+--- /dev/null
++++ b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
+@@ -0,0 +1,233 @@
++/* Test for i386 sigaction sa_restorer handling (BZ#21269)
++ Copyright (C) 2017 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++/* This is based on Linux test tools/testing/selftests/x86/ldt_gdt.c,
++ more specifically in do_multicpu_tests function. The main changes
++ are:
++
++ - C11 atomics instead of plain access.
++ - Remove x86_64 support which simplifies the syscall handling
++ and fallbacks.
++ - Replicate only the test required to trigger the issue for the
++ BZ#21269. */
++
++#include <stdatomic.h>
++
++#include <asm/ldt.h>
++#include <linux/futex.h>
++
++#include <setjmp.h>
++#include <signal.h>
++#include <errno.h>
++#include <sys/syscall.h>
++#include <sys/mman.h>
++
++#include <support/xunistd.h>
++#include <support/check.h>
++#include <support/xthread.h>
++
++static int
++xset_thread_area (struct user_desc *u_info)
++{
++ long ret = syscall (SYS_set_thread_area, u_info);
++ TEST_VERIFY_EXIT (ret == 0);
++ return ret;
++}
++
++static void
++xmodify_ldt (int func, const void *ptr, unsigned long bytecount)
++{
++ TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, 1, ptr, bytecount) == 0);
++}
++
++static int
++futex (int *uaddr, int futex_op, int val, void *timeout, int *uaddr2,
++ int val3)
++{
++ return syscall (SYS_futex, uaddr, futex_op, val, timeout, uaddr2, val3);
++}
++
++static void
++xsethandler (int sig, void (*handler)(int, siginfo_t *, void *), int flags)
++{
++ struct sigaction sa = { 0 };
++ sa.sa_sigaction = handler;
++ sa.sa_flags = SA_SIGINFO | flags;
++ TEST_VERIFY_EXIT (sigemptyset (&sa.sa_mask) == 0);
++ TEST_VERIFY_EXIT (sigaction (sig, &sa, 0) == 0);
++}
++
++static jmp_buf jmpbuf;
++
++static void
++sigsegv_handler (int sig, siginfo_t *info, void *ctx_void)
++{
++ siglongjmp (jmpbuf, 1);
++}
++
++/* Points to an array of 1024 ints, each holding its own index. */
++static const unsigned int *counter_page;
++static struct user_desc *low_user_desc;
++static struct user_desc *low_user_desc_clear; /* Used to delete GDT entry. */
++static int gdt_entry_num;
++
++static void
++setup_counter_page (void)
++{
++ long page_size = sysconf (_SC_PAGE_SIZE);
++ TEST_VERIFY_EXIT (page_size > 0);
++ unsigned int *page = xmmap (NULL, page_size, PROT_READ | PROT_WRITE,
++ MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1);
++ for (int i = 0; i < (page_size / sizeof (unsigned int)); i++)
++ page[i] = i;
++ counter_page = page;
++}
++
++static void
++setup_low_user_desc (void)
++{
++ low_user_desc = xmmap (NULL, 2 * sizeof (struct user_desc),
++ PROT_READ | PROT_WRITE,
++ MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1);
++
++ low_user_desc->entry_number = -1;
++ low_user_desc->base_addr = (unsigned long) &counter_page[1];
++ low_user_desc->limit = 0xffff;
++ low_user_desc->seg_32bit = 1;
++ low_user_desc->contents = 0;
++ low_user_desc->read_exec_only = 0;
++ low_user_desc->limit_in_pages = 1;
++ low_user_desc->seg_not_present = 0;
++ low_user_desc->useable = 0;
++
++ xset_thread_area (low_user_desc);
++
++ low_user_desc_clear = low_user_desc + 1;
++ low_user_desc_clear->entry_number = gdt_entry_num;
++ low_user_desc_clear->read_exec_only = 1;
++ low_user_desc_clear->seg_not_present = 1;
++}
++
++/* Possible values of futex:
++ 0: thread is idle.
++ 1: thread armed.
++ 2: thread should clear LDT entry 0.
++ 3: thread should exit. */
++static atomic_uint ftx;
++
++static void *
++threadproc (void *ctx)
++{
++ while (1)
++ {
++ futex ((int *) &ftx, FUTEX_WAIT, 1, NULL, NULL, 0);
++ while (atomic_load (&ftx) != 2)
++ {
++ if (atomic_load (&ftx) >= 3)
++ return NULL;
++ }
++
++ /* clear LDT entry 0. */
++ const struct user_desc desc = { 0 };
++ xmodify_ldt (1, &desc, sizeof (desc));
++
++ /* If ftx == 2, set it to zero, If ftx == 100, quit. */
++ if (atomic_fetch_add (&ftx, -2) != 2)
++ return NULL;
++ }
++}
++
++
++/* As described in testcase, for historical reasons x86_32 Linux (and compat
++ on x86_64) interprets SA_RESTORER clear with nonzero sa_restorer as a
++ request for stack switching if the SS segment is 'funny' (this is default
++ scenario for vDSO system). This means that anything that tries to mix
++ signal handling with segmentation should explicit clear the sa_restorer.
++
++ This testcase check if sigaction in fact does it by changing the local
++ descriptor table (LDT) through the modify_ldt syscall and triggering
++ a synchronous segfault on iret fault by trying to install an invalid
++ segment. With a correct zeroed sa_restorer it should not trigger an
++ 'real' SEGSEGV and allows the siglongjmp in signal handler. */
++
++static int
++do_test (void)
++{
++ setup_counter_page ();
++ setup_low_user_desc ();
++
++ pthread_t thread;
++ unsigned short orig_ss;
++
++ xsethandler (SIGSEGV, sigsegv_handler, 0);
++ /* 32-bit kernels send SIGILL instead of SIGSEGV on IRET faults. */
++ xsethandler (SIGILL, sigsegv_handler, 0);
++
++ thread = xpthread_create (0, threadproc, 0);
++
++ asm volatile ("mov %%ss, %0" : "=rm" (orig_ss));
++
++ for (int i = 0; i < 5; i++)
++ {
++ if (sigsetjmp (jmpbuf, 1) != 0)
++ continue;
++
++ /* Make sure the thread is ready after the last test. */
++ while (atomic_load (&ftx) != 0)
++ ;
++
++ struct user_desc desc = {
++ .entry_number = 0,
++ .base_addr = 0,
++ .limit = 0xffff,
++ .seg_32bit = 1,
++ .contents = 0,
++ .read_exec_only = 0,
++ .limit_in_pages = 1,
++ .seg_not_present = 0,
++ .useable = 0
++ };
++
++ xmodify_ldt (0x11, &desc, sizeof (desc));
++
++ /* Arm the thread. */
++ ftx = 1;
++ futex ((int*) &ftx, FUTEX_WAKE, 0, NULL, NULL, 0);
++
++ asm volatile ("mov %0, %%ss" : : "r" (0x7));
++
++ /* Fire up thread modify_ldt call. */
++ atomic_store (&ftx, 2);
++
++ while (atomic_load (&ftx) != 0)
++ ;
++
++ /* On success, modify_ldt will segfault us synchronously and we will
++ escape via siglongjmp. */
++ support_record_failure ();
++ }
++
++ atomic_store (&ftx, 100);
++ futex ((int*) &ftx, FUTEX_WAKE, 0, NULL, NULL, 0);
++
++ xpthread_join (thread);
++
++ return 0;
++}
++
++#include <support/test-driver.c>
+
+From 55ad82e45c313454de657931898e974a7a036cad Mon Sep 17 00:00:00 2001
+From: Andrew Senkevich <andrew.n.senkevich@gmail.com>
+Date: Fri, 23 Mar 2018 16:19:45 +0100
+Subject: [PATCH] Fix i386 memmove issue (bug 22644).
+
+ [BZ #22644]
+ * sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Fixed
+ branch conditions.
+ * string/test-memmove.c (do_test2): New testcase.
+
+(cherry picked from commit cd66c0e584c6d692bc8347b5e72723d02b8a8ada)
+
+diff --git a/string/test-memmove.c b/string/test-memmove.c
+index edc7a4c3bf..64e3651ba4 100644
+--- a/string/test-memmove.c
++++ b/string/test-memmove.c
+@@ -24,6 +24,7 @@
+ # define TEST_NAME "memmove"
+ #endif
+ #include "test-string.h"
++#include <support/test-driver.h>
+
+ char *simple_memmove (char *, const char *, size_t);
+
+@@ -245,6 +246,60 @@ do_random_tests (void)
+ }
+ }
+
++static void
++do_test2 (void)
++{
++ size_t size = 0x20000000;
++ uint32_t * large_buf;
++
++ large_buf = mmap ((void*) 0x70000000, size, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANON, -1, 0);
++
++ if (large_buf == MAP_FAILED)
++ error (EXIT_UNSUPPORTED, errno, "Large mmap failed");
++
++ if ((uintptr_t) large_buf > 0x80000000 - 128
++ || 0x80000000 - (uintptr_t) large_buf > 0x20000000)
++ {
++ error (0, 0, "Large mmap allocated improperly");
++ ret = EXIT_UNSUPPORTED;
++ munmap ((void *) large_buf, size);
++ return;
++ }
++
++ size_t bytes_move = 0x80000000 - (uintptr_t) large_buf;
++ size_t arr_size = bytes_move / sizeof (uint32_t);
++ size_t i;
++
++ FOR_EACH_IMPL (impl, 0)
++ {
++ for (i = 0; i < arr_size; i++)
++ large_buf[i] = (uint32_t) i;
++
++ uint32_t * dst = &large_buf[33];
++
++#ifdef TEST_BCOPY
++ CALL (impl, (char *) large_buf, (char *) dst, bytes_move);
++#else
++ CALL (impl, (char *) dst, (char *) large_buf, bytes_move);
++#endif
++
++ for (i = 0; i < arr_size; i++)
++ {
++ if (dst[i] != (uint32_t) i)
++ {
++ error (0, 0,
++ "Wrong result in function %s dst \"%p\" src \"%p\" offset \"%zd\"",
++ impl->name, dst, large_buf, i);
++ ret = 1;
++ break;
++ }
++ }
++ }
++
++ munmap ((void *) large_buf, size);
++}
++
+ int
+ test_main (void)
+ {
+@@ -284,6 +339,9 @@ test_main (void)
+ }
+
+ do_random_tests ();
++
++ do_test2 ();
++
+ return ret;
+ }
+
+diff --git a/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S b/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
+index 9c3bbe7e17..9aa17de99c 100644
+--- a/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
++++ b/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
+@@ -72,7 +72,7 @@ ENTRY (MEMCPY)
+ cmp %edx, %eax
+
+ # ifdef USE_AS_MEMMOVE
+- jg L(check_forward)
++ ja L(check_forward)
+
+ L(mm_len_0_or_more_backward):
+ /* Now do checks for lengths. We do [0..16], [16..32], [32..64], [64..128]
+@@ -81,7 +81,7 @@ L(mm_len_0_or_more_backward):
+ jbe L(mm_len_0_16_bytes_backward)
+
+ cmpl $32, %ecx
+- jg L(mm_len_32_or_more_backward)
++ ja L(mm_len_32_or_more_backward)
+
+ /* Copy [0..32] and return. */
+ movdqu (%eax), %xmm0
+@@ -92,7 +92,7 @@ L(mm_len_0_or_more_backward):
+
+ L(mm_len_32_or_more_backward):
+ cmpl $64, %ecx
+- jg L(mm_len_64_or_more_backward)
++ ja L(mm_len_64_or_more_backward)
+
+ /* Copy [0..64] and return. */
+ movdqu (%eax), %xmm0
+@@ -107,7 +107,7 @@ L(mm_len_32_or_more_backward):
+
+ L(mm_len_64_or_more_backward):
+ cmpl $128, %ecx
+- jg L(mm_len_128_or_more_backward)
++ ja L(mm_len_128_or_more_backward)
+
+ /* Copy [0..128] and return. */
+ movdqu (%eax), %xmm0
+@@ -132,7 +132,7 @@ L(mm_len_128_or_more_backward):
+ add %ecx, %eax
+ cmp %edx, %eax
+ movl SRC(%esp), %eax
+- jle L(forward)
++ jbe L(forward)
+ PUSH (%esi)
+ PUSH (%edi)
+ PUSH (%ebx)
+@@ -269,7 +269,7 @@ L(check_forward):
+ add %edx, %ecx
+ cmp %eax, %ecx
+ movl LEN(%esp), %ecx
+- jle L(forward)
++ jbe L(forward)
+
+ /* Now do checks for lengths. We do [0..16], [0..32], [0..64], [0..128]
+ separately. */
diff --git a/gnu/packages/patches/glibc-bootstrap-system.patch b/gnu/packages/patches/glibc-bootstrap-system.patch
index 2f8e7da7e1..addeed6dbd 100644
--- a/gnu/packages/patches/glibc-bootstrap-system.patch
+++ b/gnu/packages/patches/glibc-bootstrap-system.patch
@@ -15,16 +15,16 @@ instead uses the hard-coded absolute file name of `bash'.
}
else if (pid < (pid_t) 0)
---- b/libio/iopopen.c 2012-06-30 21:12:34.000000000 +0200
-+++ b/libio/iopopen.c 2012-12-19 12:52:29.000000000 +0100
-@@ -226,7 +226,7 @@ _IO_new_proc_open (fp, command, mode)
- _IO_close (fd);
+--- a/libio/iopopen.c
++++ b/libio/iopopen.c
+@@ -145,7 +145,7 @@ _IO_new_proc_open (fp, command, mode)
+ __close_nocancel (fd);
}
-- _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0);
+- execl ("/bin/sh", "sh", "-c", command, (char *) 0);
+ execlp ("sh", "sh", "-c", command, (char *) 0);
- _IO__exit (127);
+ _exit (127);
}
- _IO_close (child_end);
+ __close_nocancel (child_end);
diff --git a/gnu/packages/patches/glibc-hidden-visibility-ldconfig.patch b/gnu/packages/patches/glibc-hidden-visibility-ldconfig.patch
new file mode 100644
index 0000000000..c796946d7e
--- /dev/null
+++ b/gnu/packages/patches/glibc-hidden-visibility-ldconfig.patch
@@ -0,0 +1,16 @@
+Fix a regression in glibc 2.27 when built without ldconfig. See
+<https://sourceware.org/bugzilla/show_bug.cgi?id=22977> for details.
+
+diff --git a/include/libc-symbols.h b/include/libc-symbols.h
+index 6137304b0b..7d630f36d8 100644
+--- a/include/libc-symbols.h
++++ b/include/libc-symbols.h
+@@ -508,7 +508,7 @@ for linking")
+ # ifndef __ASSEMBLER__
+ # if !defined SHARED && IS_IN (libc) && !defined LIBC_NONSHARED \
+ && (!defined PIC || !defined NO_HIDDEN_EXTERN_FUNC_IN_PIE) \
+- && !defined NO_HIDDEN
++ && !defined NO_HIDDEN && defined USE_LDCONFIG
+ # define __hidden_proto_hiddenattr(attrs...) \
+ __attribute__ ((visibility ("hidden"), ##attrs))
+ # define hidden_proto(name, attrs...) \
diff --git a/gnu/packages/patches/glibc-reinstate-prlimit64-fallback.patch b/gnu/packages/patches/glibc-reinstate-prlimit64-fallback.patch
new file mode 100644
index 0000000000..ccc153c12a
--- /dev/null
+++ b/gnu/packages/patches/glibc-reinstate-prlimit64-fallback.patch
@@ -0,0 +1,127 @@
+This patch reinstates fallback code when the 'prlimit64' system call is
+missing by reverting the relevant part of this upstream commit:
+
+ commit 695d7d138eda449678a1650a8b8b58181033353f
+ Author: Joseph Myers <joseph@codesourcery.com>
+ Date: Tue May 9 14:05:09 2017 +0000
+
+ Assume prlimit64 is available.
+
+The fallback code is useful on systems that lack 'prlimit64', such as the
+2.6.32-on-steroid kernel found on RHEL 6:
+
+ <https://lists.gnu.org/archive/html/guix-devel/2018-03/msg00349.html>
+
+diff --git a/sysdeps/unix/sysv/linux/getrlimit64.c b/sysdeps/unix/sysv/linux/getrlimit64.c
+index 37c173286f..56af3c0646 100644
+--- b/sysdeps/unix/sysv/linux/getrlimit64.c
++++ a/sysdeps/unix/sysv/linux/getrlimit64.c
+@@ -35,7 +35,40 @@
+ int
+ __getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
+ {
+- return INLINE_SYSCALL_CALL (prlimit64, 0, resource, NULL, rlimits);
++#ifdef __NR_prlimit64
++ int res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, NULL, rlimits);
++ if (res == 0 || errno != ENOSYS)
++ return res;
++#endif
++
++/* The fallback code only makes sense if the platform supports either
++ __NR_ugetrlimit and/or __NR_getrlimit. */
++#if defined (__NR_ugetrlimit) || defined (__NR_getrlimit)
++# ifndef __NR_ugetrlimit
++# define __NR_ugetrlimit __NR_getrlimit
++# endif
++# if __RLIM_T_MATCHES_RLIM64_T
++# define rlimits32 (*rlimits)
++# else
++ struct rlimit rlimits32;
++# endif
++
++ if (INLINE_SYSCALL_CALL (ugetrlimit, resource, &rlimits32) < 0)
++ return -1;
++
++# if !__RLIM_T_MATCHES_RLIM64_T
++ if (rlimits32.rlim_cur == RLIM_INFINITY)
++ rlimits->rlim_cur = RLIM64_INFINITY;
++ else
++ rlimits->rlim_cur = rlimits32.rlim_cur;
++ if (rlimits32.rlim_max == RLIM_INFINITY)
++ rlimits->rlim_max = RLIM64_INFINITY;
++ else
++ rlimits->rlim_max = rlimits32.rlim_max;
++# endif /* !__RLIM_T_MATCHES_RLIM64_T */
++#endif /* defined (__NR_ugetrlimit) || defined (__NR_getrlimit) */
++
++ return 0;
+ }
+ libc_hidden_def (__getrlimit64)
+
+diff --git a/sysdeps/unix/sysv/linux/setrlimit.c b/sysdeps/unix/sysv/linux/setrlimit.c
+index 01812ac355..8773c78236 100644
+--- b/sysdeps/unix/sysv/linux/setrlimit.c
++++ a/sysdeps/unix/sysv/linux/setrlimit.c
+@@ -34,6 +34,7 @@
+ int
+ __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlim)
+ {
++# ifdef __NR_prlimit64
+ struct rlimit64 rlim64;
+
+ if (rlim->rlim_cur == RLIM_INFINITY)
+@@ -45,7 +46,11 @@
+ else
+ rlim64.rlim_max = rlim->rlim_max;
+
+- return INLINE_SYSCALL_CALL (prlimit64, 0, resource, &rlim64, NULL);
++ int res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, &rlim64, NULL);
++ if (res == 0 || errno != ENOSYS)
++ return res;
++# endif
++ return INLINE_SYSCALL_CALL (setrlimit, resource, rlim);
+ }
+
+ # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
+diff --git a/sysdeps/unix/sysv/linux/setrlimit64.c b/sysdeps/unix/sysv/linux/setrlimit64.c
+index 2dd129d99e..db1960fc18 100644
+--- b/sysdeps/unix/sysv/linux/setrlimit64.c
++++ a/sysdeps/unix/sysv/linux/setrlimit64.c
+@@ -36,7 +36,36 @@
+ int
+ __setrlimit64 (enum __rlimit_resource resource, const struct rlimit64 *rlimits)
+ {
+- return INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlimits, NULL);
++ int res;
++
++#ifdef __NR_prlimit64
++ res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlimits, NULL);
++ if (res == 0 || errno != ENOSYS)
++ return res;
++#endif
++
++/* The fallback code only makes sense if the platform supports
++ __NR_setrlimit. */
++#ifdef __NR_setrlimit
++# if !__RLIM_T_MATCHES_RLIM64_T
++ struct rlimit rlimits32;
++
++ if (rlimits->rlim_cur >= RLIM_INFINITY)
++ rlimits32.rlim_cur = RLIM_INFINITY;
++ else
++ rlimits32.rlim_cur = rlimits->rlim_cur;
++ if (rlimits->rlim_max >= RLIM_INFINITY)
++ rlimits32.rlim_max = RLIM_INFINITY;
++ else
++ rlimits32.rlim_max = rlimits->rlim_max;
++# else
++# define rlimits32 (*rlimits)
++# endif
++
++ res = INLINE_SYSCALL_CALL (setrlimit, resource, &rlimits32);
++#endif
++
++ return res;
+ }
+ weak_alias (__setrlimit64, setrlimit64)
+
diff --git a/gnu/packages/patches/graphite2-ffloat-store.patch b/gnu/packages/patches/graphite2-ffloat-store.patch
deleted file mode 100644
index f6ee56973e..0000000000
--- a/gnu/packages/patches/graphite2-ffloat-store.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Fix test failures of awamicmp1 and awamicmp2.
-
-Debian bug report:
-
-https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855814
-
-Patch adapted from upstream source repository:
-
-https://github.com/silnrsi/graphite/commit/f7bbdd87d510d587c872e314d6458160c0069c65
-
-From f7bbdd87d510d587c872e314d6458160c0069c65 Mon Sep 17 00:00:00 2001
-From: Martin Hosken <martin_hosken@sil.org>
-Date: Tue, 14 Feb 2017 17:00:03 +0000
-Subject: [PATCH] try -ffloat-store for fp stability. Remove nested const to
- work around VS bug
-
----
- src/CMakeLists.txt | 2 +-
- src/inc/locale2lcid.h | 4 ++--
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 4f1e7e5..5b61b5c 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -108,7 +108,7 @@ set_target_properties(graphite2 PROPERTIES PUBLIC_HEADER "${GRAPHITE_HEADERS}"
-
- if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
- set_target_properties(graphite2 PROPERTIES
-- COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wctor-dtor-privacy -Wnon-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-stack-protector"
-+ COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wctor-dtor-privacy -Wnon-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-stack-protector -ffloat-store"
- LINK_FLAGS "-nodefaultlibs ${GRAPHITE_LINK_FLAGS}"
- LINKER_LANGUAGE C)
- if (CMAKE_COMPILER_IS_GNUCXX)
diff --git a/gnu/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch b/gnu/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch
new file mode 100644
index 0000000000..e6b578bdb7
--- /dev/null
+++ b/gnu/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch
@@ -0,0 +1,53 @@
+From 1da99396dc65993ba34ac0370ca5d6acda6a3322 Mon Sep 17 00:00:00 2001
+From: Mark H Weaver <mhw@netris.org>
+Date: Sun, 18 Mar 2018 07:02:37 -0400
+Subject: [PATCH] Add support for gdbm-1.14.
+
+As of gdbm-1.14, 'gdbm_errno' no longer exists as a binary interface.
+It has been replaced by 'gdbm_errno_location', a function that returns
+int*. We now use this new interface if it's available.
+---
+ gdbm.scm | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/gdbm.scm b/gdbm.scm
+index b92992f..4d38cc3 100644
+--- a/gdbm.scm
++++ b/gdbm.scm
+@@ -17,6 +17,9 @@
+ ;; You should have received a copy of the GNU General Public License
+ ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
++;; Modified by Mark H Weaver <mhw@netris.org> in March 2018 to support
++;; gdbm-1.14 with its new 'gdbm_errno_location' interface.
++
+ (define-module (gdbm)
+ #:use-module (system foreign)
+ #:use-module (rnrs bytevectors)
+@@ -151,10 +154,21 @@
+
+ ;;; errors
+
+-(define %errno (dynamic-pointer "gdbm_errno" libgdbm))
++(define %list-int
++ (list int))
++
++(define (dereference-int ptr)
++ (apply (lambda (errno) errno)
++ (parse-c-struct ptr %list-int)))
++
++(define %errno-location
++ (or (false-if-exception
++ (let ((func (dynamic-func "gdbm_errno_location" libgdbm)))
++ (pointer->procedure '* func '())))
++ (const (dynamic-pointer "gdbm_errno" libgdbm))))
+
+ (define (gdbm-errno)
+- (pointer-address (dereference-pointer %errno)))
++ (dereference-int (%errno-location)))
+
+ (define (gdbm-error)
+ (error (pointer->string (%gdbm-strerror (gdbm-errno)))))
+--
+2.16.2
+
diff --git a/gnu/packages/patches/lcms-CVE-2016-10165.patch b/gnu/packages/patches/lcms-CVE-2016-10165.patch
deleted file mode 100644
index fa4d75c9ee..0000000000
--- a/gnu/packages/patches/lcms-CVE-2016-10165.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Fix CVE-2016-10165, an out-of-bounds heap read in Type_MLU_Read():
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-10165
-http://seclists.org/oss-sec/2016/q3/288
-https://bugzilla.redhat.com/show_bug.cgi?id=1367357
-https://security-tracker.debian.org/tracker/CVE-2016-10165
-
-Patch copied from upstream source repository:
-
-https://github.com/mm2/Little-CMS/commit/5ca71a7bc18b6897ab21d815d15e218e204581e2
-
-From 5ca71a7bc18b6897ab21d815d15e218e204581e2 Mon Sep 17 00:00:00 2001
-From: Marti <marti.maria@tktbrainpower.com>
-Date: Mon, 15 Aug 2016 23:31:39 +0200
-Subject: [PATCH] Added an extra check to MLU bounds
-
-Thanks to Ibrahim el-sayed for spotting the bug
----
- src/cmstypes.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/cmstypes.c b/src/cmstypes.c
-index cb61860..c7328b9 100644
---- a/src/cmstypes.c
-+++ b/src/cmstypes.c
-@@ -1460,6 +1460,7 @@ void *Type_MLU_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsU
-
- // Check for overflow
- if (Offset < (SizeOfHeader + 8)) goto Error;
-+ if ((Offset + Len) > SizeOfTag + 8) goto Error;
-
- // True begin of the string
- BeginOfThisString = Offset - SizeOfHeader - 8;
---
-2.11.0
-
diff --git a/gnu/packages/patches/libgpg-error-aarch64-logging-fix.patch b/gnu/packages/patches/libgpg-error-aarch64-logging-fix.patch
new file mode 100644
index 0000000000..d848d639b2
--- /dev/null
+++ b/gnu/packages/patches/libgpg-error-aarch64-logging-fix.patch
@@ -0,0 +1,58 @@
+https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgpg-error.git;a=patch;h=791177de023574223eddf7288eb7c5a0721ac623
+
+From 791177de023574223eddf7288eb7c5a0721ac623 Mon Sep 17 00:00:00 2001
+From: Werner Koch <wk@gnupg.org>
+Date: Sun, 18 Mar 2018 17:39:43 +0100
+Subject: [PATCH] core: Fix regression on arm64 due to invalid use of va_list.
+
+* src/logging.c (_gpgrt_log_printhex): Provide a dummy arg instead of
+NULL.
+--
+
+Fix
+Suggested-by: Jakub Wilk <jwilk@jwilk.net>
+
+Signed-off-by: Werner Koch <wk@gnupg.org>
+---
+ src/logging.c | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/src/logging.c b/src/logging.c
+index 1a4f620..d01f974 100644
+--- a/src/logging.c
++++ b/src/logging.c
+@@ -1090,9 +1090,10 @@ _gpgrt_log_flush (void)
+
+
+ /* Print a hexdump of (BUFFER,LENGTH). With FMT passed as NULL print
+- * just the raw dump, with FMT being an empty string, print a trailing
+- * linefeed, otherwise print an entire debug line with the expanded
+- * FMT followed by a possible wrapped hexdump and a final LF. */
++ * just the raw dump (in this case ARG_PTR is not used), with FMT
++ * being an empty string, print a trailing linefeed, otherwise print
++ * an entire debug line with the expanded FMT followed by a possible
++ * wrapped hexdump and a final LF. */
+ void
+ _gpgrt_logv_printhex (const void *buffer, size_t length,
+ const char *fmt, va_list arg_ptr)
+@@ -1150,7 +1151,16 @@ _gpgrt_log_printhex (const void *buffer, size_t length,
+ va_end (arg_ptr);
+ }
+ else
+- _gpgrt_logv_printhex (buffer, length, NULL, NULL);
++ {
++ /* va_list is not necessary a pointer and thus we can't use NULL
++ * because that would conflict with platforms using a straight
++ * struct for it (e.g. arm64). We use a dummy variable instead;
++ * the static is a simple way zero it out so to not get
++ * complains about uninitialized use. */
++ static va_list dummy_argptr;
++
++ _gpgrt_logv_printhex (buffer, length, NULL, dummy_argptr);
++ }
+ }
+
+
+--
+2.8.0.rc3
+
diff --git a/gnu/packages/patches/libtasn1-CVE-2017-10790.patch b/gnu/packages/patches/libtasn1-CVE-2017-10790.patch
deleted file mode 100644
index 6cec0c8030..0000000000
--- a/gnu/packages/patches/libtasn1-CVE-2017-10790.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-Fix CVE-2017-10790:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-10790
-
-Patch copied from upstream source repository:
-
-https://git.savannah.nongnu.org/cgit/libtasn1.git/commit/?id=d8d805e1f2e6799bb2dff4871a8598dc83088a39
-
-From d8d805e1f2e6799bb2dff4871a8598dc83088a39 Mon Sep 17 00:00:00 2001
-From: Nikos Mavrogiannopoulos <nmav@redhat.com>
-Date: Thu, 22 Jun 2017 16:31:37 +0200
-Subject: [PATCH] _asn1_check_identifier: safer access to values read
-
-Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
----
- lib/parser_aux.c | 17 ++++++++++++-----
- 1 file changed, 12 insertions(+), 5 deletions(-)
-
-diff --git a/lib/parser_aux.c b/lib/parser_aux.c
-index 976ab38..786ea64 100644
---- a/lib/parser_aux.c
-+++ b/lib/parser_aux.c
-@@ -955,7 +955,7 @@ _asn1_check_identifier (asn1_node node)
- if (p2 == NULL)
- {
- if (p->value)
-- _asn1_strcpy (_asn1_identifierMissing, p->value);
-+ _asn1_str_cpy (_asn1_identifierMissing, sizeof(_asn1_identifierMissing), (char*)p->value);
- else
- _asn1_strcpy (_asn1_identifierMissing, "(null)");
- return ASN1_IDENTIFIER_NOT_FOUND;
-@@ -968,9 +968,15 @@ _asn1_check_identifier (asn1_node node)
- if (p2 && (type_field (p2->type) == ASN1_ETYPE_DEFAULT))
- {
- _asn1_str_cpy (name2, sizeof (name2), node->name);
-- _asn1_str_cat (name2, sizeof (name2), ".");
-- _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
-- _asn1_strcpy (_asn1_identifierMissing, p2->value);
-+ if (p2->value)
-+ {
-+ _asn1_str_cat (name2, sizeof (name2), ".");
-+ _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
-+ _asn1_str_cpy (_asn1_identifierMissing, sizeof(_asn1_identifierMissing), (char*)p2->value);
-+ }
-+ else
-+ _asn1_strcpy (_asn1_identifierMissing, "(null)");
-+
- p2 = asn1_find_node (node, name2);
- if (!p2 || (type_field (p2->type) != ASN1_ETYPE_OBJECT_ID) ||
- !(p2->type & CONST_ASSIGN))
-@@ -990,7 +996,8 @@ _asn1_check_identifier (asn1_node node)
- _asn1_str_cpy (name2, sizeof (name2), node->name);
- _asn1_str_cat (name2, sizeof (name2), ".");
- _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
-- _asn1_strcpy (_asn1_identifierMissing, p2->value);
-+ _asn1_str_cpy (_asn1_identifierMissing, sizeof(_asn1_identifierMissing), (char*)p2->value);
-+
- p2 = asn1_find_node (node, name2);
- if (!p2 || (type_field (p2->type) != ASN1_ETYPE_OBJECT_ID)
- || !(p2->type & CONST_ASSIGN))
---
-2.13.3
-
diff --git a/gnu/packages/patches/libtasn1-CVE-2018-6003.patch b/gnu/packages/patches/libtasn1-CVE-2018-6003.patch
deleted file mode 100644
index 3e6140518d..0000000000
--- a/gnu/packages/patches/libtasn1-CVE-2018-6003.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-Fix CVE-2018-6003:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-6003
-https://lists.gnu.org/archive/html/help-libtasn1/2018-01/msg00000.html
-
-Patch copied from upstream source repository:
-
-https://gitlab.com/gnutls/libtasn1/commit/c593ae84cfcde8fea45787e53950e0ac71e9ca97
-
-From c593ae84cfcde8fea45787e53950e0ac71e9ca97 Mon Sep 17 00:00:00 2001
-From: Nikos Mavrogiannopoulos <nmav@redhat.com>
-Date: Thu, 4 Jan 2018 10:52:05 +0100
-Subject: [PATCH] _asn1_decode_simple_ber: restrict the levels of recursion to 3
-
-On indefinite string decoding, setting a maximum level of recursions
-protects the BER decoder from a stack exhaustion due to large amounts
-of recursion.
-
-Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
----
- lib/decoding.c | 21 +++++++++++++++++++--
- 1 file changed, 19 insertions(+), 2 deletions(-)
-
-diff --git a/lib/decoding.c b/lib/decoding.c
-index 2240b09..0ee35d3 100644
---- a/lib/decoding.c
-+++ b/lib/decoding.c
-@@ -45,6 +45,13 @@
-
- #define DECODE_FLAG_HAVE_TAG 1
- #define DECODE_FLAG_INDEFINITE (1<<1)
-+/* On indefinite string decoding, allow this maximum levels
-+ * of recursion. Allowing infinite recursion, makes the BER
-+ * decoder susceptible to stack exhaustion due to that recursion.
-+ */
-+#define DECODE_FLAG_LEVEL1 (1<<2)
-+#define DECODE_FLAG_LEVEL2 (1<<3)
-+#define DECODE_FLAG_LEVEL3 (1<<4)
-
- #define DECR_LEN(l, s) do { \
- l -= s; \
-@@ -2216,7 +2223,8 @@ _asn1_decode_simple_ber (unsigned int etype, const unsigned char *der,
- }
-
- /* indefinite constructed */
-- if (((dflags & DECODE_FLAG_INDEFINITE) || class == ASN1_CLASS_STRUCTURED) && ETYPE_IS_STRING(etype))
-+ if ((((dflags & DECODE_FLAG_INDEFINITE) || class == ASN1_CLASS_STRUCTURED) && ETYPE_IS_STRING(etype)) &&
-+ !(dflags & DECODE_FLAG_LEVEL3))
- {
- len_len = 1;
-
-@@ -2236,8 +2244,17 @@ _asn1_decode_simple_ber (unsigned int etype, const unsigned char *der,
- do
- {
- unsigned tmp_len;
-+ unsigned flags = DECODE_FLAG_HAVE_TAG;
-+
-+ if (dflags & DECODE_FLAG_LEVEL1)
-+ flags |= DECODE_FLAG_LEVEL2;
-+ else if (dflags & DECODE_FLAG_LEVEL2)
-+ flags |= DECODE_FLAG_LEVEL3;
-+ else
-+ flags |= DECODE_FLAG_LEVEL1;
-
-- result = asn1_decode_simple_ber(etype, p, der_len, &out, &out_len, &tmp_len);
-+ result = _asn1_decode_simple_ber(etype, p, der_len, &out, &out_len, &tmp_len,
-+ flags);
- if (result != ASN1_SUCCESS)
- {
- warn();
---
-libgit2 0.26.0
-
diff --git a/gnu/packages/patches/libvorbis-CVE-2017-14632.patch b/gnu/packages/patches/libvorbis-CVE-2017-14632.patch
deleted file mode 100644
index 99debf2104..0000000000
--- a/gnu/packages/patches/libvorbis-CVE-2017-14632.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-Fix CVE-2017-14632:
-
-https://gitlab.xiph.org/xiph/vorbis/issues/2328
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14632
-
-Patch copied from upstream source repository:
-
-https://gitlab.xiph.org/xiph/vorbis/commit/c1c2831fc7306d5fbd7bc800324efd12b28d327f
-
-From c1c2831fc7306d5fbd7bc800324efd12b28d327f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
-Date: Wed, 15 Nov 2017 18:22:59 +0100
-Subject: [PATCH] CVE-2017-14632: vorbis_analysis_header_out: Don't clear opb
- if not initialized
-
-If the number of channels is not within the allowed range
-we call oggback_writeclear altough it's not initialized yet.
-
-This fixes
-
- =23371== Invalid free() / delete / delete[] / realloc()
- ==23371== at 0x4C2CE1B: free (vg_replace_malloc.c:530)
- ==23371== by 0x829CA31: oggpack_writeclear (in /usr/lib/x86_64-linux-gnu/libogg.so.0.8.2)
- ==23371== by 0x84B96EE: vorbis_analysis_headerout (info.c:652)
- ==23371== by 0x9FBCBCC: ??? (in /usr/lib/x86_64-linux-gnu/sox/libsox_fmt_vorbis.so)
- ==23371== by 0x4E524F1: ??? (in /usr/lib/x86_64-linux-gnu/libsox.so.2.0.1)
- ==23371== by 0x4E52CCA: sox_open_write (in /usr/lib/x86_64-linux-gnu/libsox.so.2.0.1)
- ==23371== by 0x10D82A: open_output_file (sox.c:1556)
- ==23371== by 0x10D82A: process (sox.c:1753)
- ==23371== by 0x10D82A: main (sox.c:3012)
- ==23371== Address 0x68768c8 is 488 bytes inside a block of size 880 alloc'd
- ==23371== at 0x4C2BB1F: malloc (vg_replace_malloc.c:298)
- ==23371== by 0x4C2DE9F: realloc (vg_replace_malloc.c:785)
- ==23371== by 0x4E545C2: lsx_realloc (in /usr/lib/x86_64-linux-gnu/libsox.so.2.0.1)
- ==23371== by 0x9FBC9A0: ??? (in /usr/lib/x86_64-linux-gnu/sox/libsox_fmt_vorbis.so)
- ==23371== by 0x4E524F1: ??? (in /usr/lib/x86_64-linux-gnu/libsox.so.2.0.1)
- ==23371== by 0x4E52CCA: sox_open_write (in /usr/lib/x86_64-linux-gnu/libsox.so.2.0.1)
- ==23371== by 0x10D82A: open_output_file (sox.c:1556)
- ==23371== by 0x10D82A: process (sox.c:1753)
- ==23371== by 0x10D82A: main (sox.c:3012)
-
-as seen when using the testcase from CVE-2017-11333 with
-008d23b782be09c8d75ba8190b1794abd66c7121 applied. However the error was
-there before.
----
- lib/info.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/lib/info.c b/lib/info.c
-index 7bc4ea4..8d0b2ed 100644
---- a/lib/info.c
-+++ b/lib/info.c
-@@ -589,6 +589,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
- private_state *b=v->backend_state;
-
- if(!b||vi->channels<=0||vi->channels>256){
-+ b = NULL;
- ret=OV_EFAULT;
- goto err_out;
- }
---
-2.15.1
-
diff --git a/gnu/packages/patches/libvorbis-CVE-2017-14633.patch b/gnu/packages/patches/libvorbis-CVE-2017-14633.patch
deleted file mode 100644
index ec6bf5265c..0000000000
--- a/gnu/packages/patches/libvorbis-CVE-2017-14633.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-Fix CVE-2017-14633:
-
-https://gitlab.xiph.org/xiph/vorbis/issues/2329
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14633
-
-Patch copied from upstream source repository:
-
-https://gitlab.xiph.org/xiph/vorbis/commit/a79ec216cd119069c68b8f3542c6a425a74ab993
-
-From a79ec216cd119069c68b8f3542c6a425a74ab993 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
-Date: Tue, 31 Oct 2017 18:32:46 +0100
-Subject: [PATCH] CVE-2017-14633: Don't allow for more than 256 channels
-
-Otherwise
-
- for(i=0;i<vi->channels;i++){
- /* the encoder setup assumes that all the modes used by any
- specific bitrate tweaking use the same floor */
- int submap=info->chmuxlist[i];
-
-overreads later in mapping0_forward since chmuxlist is a fixed array of
-256 elements max.
----
- lib/info.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/info.c b/lib/info.c
-index fe759ed..7bc4ea4 100644
---- a/lib/info.c
-+++ b/lib/info.c
-@@ -588,7 +588,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
- oggpack_buffer opb;
- private_state *b=v->backend_state;
-
-- if(!b||vi->channels<=0){
-+ if(!b||vi->channels<=0||vi->channels>256){
- ret=OV_EFAULT;
- goto err_out;
- }
---
-2.15.1
-
diff --git a/gnu/packages/patches/libxcb-python-3.5-compat.patch b/gnu/packages/patches/libxcb-python-3.5-compat.patch
deleted file mode 100644
index f652498aad..0000000000
--- a/gnu/packages/patches/libxcb-python-3.5-compat.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-Fix compatibility issue with Python 3.5.
-
-Patch copied from upstream source repository:
-
-https://cgit.freedesktop.org/xcb/libxcb/commit/?id=8740a288ca468433141341347aa115b9544891d3
-
-From 8740a288ca468433141341347aa115b9544891d3 Mon Sep 17 00:00:00 2001
-From: Thomas Klausner <wiz@NetBSD.org>
-Date: Thu, 19 May 2016 17:31:18 +0200
-Subject: [PATCH] Fix inconsistent use of tabs vs. space.
-
-Needed for at least python-3.5.x.
-
-Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
-Signed-off-by: Uli Schlachter <psychon@znc.in>
----
- src/c_client.py | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/src/c_client.py b/src/c_client.py
-index 57de3fb..043338d 100644
---- a/src/c_client.py
-+++ b/src/c_client.py
-@@ -1364,7 +1364,7 @@ def _c_serialize(context, self):
- _c(' unsigned int xcb_align_to = 0;')
- if self.is_switch:
- _c(' unsigned int xcb_padding_offset = %d;',
-- self.get_align_offset() )
-+ self.get_align_offset() )
- prefix = [('_aux', '->', self)]
- aux_ptr = 'xcb_out'
-
-@@ -1390,7 +1390,7 @@ def _c_serialize(context, self):
- _c(' unsigned int xcb_align_to = 0;')
- if self.is_switch:
- _c(' unsigned int xcb_padding_offset = %d;',
-- self.get_align_offset() )
-+ self.get_align_offset() )
-
- elif 'sizeof' == context:
- param_names = [p[2] for p in params]
-@@ -1930,14 +1930,14 @@ def _c_accessors_list(self, field):
- # from the request size and divide that by the member size
- return '(((R->length * 4) - sizeof('+ self.c_type + '))/'+'sizeof('+field.type.member.c_wiretype+'))'
- else:
-- # use the accessor to get the start of the list, then
-- # compute the length of it by subtracting it from
-+ # use the accessor to get the start of the list, then
-+ # compute the length of it by subtracting it from
- # the adress of the first byte after the end of the
- # request
-- after_end_of_request = '(((char*)R) + R->length * 4)'
-- start_of_list = '%s(R)' % (field.c_accessor_name)
-+ after_end_of_request = '(((char*)R) + R->length * 4)'
-+ start_of_list = '%s(R)' % (field.c_accessor_name)
- bytesize_of_list = '%s - (char*)(%s)' % (after_end_of_request, start_of_list)
-- return '(%s) / sizeof(%s)' % (bytesize_of_list, field.type.member.c_wiretype)
-+ return '(%s) / sizeof(%s)' % (bytesize_of_list, field.type.member.c_wiretype)
- else:
- raise Exception(
- "lengthless lists with varsized members are not supported. Fieldname '%s'"
---
-2.11.1
-
diff --git a/gnu/packages/patches/make-glibc-compat.patch b/gnu/packages/patches/make-glibc-compat.patch
new file mode 100644
index 0000000000..9ce7f2b5bf
--- /dev/null
+++ b/gnu/packages/patches/make-glibc-compat.patch
@@ -0,0 +1,52 @@
+Work with the new glob interface in glibc 2.27.
+
+Taken from this upstream commit:
+https://git.savannah.gnu.org/cgit/make.git/commit/?id=193f1e81edd6b1b56b0eb0ff8aa4b41c7b4257b4
+
+diff --git a/dir.c b/dir.c
+index adbb8a9..c343e4c 100644
+--- a/dir.c
++++ b/dir.c
+@@ -1299,15 +1299,40 @@ local_stat (const char *path, struct stat *buf)
+ }
+ #endif
+
++/* Similarly for lstat. */
++#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
++# ifndef VMS
++# ifndef HAVE_SYS_STAT_H
++int lstat (const char *path, struct stat *sbuf);
++# endif
++# else
++ /* We are done with the fake lstat. Go back to the real lstat */
++# ifdef lstat
++# undef lstat
++# endif
++# endif
++# define local_lstat lstat
++#elif defined(WINDOWS32)
++/* Windows doesn't support lstat(). */
++# define local_lstat local_stat
++#else
++static int
++local_lstat (const char *path, struct stat *buf)
++{
++ int e;
++ EINTRLOOP (e, lstat (path, buf));
++ return e;
++}
++#endif
++
+ void
+ dir_setup_glob (glob_t *gl)
+ {
+ gl->gl_opendir = open_dirstream;
+ gl->gl_readdir = read_dirstream;
+ gl->gl_closedir = free;
++ gl->gl_lstat = local_lstat;
+ gl->gl_stat = local_stat;
+- /* We don't bother setting gl_lstat, since glob never calls it.
+- The slot is only there for compatibility with 4.4 BSD. */
+ }
+
+ void
diff --git a/gnu/packages/patches/patch-hurd-path-max.patch b/gnu/packages/patches/patch-hurd-path-max.patch
index 81e37930c2..1845a5803b 100644
--- a/gnu/packages/patches/patch-hurd-path-max.patch
+++ b/gnu/packages/patches/patch-hurd-path-max.patch
@@ -13,7 +13,7 @@ Subject: [PATCH] Do not rely on PATH_MAX when reading a symlink target.
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/util.c b/src/util.c
-index 82a7e37..c4c0f9d 100644
+index 1cc08ba..67dbd3a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -460,12 +460,12 @@ move_file (char const *from, bool *from_needs_removal,
@@ -31,18 +31,19 @@ index 82a7e37..c4c0f9d 100644
size += i;
if (i != 0 || close (fd) != 0)
read_fatal ();
-@@ -610,9 +610,9 @@ copy_file (char const *from, char const *to, struct stat *tost,
+@@ -610,10 +610,10 @@ copy_file (char const *from, char const *to, struct stat *tost,
if (S_ISLNK (mode))
{
-- char *buffer = xmalloc (PATH_MAX);
+- char *buffer = xmalloc (PATH_MAX + 1);
+ char *buffer = xmalloc (tost->st_size + 1);
+ ssize_t r;
-- if (safe_readlink (from, buffer, PATH_MAX) < 0)
-+ if (safe_readlink (from, buffer, tost->st_size) < 0)
+- if ((r = safe_readlink (from, buffer, PATH_MAX)) < 0)
++ if ((r = safe_readlink (from, buffer, tost->st_size)) < 0)
pfatal ("Can't read %s %s", "symbolic link", from);
+ buffer[r] = '\0';
if (safe_symlink (buffer, to) != 0)
- pfatal ("Can't create %s %s", "symbolic link", to);
--
-2.4.2
+2.16.2
diff --git a/gnu/packages/patches/pcre2-CVE-2017-7186.patch b/gnu/packages/patches/pcre2-CVE-2017-7186.patch
deleted file mode 100644
index 5c16955aaa..0000000000
--- a/gnu/packages/patches/pcre2-CVE-2017-7186.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-Patch for <https://nvd.nist.gov/vuln/detail?vulnId=CVE-2017-7186>
-taken from <https://vcs.pcre.org/pcre2?view=revision&revision=670>.
-
---- trunk/src/pcre2_internal.h 2016/11/19 12:46:24 600
-+++ trunk/src/pcre2_internal.h 2017/02/24 18:25:32 670
-@@ -1774,10 +1774,17 @@
- /* UCD access macros */
-
- #define UCD_BLOCK_SIZE 128
--#define GET_UCD(ch) (PRIV(ucd_records) + \
-+#define REAL_GET_UCD(ch) (PRIV(ucd_records) + \
- PRIV(ucd_stage2)[PRIV(ucd_stage1)[(int)(ch) / UCD_BLOCK_SIZE] * \
- UCD_BLOCK_SIZE + (int)(ch) % UCD_BLOCK_SIZE])
-
-+#if PCRE2_CODE_UNIT_WIDTH == 32
-+#define GET_UCD(ch) ((ch > MAX_UTF_CODE_POINT)? \
-+ PRIV(dummy_ucd_record) : REAL_GET_UCD(ch))
-+#else
-+#define GET_UCD(ch) REAL_GET_UCD(ch)
-+#endif
-+
- #define UCD_CHARTYPE(ch) GET_UCD(ch)->chartype
- #define UCD_SCRIPT(ch) GET_UCD(ch)->script
- #define UCD_CATEGORY(ch) PRIV(ucp_gentype)[UCD_CHARTYPE(ch)]
-@@ -1834,6 +1841,9 @@
- #define _pcre2_default_compile_context PCRE2_SUFFIX(_pcre2_default_compile_context_)
- #define _pcre2_default_match_context PCRE2_SUFFIX(_pcre2_default_match_context_)
- #define _pcre2_default_tables PCRE2_SUFFIX(_pcre2_default_tables_)
-+#if PCRE2_CODE_UNIT_WIDTH == 32
-+#define _pcre2_dummy_ucd_record PCRE2_SUFFIX(_pcre2_dummy_ucd_record_)
-+#endif
- #define _pcre2_hspace_list PCRE2_SUFFIX(_pcre2_hspace_list_)
- #define _pcre2_vspace_list PCRE2_SUFFIX(_pcre2_vspace_list_)
- #define _pcre2_ucd_caseless_sets PCRE2_SUFFIX(_pcre2_ucd_caseless_sets_)
-@@ -1858,6 +1868,9 @@
- extern const uint32_t PRIV(vspace_list)[];
- extern const uint32_t PRIV(ucd_caseless_sets)[];
- extern const ucd_record PRIV(ucd_records)[];
-+#if PCRE2_CODE_UNIT_WIDTH == 32
-+extern const ucd_record PRIV(dummy_ucd_record)[];
-+#endif
- extern const uint8_t PRIV(ucd_stage1)[];
- extern const uint16_t PRIV(ucd_stage2)[];
- extern const uint32_t PRIV(ucp_gbtable)[];
-
---- trunk/src/pcre2_ucd.c 2015/07/17 15:44:51 316
-+++ trunk/src/pcre2_ucd.c 2017/02/24 18:25:32 670
-@@ -41,6 +41,20 @@
-
- const char *PRIV(unicode_version) = "8.0.0";
-
-+/* If the 32-bit library is run in non-32-bit mode, character values
-+greater than 0x10ffff may be encountered. For these we set up a
-+special record. */
-+
-+#if PCRE2_CODE_UNIT_WIDTH == 32
-+const ucd_record PRIV(dummy_ucd_record)[] = {{
-+ ucp_Common, /* script */
-+ ucp_Cn, /* type unassigned */
-+ ucp_gbOther, /* grapheme break property */
-+ 0, /* case set */
-+ 0, /* other case */
-+ }};
-+#endif
-+
- /* When recompiling tables with a new Unicode version, please check the
- types in this structure definition from pcre2_internal.h (the actual
- field names will be different):
diff --git a/gnu/packages/patches/pcre2-CVE-2017-8786.patch b/gnu/packages/patches/pcre2-CVE-2017-8786.patch
deleted file mode 100644
index 6071d58f07..0000000000
--- a/gnu/packages/patches/pcre2-CVE-2017-8786.patch
+++ /dev/null
@@ -1,155 +0,0 @@
-Fix CVE-2017-8786:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8786
-https://bugs.exim.org/show_bug.cgi?id=2079
-https://blogs.gentoo.org/ago/2017/04/29/libpcre-heap-based-buffer-overflow-write-in-pcre2test-c/
-
-Patch copied from upstream source repository:
-
-https://vcs.pcre.org/pcre2?view=revision&revision=696
-https://vcs.pcre.org/pcre2?view=revision&revision=697
-
---- trunk/doc/pcre2api.3 2017/03/21 16:48:40 695
-+++ trunk/doc/pcre2api.3 2017/03/21 17:46:21 696
-@@ -1,4 +1,4 @@
--.TH PCRE2API 3 "24 December 2016" "PCRE2 10.23"
-+.TH PCRE2API 3 "21 March 2017" "PCRE2 10.30"
- .SH NAME
- PCRE2 - Perl-compatible regular expressions (revised API)
- .sp
-@@ -2633,8 +2633,8 @@
- A text message for an error code from any PCRE2 function (compile, match, or
- auxiliary) can be obtained by calling \fBpcre2_get_error_message()\fP. The code
- is passed as the first argument, with the remaining two arguments specifying a
--code unit buffer and its length, into which the text message is placed. Note
--that the message is returned in code units of the appropriate width for the
-+code unit buffer and its length in code units, into which the text message is
-+placed. The message is returned in code units of the appropriate width for the
- library that is being used.
- .P
- The returned message is terminated with a trailing zero, and the function
-@@ -3321,6 +3321,6 @@
- .rs
- .sp
- .nf
--Last updated: 23 December 2016
--Copyright (c) 1997-2016 University of Cambridge.
-+Last updated: 21 March 2017
-+Copyright (c) 1997-2017 University of Cambridge.
- .fi
---- trunk/src/pcre2_error.c 2017/03/21 16:48:40 695
-+++ trunk/src/pcre2_error.c 2017/03/21 17:46:21 696
-@@ -271,7 +271,7 @@
- Arguments:
- enumber error number
- buffer where to put the message (zero terminated)
-- size size of the buffer
-+ size size of the buffer in code units
-
- Returns: length of message if all is well
- negative on error
---- trunk/src/pcre2test.c 2017/03/21 17:46:21 696
-+++ trunk/src/pcre2test.c 2017/03/21 18:36:13 697
-@@ -1017,9 +1017,9 @@
- if (test_mode == PCRE8_MODE) \
- r = pcre2_get_error_message_8(a,G(b,8),G(G(b,8),_size)); \
- else if (test_mode == PCRE16_MODE) \
-- r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size)); \
-+ r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size/2)); \
- else \
-- r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))
-+ r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size/4))
-
- #define PCRE2_GET_OVECTOR_COUNT(a,b) \
- if (test_mode == PCRE8_MODE) \
-@@ -1399,6 +1399,9 @@
-
- /* ----- Common macros for two-mode cases ----- */
-
-+#define BYTEONE (BITONE/8)
-+#define BYTETWO (BITTWO/8)
-+
- #define CASTFLD(t,a,b) \
- ((test_mode == G(G(PCRE,BITONE),_MODE))? (t)(G(a,BITONE)->b) : \
- (t)(G(a,BITTWO)->b))
-@@ -1481,9 +1484,9 @@
-
- #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
- if (test_mode == G(G(PCRE,BITONE),_MODE)) \
-- r = G(pcre2_get_error_message_,BITONE)(a,G(b,BITONE),G(G(b,BITONE),_size)); \
-+ r = G(pcre2_get_error_message_,BITONE)(a,G(b,BITONE),G(G(b,BITONE),_size/BYTEONE)); \
- else \
-- r = G(pcre2_get_error_message_,BITTWO)(a,G(b,BITTWO),G(G(b,BITTWO),_size))
-+ r = G(pcre2_get_error_message_,BITTWO)(a,G(b,BITTWO),G(G(b,BITTWO),_size/BYTETWO))
-
- #define PCRE2_GET_OVECTOR_COUNT(a,b) \
- if (test_mode == G(G(PCRE,BITONE),_MODE)) \
-@@ -1904,7 +1907,7 @@
- #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \
- a = pcre2_dfa_match_16(G(b,16),(PCRE2_SPTR16)c,d,e,f,G(g,16),h,i,j)
- #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
-- r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size))
-+ r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size/2))
- #define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_16(G(b,16))
- #define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_16(G(b,16))
- #define PCRE2_JIT_COMPILE(r,a,b) r = pcre2_jit_compile_16(G(a,16),b)
-@@ -2000,7 +2003,7 @@
- #define PCRE2_DFA_MATCH(a,b,c,d,e,f,g,h,i,j) \
- a = pcre2_dfa_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),h,i,j)
- #define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
-- r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))
-+ r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size/4))
- #define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_32(G(b,32))
- #define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_32(G(b,32))
- #define PCRE2_JIT_COMPILE(r,a,b) r = pcre2_jit_compile_32(G(a,32),b)
---- trunk/src/pcre2test.c 2017/03/21 16:48:40 695
-+++ trunk/src/pcre2test.c 2017/03/21 17:46:21 696
-@@ -2889,7 +2889,7 @@
- {
- if (pbuffer32 != NULL) free(pbuffer32);
- pbuffer32_size = 4*len + 4;
-- if (pbuffer32_size < 256) pbuffer32_size = 256;
-+ if (pbuffer32_size < 512) pbuffer32_size = 512;
- pbuffer32 = (uint32_t *)malloc(pbuffer32_size);
- if (pbuffer32 == NULL)
- {
-@@ -7600,7 +7600,8 @@
- int errcode;
- char *endptr;
-
--/* Ensure the relevant non-8-bit buffer is available. */
-+/* Ensure the relevant non-8-bit buffer is available. Ensure that it is at
-+least 128 code units, because it is used for retrieving error messages. */
-
- #ifdef SUPPORT_PCRE2_16
- if (test_mode == PCRE16_MODE)
-@@ -7620,7 +7621,7 @@
- #ifdef SUPPORT_PCRE2_32
- if (test_mode == PCRE32_MODE)
- {
-- pbuffer32_size = 256;
-+ pbuffer32_size = 512;
- pbuffer32 = (uint32_t *)malloc(pbuffer32_size);
- if (pbuffer32 == NULL)
- {
---- trunk/testdata/testinput2 2017/03/21 16:48:40 695
-+++ trunk/testdata/testinput2 2017/03/21 17:46:21 696
-@@ -5017,4 +5017,6 @@
-
- /(?<!\1((?U)1((?U))))(*F)/never_backslash_c,alt_bsux,anchored,extended
-
-+/\g{3/
-+
- # End of testinput2
---- trunk/testdata/testoutput2 2017/03/21 16:48:40 695
-+++ trunk/testdata/testoutput2 2017/03/21 17:46:21 696
-@@ -15570,6 +15570,9 @@
-
- /(?<!\1((?U)1((?U))))(*F)/never_backslash_c,alt_bsux,anchored,extended
-
-+/\g{3/
-+Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
-+
- # End of testinput2
- Error -63: PCRE2_ERROR_BADDATA (unknown error number)
- Error -62: bad serialized data
diff --git a/gnu/packages/patches/pulseaudio-glibc-2.27.patch b/gnu/packages/patches/pulseaudio-glibc-2.27.patch
new file mode 100644
index 0000000000..79d86abeee
--- /dev/null
+++ b/gnu/packages/patches/pulseaudio-glibc-2.27.patch
@@ -0,0 +1,67 @@
+Copied from:
+https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=dfb0460fb4743aec047cdf755a660a9ac2d0f3fb
+
+
+From dfb0460fb4743aec047cdf755a660a9ac2d0f3fb Mon Sep 17 00:00:00 2001
+From: Tanu Kaskinen <tanuk@iki.fi>
+Date: Wed, 24 Jan 2018 03:51:49 +0200
+Subject: [PATCH] memfd-wrappers: only define memfd_create() if not already
+ defined
+
+glibc 2.27 is to be released soon, and it will provide memfd_create().
+If glibc provides the function, we must not define it ourselves,
+otherwise building fails due to conflict between the two implementations
+of the same function.
+
+BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=104733
+---
+ configure.ac | 3 +++
+ src/pulsecore/memfd-wrappers.h | 7 ++++---
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 0084c86e..0eb44b08 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -610,6 +610,9 @@ AS_IF([test "x$enable_memfd" = "xyes" && test "x$HAVE_MEMFD" = "x0"],
+ [AC_MSG_ERROR([*** Your Linux kernel does not support memfd shared memory.
+ *** Use linux v3.17 or higher for such a feature.])])
+
++AS_IF([test "x$HAVE_MEMFD" = "x1"],
++ AC_CHECK_FUNCS([memfd_create]))
++
+ AC_SUBST(HAVE_MEMFD)
+ AM_CONDITIONAL([HAVE_MEMFD], [test "x$HAVE_MEMFD" = x1])
+ AS_IF([test "x$HAVE_MEMFD" = "x1"], AC_DEFINE([HAVE_MEMFD], 1, [Have memfd shared memory.]))
+diff --git a/src/pulsecore/memfd-wrappers.h b/src/pulsecore/memfd-wrappers.h
+index 3bed9b2b..c7aadfd3 100644
+--- a/src/pulsecore/memfd-wrappers.h
++++ b/src/pulsecore/memfd-wrappers.h
+@@ -20,13 +20,14 @@
+ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+ ***/
+
+-#ifdef HAVE_MEMFD
++#if defined(HAVE_MEMFD) && !defined(HAVE_MEMFD_CREATE)
+
+ #include <sys/syscall.h>
+ #include <fcntl.h>
+
+ /*
+- * No glibc wrappers exist for memfd_create(2), so provide our own.
++ * Before glibc version 2.27 there was no wrapper for memfd_create(2),
++ * so we have to provide our own.
+ *
+ * Also define memfd fcntl sealing macros. While they are already
+ * defined in the kernel header file <linux/fcntl.h>, that file as
+@@ -63,6 +64,6 @@ static inline int memfd_create(const char *name, unsigned int flags) {
+ #define F_SEAL_WRITE 0x0008 /* prevent writes */
+ #endif
+
+-#endif /* HAVE_MEMFD */
++#endif /* HAVE_MEMFD && !HAVE_MEMFD_CREATE */
+
+ #endif
+--
+2.16.2
+
diff --git a/gnu/packages/patches/pycairo-wscript.patch b/gnu/packages/patches/pycairo-wscript.patch
deleted file mode 100644
index c49f0afcb3..0000000000
--- a/gnu/packages/patches/pycairo-wscript.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Update the wscript to work with waf-1.8.8. Based on:
-http://cgit.freedesktop.org/pycairo/commit/?id=c57cd129407c904f8c2f752a59d0183df7b01a5e
-
-
---- pycairo-1.10.0.orig/wscript 2011-04-18 15:42:29.000000000 +0800
-+++ pycairo-1.10.0/wscript 2015-04-20 13:01:45.383756898 +0800
-@@ -13,18 +13,18 @@
-
- def options(ctx):
- print(' %s/options()' %d)
-- ctx.tool_options('gnu_dirs')
-- ctx.tool_options('compiler_cc')
-- ctx.tool_options('python') # options for disabling pyc or pyo compilation
-+ ctx.load('gnu_dirs')
-+ ctx.load('compiler_c')
-+ ctx.load('python') # options for disabling pyc or pyo compilation
-
-
- def configure(ctx):
- print(' %s/configure()' %d)
-
- env = ctx.env
-- ctx.check_tool('gnu_dirs')
-- ctx.check_tool('compiler_cc')
-- ctx.check_tool('python')
-+ ctx.load('gnu_dirs')
-+ ctx.load('compiler_c')
-+ ctx.load('python')
- ctx.check_python_version((3,1,0))
- ctx.check_python_headers()
- ctx.check_cfg(package='cairo', atleast_version=cairo_version_required,
diff --git a/gnu/packages/patches/python-3-search-paths.patch b/gnu/packages/patches/python-3-search-paths.patch
index 7feddb8e30..73e3f4ccf5 100644
--- a/gnu/packages/patches/python-3-search-paths.patch
+++ b/gnu/packages/patches/python-3-search-paths.patch
@@ -3,17 +3,14 @@ looking for headers and libraries.
--- setup.py 2015-10-07 23:32:58.891329173 +0200
+++ setup.py 2015-10-07 23:46:29.653349924 +0200
-@@ -507,11 +507,8 @@ class PyBuildExt(build_ext):
+@@ -575,8 +575,8 @@
# if a file is found in one of those directories, it can
# be assumed that no additional -I,-L directives are needed.
if not cross_compiling:
-- lib_dirs = self.compiler.library_dirs + [
-- '/lib64', '/usr/lib64',
-- '/lib', '/usr/lib',
-- ]
-- inc_dirs = self.compiler.include_dirs + ['/usr/include']
+- lib_dirs = self.compiler.library_dirs + system_lib_dirs
+- inc_dirs = self.compiler.include_dirs + system_include_dirs
+ lib_dirs = os.getenv('LIBRARY_PATH', '').split(os.pathsep)
+ inc_dirs = os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
else:
- lib_dirs = self.compiler.library_dirs[:]
- inc_dirs = self.compiler.include_dirs[:]
+ # Add the sysroot paths. 'sysroot' is a compiler option used to
+ # set the logical path of the standard system headers and
diff --git a/gnu/packages/patches/qemu-glibc-2.27.patch b/gnu/packages/patches/qemu-glibc-2.27.patch
new file mode 100644
index 0000000000..b1f354ac1c
--- /dev/null
+++ b/gnu/packages/patches/qemu-glibc-2.27.patch
@@ -0,0 +1,55 @@
+From 75e5b70e6b5dcc4f2219992d7cffa462aa406af0 Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <pbonzini@redhat.com>
+Date: Tue, 28 Nov 2017 11:51:27 +0100
+Subject: [PATCH] memfd: fix configure test
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+Recent glibc added memfd_create in sys/mman.h. This conflicts with
+the definition in util/memfd.c:
+
+ /builddir/build/BUILD/qemu-2.11.0-rc1/util/memfd.c:40:12: error: static declaration of memfd_create follows non-static declaration
+
+Fix the configure test, and remove the sys/memfd.h inclusion since the
+file actually does not exist---it is a typo in the memfd_create(2) man
+page.
+
+Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+---
+ configure | 2 +-
+ util/memfd.c | 4 +---
+ 2 files changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/configure b/configure
+index 9c8aa5a..99ccc17 100755
+--- a/configure
++++ b/configure
+@@ -3923,7 +3923,7 @@ fi
+ # check if memfd is supported
+ memfd=no
+ cat > $TMPC << EOF
+-#include <sys/memfd.h>
++#include <sys/mman.h>
+
+ int main(void)
+ {
+diff --git a/util/memfd.c b/util/memfd.c
+index 4571d1a..412e94a 100644
+--- a/util/memfd.c
++++ b/util/memfd.c
+@@ -31,9 +31,7 @@
+
+ #include "qemu/memfd.h"
+
+-#ifdef CONFIG_MEMFD
+-#include <sys/memfd.h>
+-#elif defined CONFIG_LINUX
++#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
+ #include <sys/syscall.h>
+ #include <asm/unistd.h>
+
+--
+1.8.3.1
+
diff --git a/gnu/packages/patches/tar-CVE-2016-6321.patch b/gnu/packages/patches/tar-CVE-2016-6321.patch
deleted file mode 100644
index b79be9bc94..0000000000
--- a/gnu/packages/patches/tar-CVE-2016-6321.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-Fix CVE-2016-6321:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6321
-https://security-tracker.debian.org/tracker/CVE-2016-6321
-
-Patch adapted from upstream source repository (the changes to 'NEWS'
-don't apply to the Tar 1.29 release tarball).
-
-http://git.savannah.gnu.org/cgit/tar.git/commit/?id=7340f67b9860ea0531c1450e5aa261c50f67165d
-
-From 7340f67b9860ea0531c1450e5aa261c50f67165d Mon Sep 17 00:00:00 2001
-From: Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
-Date: Sat, 29 Oct 2016 21:04:40 -0700
-Subject: [PATCH] When extracting, skip ".." members
-
-* NEWS: Document this.
-* src/extract.c (extract_archive): Skip members whose names
-contain "..".
----
- NEWS | 8 +++++++-
- src/extract.c | 8 ++++++++
- 2 files changed, 15 insertions(+), 1 deletion(-)
-
-diff --git a/src/extract.c b/src/extract.c
-index f982433..7904148 100644
---- a/src/extract.c
-+++ b/src/extract.c
-@@ -1629,12 +1629,20 @@ extract_archive (void)
- {
- char typeflag;
- tar_extractor_t fun;
-+ bool skip_dotdot_name;
-
- fatal_exit_hook = extract_finish;
-
- set_next_block_after (current_header);
-
-+ skip_dotdot_name = (!absolute_names_option
-+ && contains_dot_dot (current_stat_info.orig_file_name));
-+ if (skip_dotdot_name)
-+ ERROR ((0, 0, _("%s: Member name contains '..'"),
-+ quotearg_colon (current_stat_info.orig_file_name)));
-+
- if (!current_stat_info.file_name[0]
-+ || skip_dotdot_name
- || (interactive_option
- && !confirm ("extract", current_stat_info.file_name)))
- {
---
-2.11.0
-
diff --git a/gnu/packages/patches/tar-remove-wholesparse-check.patch b/gnu/packages/patches/tar-remove-wholesparse-check.patch
new file mode 100644
index 0000000000..41f53e86aa
--- /dev/null
+++ b/gnu/packages/patches/tar-remove-wholesparse-check.patch
@@ -0,0 +1,68 @@
+This patch is needed in order to build Guix on a Btrfs file system.
+
+
+From da922703282b0d3b8837a99a9c7fdd32f1d20d49 Mon Sep 17 00:00:00 2001
+From: Mark H Weaver <mhw@netris.org>
+Date: Tue, 9 Jan 2018 20:16:14 -0500
+Subject: [PATCH] Remove nonportable check for files containing only zeroes.
+
+This check benefitted only one unlikely case (large files containing
+only zeroes, on systems that do not support SEEK_HOLE) and was based
+on an assumption about file system behavior that is not mandated by
+POSIX and no longer holds in practice, namely that for sufficiently
+large files, (st_blocks == 0) implies that the file contains only
+zeroes. Examples of file systems that violate this assumption include
+Linux's /proc file system and Btrfs.
+
+* src/sparse.c (sparse_scan_file_wholesparse): Remove this function.
+(sparse_scan_file_seek): Remove the initial check for files containing
+only zeroes.
+---
+ src/sparse.c | 24 ------------------------
+ 1 file changed, 24 deletions(-)
+
+diff --git a/src/sparse.c b/src/sparse.c
+index d41c0ea..3de6560 100644
+--- a/src/sparse.c
++++ b/src/sparse.c
+@@ -261,26 +261,6 @@ sparse_scan_file_raw (struct tar_sparse_file *file)
+ return tar_sparse_scan (file, scan_end, NULL);
+ }
+
+-static bool
+-sparse_scan_file_wholesparse (struct tar_sparse_file *file)
+-{
+- struct tar_stat_info *st = file->stat_info;
+- struct sp_array sp = {0, 0};
+-
+- /* Note that this function is called only for truly sparse files of size >= 1
+- block size (checked via ST_IS_SPARSE before). See the thread
+- http://www.mail-archive.com/bug-tar@gnu.org/msg04209.html for more info */
+- if (ST_NBLOCKS (st->stat) == 0)
+- {
+- st->archive_file_size = 0;
+- sp.offset = st->stat.st_size;
+- sparse_add_map (st, &sp);
+- return true;
+- }
+-
+- return false;
+-}
+-
+ #ifdef SEEK_HOLE
+ /* Try to engage SEEK_HOLE/SEEK_DATA feature. */
+ static bool
+@@ -343,10 +323,6 @@ sparse_scan_file_seek (struct tar_sparse_file *file)
+ static bool
+ sparse_scan_file (struct tar_sparse_file *file)
+ {
+- /* always check for completely sparse files */
+- if (sparse_scan_file_wholesparse (file))
+- return true;
+-
+ switch (hole_detection)
+ {
+ case HOLE_DETECTION_DEFAULT:
+--
+2.15.1
+
diff --git a/gnu/packages/patches/util-linux-CVE-2018-7738.patch b/gnu/packages/patches/util-linux-CVE-2018-7738.patch
deleted file mode 100644
index 080e2f56ba..0000000000
--- a/gnu/packages/patches/util-linux-CVE-2018-7738.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-Fix CVE-2018-7738:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-7738
-
-Patch copied from upstream source repository:
-
-https://github.com/karelzak/util-linux/commit/75f03badd7ed9f1dd951863d75e756883d3acc55
-
-From 75f03badd7ed9f1dd951863d75e756883d3acc55 Mon Sep 17 00:00:00 2001
-From: Karel Zak <kzak@redhat.com>
-Date: Thu, 16 Nov 2017 16:27:32 +0100
-Subject: [PATCH] bash-completion: (umount) use findmnt, escape a space in
- paths
-
- # mount /dev/sdc1 /mnt/test/foo\ bar
- # umount <tab>
-
-has to return "/mnt/test/foo\ bar".
-
-Changes:
-
- * don't use mount | awk output, we have findmnt
- * force compgen use \n as entries separator
-
-Addresses: https://github.com/karelzak/util-linux/issues/539
-Signed-off-by: Karel Zak <kzak@redhat.com>
----
- bash-completion/umount | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/bash-completion/umount b/bash-completion/umount
-index d76cb9fff..98c90d61a 100644
---- a/bash-completion/umount
-+++ b/bash-completion/umount
-@@ -40,9 +40,10 @@ _umount_module()
- return 0
- ;;
- esac
-- local DEVS_MPOINTS
-- DEVS_MPOINTS="$(mount | awk '{print $1, $3}')"
-- COMPREPLY=( $(compgen -W "$DEVS_MPOINTS" -- $cur) )
-- return 0
-+
-+ local oldifs=$IFS
-+ IFS=$'\n'
-+ COMPREPLY=( $( compgen -W '$(findmnt -lno TARGET | sed "s/\([[:blank:]]\)/\\\\\1/g")' -- "$cur" ) )
-+ IFS=$oldifs
- }
- complete -F _umount_module umount
diff --git a/gnu/packages/patches/util-linux-tests.patch b/gnu/packages/patches/util-linux-tests.patch
index f436299b7f..bb5be66515 100644
--- a/gnu/packages/patches/util-linux-tests.patch
+++ b/gnu/packages/patches/util-linux-tests.patch
@@ -5,14 +5,14 @@ using 'getpwnam' in libmount. This doesn't work in the chroot because
--- util-linux-2.25.2/tests/ts/libmount/optstr 2015-01-23 13:58:41.181151194 +0100
+++ util-linux-2.25.2/tests/ts/libmount/optstr 2015-01-23 13:58:42.829161716 +0100
-@@ -84,10 +84,6 @@ ts_init_subtest "apply-user" # add user,
- ts_valgrind $TESTPROG --apply --user "noexec,nosuid,loop=/dev/looop0" 0x408 &> $TS_OUTPUT
+@@ -108,10 +108,6 @@
+ ts_run $TESTPROG --apply --user "noexec,nosuid,loop=/dev/looop0" 0x408 &> $TS_OUTPUT
ts_finalize_subtest
-ts_init_subtest "fix"
--ts_valgrind $TESTPROG --fix "uid=root,gid=root" &> $TS_OUTPUT
+-ts_run $TESTPROG --fix "uid=root,gid=root" &> $TS_OUTPUT
-ts_finalize_subtest
-
ts_init_subtest "deduplicate"
- ts_valgrind $TESTPROG --dedup bbb,ccc,AAA,xxx,AAA=a,AAA=bbb,ddd,AAA=ccc,fff=eee AAA &> $TS_OUTPUT
+ ts_run $TESTPROG --dedup bbb,ccc,AAA,xxx,AAA=a,AAA=bbb,ddd,AAA=ccc,fff=eee AAA &> $TS_OUTPUT
ts_finalize_subtest
diff --git a/gnu/packages/patches/xcb-proto-python3-print.patch b/gnu/packages/patches/xcb-proto-python3-print.patch
deleted file mode 100644
index 7d5dc9bc27..0000000000
--- a/gnu/packages/patches/xcb-proto-python3-print.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-Patch copied from upstream source repository:
-
-https://cgit.freedesktop.org/xcb/proto/commit/?id=bea5e1c85bdc0950913790364e18228f20395a3d
-
-From bea5e1c85bdc0950913790364e18228f20395a3d Mon Sep 17 00:00:00 2001
-From: Thomas Klausner <wiz@NetBSD.org>
-Date: Thu, 19 May 2016 17:30:05 +0200
-Subject: [PATCH] print() is a function and needs parentheses.
-
-Fixes build with python-3.x.
-
-Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
-Signed-off-by: Uli Schlachter <psychon@znc.in>
----
- xcbgen/xtypes.py | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
-index c3b5758..b83b119 100644
---- a/xcbgen/xtypes.py
-+++ b/xcbgen/xtypes.py
-@@ -501,7 +501,7 @@ class ComplexType(Type):
- int(required_start_align_element.get('align', "4"), 0),
- int(required_start_align_element.get('offset', "0"), 0))
- if verbose_align_log:
-- print "Explicit start-align for %s: %s\n" % (self, self.required_start_align)
-+ print ("Explicit start-align for %s: %s\n" % (self, self.required_start_align))
-
- def resolve(self, module):
- if self.resolved:
-@@ -592,7 +592,7 @@ class ComplexType(Type):
- if verbose_align_log:
- print ("calc_required_start_align: %s has start-align %s"
- % (str(self), str(self.required_start_align)))
-- print "Details:\n" + str(log)
-+ print ("Details:\n" + str(log))
- if self.required_start_align.offset != 0:
- print (("WARNING: %s\n\thas start-align with non-zero offset: %s"
- + "\n\tsuggest to add explicit definition with:"
-@@ -619,12 +619,12 @@ class ComplexType(Type):
- for offset in range(0,align):
- align_candidate = Alignment(align, offset)
- if verbose_align_log:
-- print "trying %s for %s" % (str(align_candidate), str(self))
-+ print ("trying %s for %s" % (str(align_candidate), str(self)))
- my_log = AlignmentLog()
- if self.is_possible_start_align(align_candidate, callstack, my_log):
- log.append(my_log)
- if verbose_align_log:
-- print "found start-align %s for %s" % (str(align_candidate), str(self))
-+ print ("found start-align %s for %s" % (str(align_candidate), str(self)))
- return align_candidate
- else:
- my_ok_count = my_log.ok_count()
-@@ -641,7 +641,7 @@ class ComplexType(Type):
- # none of the candidates applies
- # this type has illegal internal aligns for all possible start_aligns
- if verbose_align_log:
-- print "didn't find start-align for %s" % str(self)
-+ print ("didn't find start-align for %s" % str(self))
- log.append(best_log)
- return None
-
-@@ -900,7 +900,7 @@ class SwitchType(ComplexType):
- # aux function for unchecked_get_alignment_after
- def get_align_for_selected_case_field(self, case_field, start_align, callstack, log):
- if verbose_align_log:
-- print "get_align_for_selected_case_field: %s, case_field = %s" % (str(self), str(case_field))
-+ print ("get_align_for_selected_case_field: %s, case_field = %s" % (str(self), str(case_field)))
- total_align = start_align
- for field in self.bitcases:
- my_callstack = callstack[:]
---
-2.11.1
-
diff --git a/gnu/packages/patches/xcb-proto-python3-whitespace.patch b/gnu/packages/patches/xcb-proto-python3-whitespace.patch
deleted file mode 100644
index f0509138b2..0000000000
--- a/gnu/packages/patches/xcb-proto-python3-whitespace.patch
+++ /dev/null
@@ -1,217 +0,0 @@
-Fixes compatibility issue with python > 3.5.
-
-Patch copied from upstream source repository:
-
-https://cgit.freedesktop.org/xcb/proto/commit/?id=ea7a3ac6c658164690e0febb55f4467cb9e0bcac
-
-From ea7a3ac6c658164690e0febb55f4467cb9e0bcac Mon Sep 17 00:00:00 2001
-From: Thomas Klausner <wiz@NetBSD.org>
-Date: Thu, 19 May 2016 17:30:04 +0200
-Subject: [PATCH] Make whitespace use consistent.
-
-At least python-3.5.x complains about this forcefully.
-
-Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
-Signed-off-by: Uli Schlachter <psychon@znc.in>
----
- xcbgen/align.py | 96 ++++++++++++++++++++++++++++-----------------------------
- 1 file changed, 48 insertions(+), 48 deletions(-)
-
-diff --git a/xcbgen/align.py b/xcbgen/align.py
-index 5e31838..d4c12ee 100644
---- a/xcbgen/align.py
-+++ b/xcbgen/align.py
-@@ -16,12 +16,12 @@ class Alignment(object):
- return self.align == other.align and self.offset == other.offset
-
- def __str__(self):
-- return "(align=%d, offset=%d)" % (self.align, self.offset)
-+ return "(align=%d, offset=%d)" % (self.align, self.offset)
-
- @staticmethod
- def for_primitive_type(size):
-- # compute the required start_alignment based on the size of the type
-- if size % 8 == 0:
-+ # compute the required start_alignment based on the size of the type
-+ if size % 8 == 0:
- # do 8-byte primitives require 8-byte alignment in X11?
- return Alignment(8,0)
- elif size % 4 == 0:
-@@ -33,7 +33,7 @@ class Alignment(object):
-
-
- def align_after_fixed_size(self, size):
-- new_offset = (self.offset + size) % self.align
-+ new_offset = (self.offset + size) % self.align
- return Alignment(self.align, new_offset)
-
-
-@@ -41,7 +41,7 @@ class Alignment(object):
- '''
- Assuming the given external_align, checks whether
- self is fulfilled for all cases.
-- Returns True if yes, False otherwise.
-+ Returns True if yes, False otherwise.
- '''
- if self.align == 1 and self.offset == 0:
- # alignment 1 with offset 0 is always fulfilled
-@@ -55,9 +55,9 @@ class Alignment(object):
- # the external align guarantees less alignment -> not guaranteed
- return False
-
-- if external_align.align % self.align != 0:
-+ if external_align.align % self.align != 0:
- # the external align cannot be divided by our align
-- # -> not guaranteed
-+ # -> not guaranteed
- # (this can only happen if there are alignments that are not
- # a power of 2, which is highly discouraged. But better be
- # safe and check for it)
-@@ -72,7 +72,7 @@ class Alignment(object):
-
- def combine_with(self, other):
- # returns the alignment that is guaranteed when
-- # both, self or other, can happen
-+ # both, self or other, can happen
- new_align = gcd(self.align, other.align)
- new_offset_candidate1 = self.offset % new_align
- new_offset_candidate2 = other.offset % new_align
-@@ -83,8 +83,8 @@ class Alignment(object):
- new_align = gcd(new_align, offset_diff)
- new_offset_candidate1 = self.offset % new_align
- new_offset_candidate2 = other.offset % new_align
-- assert new_offset_candidate1 == new_offset_candidate2
-- new_offset = new_offset_candidate1
-+ assert new_offset_candidate1 == new_offset_candidate2
-+ new_offset = new_offset_candidate1
- # return the result
- return Alignment(new_align, new_offset)
-
-@@ -92,44 +92,44 @@ class Alignment(object):
- class AlignmentLog(object):
-
- def __init__(self):
-- self.ok_list = []
-- self.fail_list = []
-- self.verbosity = 1
-+ self.ok_list = []
-+ self.fail_list = []
-+ self.verbosity = 1
-
- def __str__(self):
-- result = ""
-+ result = ""
-
-- # output the OK-list
-- for (align_before, field_name, type_obj, callstack, align_after) in self.ok_list:
-- stacksize = len(callstack)
-+ # output the OK-list
-+ for (align_before, field_name, type_obj, callstack, align_after) in self.ok_list:
-+ stacksize = len(callstack)
- indent = ' ' * stacksize
-- if self.ok_callstack_is_relevant(callstack):
-+ if self.ok_callstack_is_relevant(callstack):
- if field_name is None or field_name == "":
-- result += (" %sok: %s:\n\t%sbefore: %s, after: %s\n"
-- % (indent, str(type_obj), indent, str(align_before), str(align_after)))
-- else:
-- result += (" %sok: field \"%s\" in %s:\n\t%sbefore: %s, after: %s\n"
-- % (indent, str(field_name), str(type_obj),
-- indent, str(align_before), str(align_after)))
-+ result += (" %sok: %s:\n\t%sbefore: %s, after: %s\n"
-+ % (indent, str(type_obj), indent, str(align_before), str(align_after)))
-+ else:
-+ result += (" %sok: field \"%s\" in %s:\n\t%sbefore: %s, after: %s\n"
-+ % (indent, str(field_name), str(type_obj),
-+ indent, str(align_before), str(align_after)))
- if self.verbosity >= 1:
-- result += self.callstack_to_str(indent, callstack)
-+ result += self.callstack_to_str(indent, callstack)
-
-- # output the fail-list
-- for (align_before, field_name, type_obj, callstack, reason) in self.fail_list:
-- stacksize = len(callstack)
-+ # output the fail-list
-+ for (align_before, field_name, type_obj, callstack, reason) in self.fail_list:
-+ stacksize = len(callstack)
- indent = ' ' * stacksize
-- if field_name is None or field_name == "":
-- result += (" %sfail: align %s is incompatible with\n\t%s%s\n\t%sReason: %s\n"
-- % (indent, str(align_before), indent, str(type_obj), indent, reason))
-- else:
-- result += (" %sfail: align %s is incompatible with\n\t%sfield \"%s\" in %s\n\t%sReason: %s\n"
-- % (indent, str(align_before), indent, str(field_name), str(type_obj), indent, reason))
-+ if field_name is None or field_name == "":
-+ result += (" %sfail: align %s is incompatible with\n\t%s%s\n\t%sReason: %s\n"
-+ % (indent, str(align_before), indent, str(type_obj), indent, reason))
-+ else:
-+ result += (" %sfail: align %s is incompatible with\n\t%sfield \"%s\" in %s\n\t%sReason: %s\n"
-+ % (indent, str(align_before), indent, str(field_name), str(type_obj), indent, reason))
-
- if self.verbosity >= 1:
-- result += self.callstack_to_str(indent, callstack)
-+ result += self.callstack_to_str(indent, callstack)
-
-
-- return result
-+ return result
-
-
- def callstack_to_str(self, indent, callstack):
-@@ -137,41 +137,41 @@ class AlignmentLog(object):
- for stack_elem in callstack:
- result += "\t %s%s\n" % (indent, str(stack_elem))
- result += "\t%s]\n" % indent
-- return result
-+ return result
-
-
- def ok_callstack_is_relevant(self, ok_callstack):
- # determine whether an ok callstack is relevant for logging
-- if self.verbosity >= 2:
-- return True
-+ if self.verbosity >= 2:
-+ return True
-
- # empty callstacks are always relevant
-- if len(ok_callstack) == 0:
-+ if len(ok_callstack) == 0:
- return True
-
-- # check whether the ok_callstack is a subset or equal to a fail_callstack
-+ # check whether the ok_callstack is a subset or equal to a fail_callstack
- for (align_before, field_name, type_obj, fail_callstack, reason) in self.fail_list:
- if len(ok_callstack) <= len(fail_callstack):
- zipped = zip(ok_callstack, fail_callstack[:len(ok_callstack)])
-- is_subset = all([i == j for i, j in zipped])
-- if is_subset:
-+ is_subset = all([i == j for i, j in zipped])
-+ if is_subset:
- return True
-
- return False
-
-
- def ok(self, align_before, field_name, type_obj, callstack, align_after):
-- self.ok_list.append((align_before, field_name, type_obj, callstack, align_after))
-+ self.ok_list.append((align_before, field_name, type_obj, callstack, align_after))
-
- def fail(self, align_before, field_name, type_obj, callstack, reason):
-- self.fail_list.append((align_before, field_name, type_obj, callstack, reason))
-+ self.fail_list.append((align_before, field_name, type_obj, callstack, reason))
-
- def append(self, other):
-- self.ok_list.extend(other.ok_list)
-- self.fail_list.extend(other.fail_list)
-+ self.ok_list.extend(other.ok_list)
-+ self.fail_list.extend(other.fail_list)
-
- def ok_count(self):
-- return len(self.ok_list)
-+ return len(self.ok_list)
-
-
-
---
-2.11.1
-