diff options
Diffstat (limited to 'gnu/packages/patches')
21 files changed, 617 insertions, 561 deletions
diff --git a/gnu/packages/patches/bdb-5.3-atomics-on-gcc-9.patch b/gnu/packages/patches/bdb-5.3-atomics-on-gcc-9.patch new file mode 100644 index 0000000000..56d404da15 --- /dev/null +++ b/gnu/packages/patches/bdb-5.3-atomics-on-gcc-9.patch @@ -0,0 +1,22 @@ +Patch borrowed from Arch Linux. Allows compiling bdb 5.3 and earlier with GCC newer than 7. + +--- src/dbinc/atomic.h 2013-03-12 14:07:22.000000000 -0400 ++++ src/dbinc/atomic.h.change 2013-03-12 14:06:35.000000000 -0400 +@@ -144,7 +144,7 @@ + #define atomic_inc(env, p) __atomic_inc(p) + #define atomic_dec(env, p) __atomic_dec(p) + #define atomic_compare_exchange(env, p, o, n) \ +- __atomic_compare_exchange((p), (o), (n)) ++ __atomic_compare_exchange_db((p), (o), (n)) + static inline int __atomic_inc(db_atomic_t *p) + { + int temp; +@@ -176,7 +176,7 @@ + * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html + * which configure could be changed to use. + */ +-static inline int __atomic_compare_exchange( ++static inline int __atomic_compare_exchange_db( + db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval) + { + atomic_value_t was; diff --git a/gnu/packages/patches/dbus-CVE-2020-12049.patch b/gnu/packages/patches/dbus-CVE-2020-12049.patch deleted file mode 100644 index 71280144a1..0000000000 --- a/gnu/packages/patches/dbus-CVE-2020-12049.patch +++ /dev/null @@ -1,58 +0,0 @@ -Fix CVE-2020-12049: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-12049 -https://lists.freedesktop.org/archives/ftp-release/2020-June/000753.html - -Taken from upstream: - -https://gitlab.freedesktop.org/dbus/dbus/-/commit/272d484283883fa9ff95b69d924fff6cd34842f5 - -diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c ---- a/dbus/dbus-sysdeps-unix.c -+++ b/dbus/dbus-sysdeps-unix.c -@@ -435,18 +435,6 @@ _dbus_read_socket_with_unix_fds (DBusSocket fd, - struct cmsghdr *cm; - dbus_bool_t found = FALSE; - -- if (m.msg_flags & MSG_CTRUNC) -- { -- /* Hmm, apparently the control data was truncated. The bad -- thing is that we might have completely lost a couple of fds -- without chance to recover them. Hence let's treat this as a -- serious error. */ -- -- errno = ENOSPC; -- _dbus_string_set_length (buffer, start); -- return -1; -- } -- - for (cm = CMSG_FIRSTHDR(&m); cm; cm = CMSG_NXTHDR(&m, cm)) - if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SCM_RIGHTS) - { -@@ -501,6 +489,26 @@ _dbus_read_socket_with_unix_fds (DBusSocket fd, - if (!found) - *n_fds = 0; - -+ if (m.msg_flags & MSG_CTRUNC) -+ { -+ unsigned int i; -+ -+ /* Hmm, apparently the control data was truncated. The bad -+ thing is that we might have completely lost a couple of fds -+ without chance to recover them. Hence let's treat this as a -+ serious error. */ -+ -+ /* We still need to close whatever fds we *did* receive, -+ * otherwise they'll never get closed. (CVE-2020-12049) */ -+ for (i = 0; i < *n_fds; i++) -+ close (fds[i]); -+ -+ *n_fds = 0; -+ errno = ENOSPC; -+ _dbus_string_set_length (buffer, start); -+ return -1; -+ } -+ - /* put length back (doesn't actually realloc) */ - _dbus_string_set_length (buffer, start + bytes_read); - diff --git a/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch b/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch index 4199dd18a5..fed4b76429 100644 --- a/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch +++ b/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch @@ -5,7 +5,7 @@ https://bugzilla.samba.org/show_bug.cgi?id=9515 https://bugzilla.gnome.org/show_bug.cgi?id=736077 (for xsltproc) Patch copied from Debian: -https://anonscm.debian.org/cgit/collab-maint/docbook-xsl.git/tree/debian/patches/765567_non-recursive_string_subst.patch +https://salsa.debian.org/debian/docbook-xsl/-/blob/master/debian/patches/765567_non-recursive_string_subst.patch Description: use EXSLT "replace" function when available A recursive implementation of string.subst is problematic, @@ -15,11 +15,12 @@ Bug-Debian: https://bugs.debian.org/750593 --- a/lib/lib.xsl +++ b/lib/lib.xsl -@@ -10,7 +10,10 @@ +@@ -6,7 +6,11 @@ + This module implements DTD-independent functions - ******************************************************************** --> --<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> +- ******************************************************************** --><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> ++ ******************************************************************** --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:str="http://exslt.org/strings" + exclude-result-prefixes="str" @@ -27,7 +28,7 @@ Bug-Debian: https://bugs.debian.org/750593 <xsl:template name="dot.count"> <!-- Returns the number of "." characters in a string --> -@@ -56,6 +59,9 @@ +@@ -52,6 +56,9 @@ <xsl:param name="replacement"/> <xsl:choose> diff --git a/gnu/packages/patches/docbook-xsl-support-old-url.patch b/gnu/packages/patches/docbook-xsl-support-old-url.patch new file mode 100644 index 0000000000..5b7dda458f --- /dev/null +++ b/gnu/packages/patches/docbook-xsl-support-old-url.patch @@ -0,0 +1,17 @@ +Docbook 1.79.2 makes very few changes apart from changing the canonical URL +to cdn.docbook.org. This patch adds support for the previous URL to avoid +breaking packages that still use that. + +Adapted from Debian: +https://salsa.debian.org/debian/docbook-xsl/-/blob/master/debian/patches/0005-catalog.xml-Compatibility-with-1.79.1-or-earlier.patch + +--- a/catalog.xml ++++ b/catalog.xml +@@ -5,4 +5,7 @@ + <rewriteSystem systemIdStartString="http://cdn.docbook.org/release/xsl/current/" rewritePrefix="./"/> + <rewriteURI uriStartString="http://cdn.docbook.org/release/xsl/1.79.2/" rewritePrefix="./"/> + <rewriteSystem systemIdStartString="http://cdn.docbook.org/release/xsl/1.79.2/" rewritePrefix="./"/> ++ <!-- Also support old URI of v1.79.1 or earlier --> ++ <rewriteURI uriStartString="http://docbook.sourceforge.net/release/xsl/current/" rewritePrefix="./"/> ++ <rewriteSystem systemIdStartString="http://docbook.sourceforge.net/release/xsl/current/" rewritePrefix="./"/> + </catalog> diff --git a/gnu/packages/patches/glibc-bootstrap-system.patch b/gnu/packages/patches/glibc-bootstrap-system.patch index 39eb47ef26..fcaf17132d 100644 --- a/gnu/packages/patches/glibc-bootstrap-system.patch +++ b/gnu/packages/patches/glibc-bootstrap-system.patch @@ -3,17 +3,10 @@ and popen(3) need to be tweaked to use the right shell. For the bootstrap glibc, we just use whatever `sh' can be found in $PATH. The final glibc instead uses the hard-coded absolute file name of `bash'. ---- a/sysdeps/posix/system.c -+++ b/sysdeps/posix/system.c -@@ -140,7 +140,7 @@ do_system (const char *line) - __posix_spawnattr_setflags (&spawn_attr, - POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK); - -- status = __posix_spawn (&pid, SHELL_PATH, 0, &spawn_attr, -+ status = posix_spawnp (&pid, SHELL_NAME, 0, &spawn_attr, - (char *const[]){ (char*) SHELL_NAME, - (char*) "-c", - (char *) line, NULL }, +In addition, status should be initialized to 0 and not -1. + +diff --git a/libio/iopopen.c b/libio/iopopen.c +index ebc381ed7c..e0d3ed1bc3 100644 --- a/libio/iopopen.c +++ b/libio/iopopen.c @@ -85,7 +85,7 @@ spawn_process (posix_spawn_file_actions_t *fa, FILE *fp, const char *command, @@ -25,4 +18,25 @@ instead uses the hard-coded absolute file name of `bash'. (char *const[]){ (char*) "sh", (char*) "-c", (char *) command, NULL }, __environ) != 0) return false; - +diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c +index a03f478fc7..94da6facf3 100644 +--- a/sysdeps/posix/system.c ++++ b/sysdeps/posix/system.c +@@ -101,7 +101,7 @@ cancel_handler (void *arg) + static int + do_system (const char *line) + { +- int status = -1; ++ int status = 0; + int ret; + pid_t pid; + struct sigaction sa; +@@ -145,7 +145,7 @@ do_system (const char *line) + __posix_spawnattr_setflags (&spawn_attr, + POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK); + +- ret = __posix_spawn (&pid, SHELL_PATH, 0, &spawn_attr, ++ ret = posix_spawnp (&pid, SHELL_NAME, 0, &spawn_attr, + (char *const[]){ (char *) SHELL_NAME, + (char *) "-c", + (char *) line, NULL }, diff --git a/gnu/packages/patches/glibc-dl-cache.patch b/gnu/packages/patches/glibc-dl-cache.patch new file mode 100644 index 0000000000..68c3a94846 --- /dev/null +++ b/gnu/packages/patches/glibc-dl-cache.patch @@ -0,0 +1,140 @@ +Read the shared library cache relative to $ORIGIN instead of reading +from /etc/ld.so.cache. Also arrange so that this cache takes +precedence over RUNPATH. + +diff --git a/elf/dl-cache.c b/elf/dl-cache.c +index 93d185e788..e0760a1f40 100644 +--- a/elf/dl-cache.c ++++ b/elf/dl-cache.c +@@ -171,6 +171,51 @@ _dl_cache_libcmp (const char *p1, const char *p2) + return *p1 - *p2; + } + ++/* Special value representing the lack of an ld.so cache. */ ++static const char ld_so_cache_lacking[] = "/ld.so cache is lacking"; ++ ++/* Return the per-application ld.so cache, relative to $ORIGIN, or NULL if ++ that fails for some reason. Do not return the system-wide LD_SO_CACHE ++ since on a foreign distro it would contain invalid information. */ ++static const char * ++ld_so_cache (void) ++{ ++ static const char *loader_cache; ++ ++ if (loader_cache == NULL) ++ { ++ static const char store[] = @STORE_DIRECTORY@; ++ const char *origin = _dl_get_origin (); ++ ++ /* Check whether ORIGIN is something like "/gnu/store/…-foo/bin". */ ++ if (strncmp (store, origin, strlen (store)) == 0 ++ && origin[sizeof store - 1] == '/') ++ { ++ char *store_item_end = strchr (origin + sizeof store, '/'); ++ ++ if (store_item_end != NULL) ++ { ++ static const char suffix[] = "/etc/ld.so.cache"; ++ size_t store_item_len = store_item_end - origin; ++ ++ /* Note: We can't use 'malloc' because it can be interposed. ++ Likewise, 'strncpy' is not available. */ ++ char *cache = alloca (strlen (origin) + sizeof suffix); ++ ++ strcpy (cache, origin); ++ strcpy (cache + store_item_len, suffix); ++ ++ loader_cache = __strdup (cache) ?: ld_so_cache_lacking; ++ } ++ else ++ loader_cache = ld_so_cache_lacking; ++ } ++ else ++ loader_cache = ld_so_cache_lacking; ++ } ++ ++ return loader_cache; ++} + + /* Look up NAME in ld.so.cache and return the file name stored there, or null + if none is found. The cache is loaded if it was not already. If loading +@@ -190,12 +235,15 @@ _dl_load_cache_lookup (const char *name) + + /* Print a message if the loading of libs is traced. */ + if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) +- _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE); ++ _dl_debug_printf (" search cache=%s\n", ld_so_cache ()); ++ ++ if (__glibc_unlikely (ld_so_cache () == ld_so_cache_lacking)) ++ return NULL; + + if (cache == NULL) + { + /* Read the contents of the file. */ +- void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize, ++ void *file = _dl_sysdep_read_whole_file (ld_so_cache (), &cachesize, + PROT_READ); + + /* We can handle three different cache file formats here: +diff --git a/elf/dl-load.c b/elf/dl-load.c +index f3201e7c14..a69aec3428 100644 +--- a/elf/dl-load.c ++++ b/elf/dl-load.c +@@ -2152,28 +2152,6 @@ _dl_map_object (struct link_map *loader, const char *name, + loader ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded, + LA_SER_LIBPATH, &found_other_class); + +- /* Look at the RUNPATH information for this binary. */ +- if (fd == -1 && loader != NULL +- && cache_rpath (loader, &loader->l_runpath_dirs, +- DT_RUNPATH, "RUNPATH")) +- fd = open_path (name, namelen, mode, +- &loader->l_runpath_dirs, &realname, &fb, loader, +- LA_SER_RUNPATH, &found_other_class); +- +- if (fd == -1) +- { +- realname = _dl_sysdep_open_object (name, namelen, &fd); +- if (realname != NULL) +- { +- fd = open_verify (realname, fd, +- &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded, +- LA_SER_CONFIG, mode, &found_other_class, +- false); +- if (fd == -1) +- free (realname); +- } +- } +- + #ifdef USE_LDCONFIG + if (fd == -1 + && (__glibc_likely ((mode & __RTLD_SECURE) == 0) +@@ -2232,6 +2210,28 @@ _dl_map_object (struct link_map *loader, const char *name, + } + #endif + ++ /* Look at the RUNPATH information for this binary. */ ++ if (fd == -1 && loader != NULL ++ && cache_rpath (loader, &loader->l_runpath_dirs, ++ DT_RUNPATH, "RUNPATH")) ++ fd = open_path (name, namelen, mode, ++ &loader->l_runpath_dirs, &realname, &fb, loader, ++ LA_SER_RUNPATH, &found_other_class); ++ ++ if (fd == -1) ++ { ++ realname = _dl_sysdep_open_object (name, namelen, &fd); ++ if (realname != NULL) ++ { ++ fd = open_verify (realname, fd, ++ &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded, ++ LA_SER_CONFIG, mode, &found_other_class, ++ false); ++ if (fd == -1) ++ free (realname); ++ } ++ } ++ + /* Finally, try the default path. */ + if (fd == -1 + && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL diff --git a/gnu/packages/patches/guile-2.2-skip-so-test.patch b/gnu/packages/patches/guile-2.2-skip-so-test.patch new file mode 100644 index 0000000000..e7c2594e91 --- /dev/null +++ b/gnu/packages/patches/guile-2.2-skip-so-test.patch @@ -0,0 +1,23 @@ +Skip 'test-stack-overflow' that crashes when using QEMU transparent emulation. + +--- a/test-suite/standalone/Makefile.in 1970-01-01 01:00:01.000000000 +0100 ++++ b/test-suite/standalone/Makefile.in 2021-01-11 10:59:31.606269449 +0100 +@@ -102,8 +102,7 @@ + test-scm-to-latin1-string$(EXEEXT) test-scm-values$(EXEEXT) \ + test-scm-c-bind-keyword-arguments$(EXEEXT) \ + test-srfi-4$(EXEEXT) $(am__append_6) $(am__EXEEXT_1) \ +- test-smob-mark$(EXEEXT) test-smob-mark-race$(EXEEXT) \ +- test-stack-overflow ++ test-smob-mark$(EXEEXT) test-smob-mark-race$(EXEEXT) + check_PROGRAMS = test-num2integral$(EXEEXT) test-round$(EXEEXT) \ + test-foreign-object-c$(EXEEXT) test-list$(EXEEXT) \ + test-unwind$(EXEEXT) test-conversion$(EXEEXT) \ +@@ -1938,7 +1937,7 @@ + test-command-line-encoding test-command-line-encoding2 \ + test-language test-guild-compile $(am__append_3) \ + test-foreign-object-scm test-fast-slot-ref test-mb-regexp \ +- test-use-srfi $(am__append_5) test-stack-overflow ++ test-use-srfi $(am__append_5) + BUILT_SOURCES = $(am__append_2) + EXTRA_DIST = test-import-order-a.scm test-import-order-b.scm \ + test-import-order-c.scm test-import-order-d.scm \ diff --git a/gnu/packages/patches/icu4c-CVE-2020-10531.patch b/gnu/packages/patches/icu4c-CVE-2020-10531.patch deleted file mode 100644 index c2ab923bdc..0000000000 --- a/gnu/packages/patches/icu4c-CVE-2020-10531.patch +++ /dev/null @@ -1,127 +0,0 @@ -Fix CVE-2020-10531: - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10531 - -Patch copied from upstream source repository (changes to the test suite -are commented out): - -https://github.com/unicode-org/icu/commit/b7d08bc04a4296982fcef8b6b8a354a9e4e7afca - -From b7d08bc04a4296982fcef8b6b8a354a9e4e7afca Mon Sep 17 00:00:00 2001 -From: Frank Tang <ftang@chromium.org> -Date: Sat, 1 Feb 2020 02:39:04 +0000 -Subject: [PATCH] ICU-20958 Prevent SEGV_MAPERR in append - -See #971 ---- - icu4c/source/common/unistr.cpp | 6 ++- - icu4c/source/test/intltest/ustrtest.cpp | 62 +++++++++++++++++++++++++ - icu4c/source/test/intltest/ustrtest.h | 1 + - 3 files changed, 68 insertions(+), 1 deletion(-) - -diff --git a/icu4c/source/common/unistr.cpp b/icu4c/source/common/unistr.cpp -index 901bb3358ba..077b4d6ef20 100644 ---- a/icu4c/source/common/unistr.cpp -+++ b/icu4c/source/common/unistr.cpp -@@ -1563,7 +1563,11 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng - } - - int32_t oldLength = length(); -- int32_t newLength = oldLength + srcLength; -+ int32_t newLength; -+ if (uprv_add32_overflow(oldLength, srcLength, &newLength)) { -+ setToBogus(); -+ return *this; -+ } - - // Check for append onto ourself - const UChar* oldArray = getArrayStart(); -#diff --git a/icu4c/source/test/intltest/ustrtest.cpp b/icu4c/source/test/intltest/ustrtest.cpp -#index b6515ea813c..ad38bdf53a3 100644 -#--- a/icu4c/source/test/intltest/ustrtest.cpp -#+++ b/icu4c/source/test/intltest/ustrtest.cpp -#@@ -67,6 +67,7 @@ void UnicodeStringTest::runIndexedTest( int32_t index, UBool exec, const char* & -# TESTCASE_AUTO(TestWCharPointers); -# TESTCASE_AUTO(TestNullPointers); -# TESTCASE_AUTO(TestUnicodeStringInsertAppendToSelf); -#+ TESTCASE_AUTO(TestLargeAppend); -# TESTCASE_AUTO_END; -# } -# -#@@ -2310,3 +2311,64 @@ void UnicodeStringTest::TestUnicodeStringInsertAppendToSelf() { -# str.insert(2, sub); -# assertEquals("", u"abbcdcde", str); -# } -#+ -#+void UnicodeStringTest::TestLargeAppend() { -#+ if(quick) return; -#+ -#+ IcuTestErrorCode status(*this, "TestLargeAppend"); -#+ // Make a large UnicodeString -#+ int32_t len = 0xAFFFFFF; -#+ UnicodeString str; -#+ char16_t *buf = str.getBuffer(len); -#+ // A fast way to set buffer to valid Unicode. -#+ // 4E4E is a valid unicode character -#+ uprv_memset(buf, 0x4e, len * 2); -#+ str.releaseBuffer(len); -#+ UnicodeString dest; -#+ // Append it 16 times -#+ // 0xAFFFFFF times 16 is 0xA4FFFFF1, -#+ // which is greater than INT32_MAX, which is 0x7FFFFFFF. -#+ int64_t total = 0; -#+ for (int32_t i = 0; i < 16; i++) { -#+ dest.append(str); -#+ total += len; -#+ if (total <= INT32_MAX) { -#+ assertFalse("dest is not bogus", dest.isBogus()); -#+ } else { -#+ assertTrue("dest should be bogus", dest.isBogus()); -#+ } -#+ } -#+ dest.remove(); -#+ total = 0; -#+ for (int32_t i = 0; i < 16; i++) { -#+ dest.append(str); -#+ total += len; -#+ if (total + len <= INT32_MAX) { -#+ assertFalse("dest is not bogus", dest.isBogus()); -#+ } else if (total <= INT32_MAX) { -#+ // Check that a string of exactly the maximum size works -#+ UnicodeString str2; -#+ int32_t remain = INT32_MAX - total; -#+ char16_t *buf2 = str2.getBuffer(remain); -#+ if (buf2 == nullptr) { -#+ // if somehow memory allocation fail, return the test -#+ return; -#+ } -#+ uprv_memset(buf2, 0x4e, remain * 2); -#+ str2.releaseBuffer(remain); -#+ dest.append(str2); -#+ total += remain; -#+ assertEquals("When a string of exactly the maximum size works", (int64_t)INT32_MAX, total); -#+ assertEquals("When a string of exactly the maximum size works", INT32_MAX, dest.length()); -#+ assertFalse("dest is not bogus", dest.isBogus()); -#+ -#+ // Check that a string size+1 goes bogus -#+ str2.truncate(1); -#+ dest.append(str2); -#+ total++; -#+ assertTrue("dest should be bogus", dest.isBogus()); -#+ } else { -#+ assertTrue("dest should be bogus", dest.isBogus()); -#+ } -#+ } -#+} -#diff --git a/icu4c/source/test/intltest/ustrtest.h b/icu4c/source/test/intltest/ustrtest.h -#index 218befdcc68..4a356a92c7a 100644 -#--- a/icu4c/source/test/intltest/ustrtest.h -#+++ b/icu4c/source/test/intltest/ustrtest.h -#@@ -97,6 +97,7 @@ class UnicodeStringTest: public IntlTest { -# void TestWCharPointers(); -# void TestNullPointers(); -# void TestUnicodeStringInsertAppendToSelf(); -#+ void TestLargeAppend(); -# }; -# -# #endif diff --git a/gnu/packages/patches/jsoncpp-fix-inverted-case.patch b/gnu/packages/patches/jsoncpp-fix-inverted-case.patch deleted file mode 100644 index e4897de1b8..0000000000 --- a/gnu/packages/patches/jsoncpp-fix-inverted-case.patch +++ /dev/null @@ -1,22 +0,0 @@ -This patch fixes a bug and related test failure on platforms where 'char' -is unsigned. - -Taken from upstream: -https://github.com/open-source-parsers/jsoncpp/commit/f11611c8785082ead760494cba06196f14a06dcb - -diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp -index 8e06cca2..56195dc1 100644 ---- a/src/lib_json/json_writer.cpp -+++ b/src/lib_json/json_writer.cpp -@@ -178,8 +178,9 @@ static bool isAnyCharRequiredQuoting(char const* s, size_t n) { - - char const* const end = s + n; - for (char const* cur = s; cur < end; ++cur) { -- if (*cur == '\\' || *cur == '\"' || *cur < ' ' || -- static_cast<unsigned char>(*cur) < 0x80) -+ if (*cur == '\\' || *cur == '\"' || -+ static_cast<unsigned char>(*cur) < ' ' || -+ static_cast<unsigned char>(*cur) >= 0x80) - return true; - } - return false; diff --git a/gnu/packages/patches/libtirpc-hurd-client.patch b/gnu/packages/patches/libtirpc-hurd-client.patch deleted file mode 100644 index 526ad262d2..0000000000 --- a/gnu/packages/patches/libtirpc-hurd-client.patch +++ /dev/null @@ -1,50 +0,0 @@ -Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/06-hurd-client-port.diff - -Description: Fix client code for hurd, avoiding malloc overflow - When trying to setup a inet connection, it happens the following: - - in libtirp, src/clnt_vc.c, clnt_vc_create gets called - - when trying to allocate vc_fd_locks, __rpc_dtbsize() is used as size - for that array of fd locks - - __rpc_dtbsize(), in src/rpc_generic.c, queries using rlimit the - maximum (rlim_max) number of file descriptors (RLIMIT_NOFILE): - - on Linux, the default is { rlim_cur = 1024, rlim_max = 4096 } - - on kFreeBSD, the default is { rlim_cur = 1024, rlim_max = 1024 } - - on Hurd, the default is { rlim_cur = 1024, rlim_max = RLIM_INFINITY } - meaning that on Hurd the memory allocation fails (as - __rpc_dtbsize() * sizeof(int) overflows and is negative) - - Change libtiprc so __rpc_dtbsize falls back on rlim_cur if rlim_max - is unlimited. - - This patch fixes the client connection using inet sockets; local unix - sockets are not working, for two reasons so far: - - getpeername on them gives EOPNOTSUPP - - SO_REUSEADDR is not implemented for them -Author: Pino Toscano <pino@debian.org> - -Bug-Debian: http://bugs.debian.org/739674 -Forwarded: no -Reviewed-By: Petter Reinholdtsen -Last-Update: 2014-03-03 - ---- a/src/rpc_generic.c -+++ b/src/rpc_generic.c -@@ -107,12 +107,17 @@ - { - static int tbsize; - struct rlimit rl; -+ rlim_t lim; - - if (tbsize) { - return (tbsize); - } - if (getrlimit(RLIMIT_NOFILE, &rl) == 0) { -- return (tbsize = (int)rl.rlim_max); -+ lim = rl.rlim_max; -+ if (lim == RLIM_INFINITY) { -+ lim = rl.rlim_cur; -+ } -+ return (tbsize = (int)lim); - } - /* - * Something wrong. I'll try to save face by returning a diff --git a/gnu/packages/patches/meson-for-build-rpath.patch b/gnu/packages/patches/meson-for-build-rpath.patch deleted file mode 100644 index ef9a73f07c..0000000000 --- a/gnu/packages/patches/meson-for-build-rpath.patch +++ /dev/null @@ -1,24 +0,0 @@ -This patch removes a part of meson that clears the rpath upon installation. -This will only be applied to a special version of meson, used for the -meson-build-system. - -Original patch for Meson 0.42.0 by Peter Mikkelsen <petermikkelsen10@gmail.com> - ---- meson-0.47.1/mesonbuild/minstall.py.old 2018-08-10 11:01:27.812327013 +0200 -+++ meson-0.47.1/mesonbuild/minstall.py 2018-08-10 11:01:51.940368505 +0200 -@@ -436,15 +436,6 @@ - print("Symlink creation does not work on this platform. " - "Skipping all symlinking.") - printed_symlink_error = True -- if os.path.isfile(outname): -- try: -- depfixer.fix_rpath(outname, install_rpath, final_path, -- install_name_mappings, verbose=False) -- except SystemExit as e: -- if isinstance(e.code, int) and e.code == 0: -- pass -- else: -- raise - - def run(args): - parser = buildparser() diff --git a/gnu/packages/patches/perl-deterministic-ordering.patch b/gnu/packages/patches/perl-deterministic-ordering.patch deleted file mode 100644 index be63d5cde3..0000000000 --- a/gnu/packages/patches/perl-deterministic-ordering.patch +++ /dev/null @@ -1,29 +0,0 @@ -From <https://bugs.debian.org/801523>. - -From c01f602d1926b0671fd2c8d91f7e52c4e4c9fb24 Mon Sep 17 00:00:00 2001 -From: Niko Tyni <ntyni@debian.org> -Date: Sun, 11 Oct 2015 19:27:56 +0300 -Subject: [PATCH] Sort the list of XS code files when generating RealPPPort.xs - -all_files_in_dir() uses readdir() ordering to make the list of -input files. This can vary between build systems, breaking build -reproducibility. ---- - cpan/Devel-PPPort/PPPort_xs.PL | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/dist/Devel-PPPort/PPPort_xs.PL b/dist/Devel-PPPort/PPPort_xs.PL -index 5f18940..149f2fe 100644 ---- a/dist/Devel-PPPort/PPPort_xs.PL -+++ b/dist/Devel-PPPort/PPPort_xs.PL -@@ -38,7 +38,7 @@ END - my $file; - my $sec; - --for $file (all_files_in_dir('parts/inc')) { -+for $file (sort(all_files_in_dir('parts/inc'))) { - my $spec = parse_partspec($file); - - my $msg = 0; --- -2.5.1 diff --git a/gnu/packages/patches/perl-io-socket-ssl-openssl-1.0.2f-fix.patch b/gnu/packages/patches/perl-io-socket-ssl-openssl-1.0.2f-fix.patch deleted file mode 100644 index f2166aebfd..0000000000 --- a/gnu/packages/patches/perl-io-socket-ssl-openssl-1.0.2f-fix.patch +++ /dev/null @@ -1,33 +0,0 @@ -Work around a problem arising from the update to OpenSSL 1.0.2f, based on the -following upstream commit: - - https://github.com/noxxi/p5-io-socket-ssl/commit/6e23ee4a433f83f1065bd2467255eba5ee9b1ddd - -Attempting to update to IO-Socket-SSL-2.023, which includes this commit, -caused other test failures. See: - - https://lists.gnu.org/archive/html/guix-devel/2016-01/msg01032.html - -Description from the upstream commit: - - OpenSSL 1.0.2f changed the behavior of SSL shutdown in case the TLS connection - was not fully established (commit: f73c737c7ac908c5d6407c419769123392a3b0a9). - This somehow resulted in Net::SSLeay::shutdown returning 0 (i.e. keep trying) - which caused an endless loop. It will now ignore this result in case the TLS - connection was not yet established and consider the TLS connection closed - instead. - ---- IO-Socket-SSL-2.002/lib/IO/Socket/SSL.pm.orig 2014-10-21 16:51:16.000000000 -0400 -+++ IO-Socket-SSL-2.002/lib/IO/Socket/SSL.pm 2016-01-31 15:07:14.971099894 -0500 -@@ -1213,6 +1213,11 @@ - # shutdown complete - last; - } -+ if ((${*$self}{'_SSL_opened'}||0) <= 0) { -+ # not really open, thus don't expect shutdown to return -+ # something meaningful -+ last; -+ } - - # initiate or complete shutdown - local $SIG{PIPE} = 'IGNORE'; diff --git a/gnu/packages/patches/perl-no-sys-dirs.patch b/gnu/packages/patches/perl-no-sys-dirs.patch index 2269d715c7..14d634cac9 100644 --- a/gnu/packages/patches/perl-no-sys-dirs.patch +++ b/gnu/packages/patches/perl-no-sys-dirs.patch @@ -6,7 +6,7 @@ Patch adapted from Nixpkgs, originally by Eelco Dolstra diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure --- perl-5.20.0-orig/Configure 2014-05-26 15:34:18.000000000 +0200 +++ perl-5.20.0/Configure 2014-06-25 10:43:35.368285986 +0200 -@@ -106,15 +106,7 @@ +@@ -108,15 +108,7 @@ fi : Proper PATH setting @@ -23,8 +23,8 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure for p in $paths do -@@ -1337,8 +1329,7 @@ - archname='' +@@ -1435,8 +1427,7 @@ + i_whoami='' : Possible local include directories to search. : Set locincpth to "" in a hint file to defeat local include searches. -locincpth="/usr/local/include /opt/local/include /usr/gnu/include" @@ -33,8 +33,8 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure : : no include file wanted by default inclwanted='' -@@ -1349,17 +1340,12 @@ - +@@ -1450,17 +1441,12 @@ + archobjs='' libnames='' : change the next line if compiling for Xenix/286 on Xenix/386 -xlibpth='/usr/lib/386 /lib/386' @@ -54,8 +54,8 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure : Private path used by Configure to find libraries. Its value : is prepended to libpth. This variable takes care of special -@@ -1391,8 +1377,6 @@ - libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD" +@@ -1495,8 +1481,6 @@ + libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD" : We probably want to search /usr/shlib before most other libraries. : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. -glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'` @@ -63,7 +63,7 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure : Do not use vfork unless overridden by a hint file. usevfork=false -@@ -2446,7 +2430,6 @@ +@@ -2553,7 +2537,6 @@ zip " pth=`echo $PATH | sed -e "s/$p_/ /g"` @@ -71,7 +71,7 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure for file in $loclist; do eval xxx=\$$file case "$xxx" in -@@ -4936,7 +4919,7 @@ +@@ -5049,7 +5033,7 @@ : Set private lib path case "$plibpth" in '') if ./mips; then @@ -80,7 +80,7 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure fi;; esac case "$libpth" in -@@ -8600,13 +8583,8 @@ +@@ -8877,13 +8861,8 @@ echo " " case "$sysman" in '') @@ -96,7 +96,7 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure ;; esac if $test -d "$sysman"; then -@@ -19900,9 +19878,10 @@ +@@ -21027,9 +21006,10 @@ case "$full_ar" in '') full_ar=$ar ;; esac @@ -169,7 +169,7 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/freebsd.sh perl-5.20.0/hints/ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/linux.sh --- perl-5.20.0-orig/hints/linux.sh 2014-05-26 15:34:20.000000000 +0200 +++ perl-5.20.0/hints/linux.sh 2014-06-25 10:33:47.354883843 +0200 -@@ -150,25 +150,6 @@ +@@ -150,28 +150,6 @@ ;; esac @@ -188,6 +188,9 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/li -# plibpth to bypass this check. -if [ -x /usr/bin/gcc ] ; then - gcc=/usr/bin/gcc +-# clang also provides -print-search-dirs +-elif ${cc:-cc} --version 2>/dev/null | grep -q '^clang ' ; then +- gcc=${cc:-cc} -else - gcc=gcc -fi @@ -195,7 +198,40 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/li case "$plibpth" in '') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'` -@@ -367,33 +322,6 @@ +@@ -208,32 +186,6 @@ + ;; + esac + +-case "$libc" in +-'') +-# If you have glibc, then report the version for ./myconfig bug reporting. +-# (Configure doesn't need to know the specific version since it just uses +-# gcc to load the library for all tests.) +-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they +-# are insufficiently precise to distinguish things like +-# libc-2.0.6 and libc-2.0.7. +- for p in $plibpth +- do +- for trylib in libc.so.6 libc.so +- do +- if $test -e $p/$trylib; then +- libc=`ls -l $p/$trylib | awk '{print $NF}'` +- if $test "X$libc" != X; then +- break +- fi +- fi +- done +- if $test "X$libc" != X; then +- break +- fi +- done +- ;; +-esac +- + if ${sh:-/bin/sh} -c exit; then + echo '' + echo 'You appear to have a working bash. Good.' +@@ -311,33 +263,6 @@ ;; esac @@ -229,40 +265,3 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/li # Linux on Synology. if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then # Tested on Synology DS213 and DS413 -diff --git a/hints/linux.sh b/hints/linux.sh -index 3f38ea0..97aed11 100644 ---- a/hints/linux.sh -+++ b/hints/linux.sh -@@ -195,32 +195,6 @@ case "$usequadmath" in - ;; - esac - --case "$libc" in --'') --# If you have glibc, then report the version for ./myconfig bug reporting. --# (Configure doesn't need to know the specific version since it just uses --# gcc to load the library for all tests.) --# We don't use __GLIBC__ and __GLIBC_MINOR__ because they --# are insufficiently precise to distinguish things like --# libc-2.0.6 and libc-2.0.7. -- for p in $plibpth -- do -- for trylib in libc.so.6 libc.so -- do -- if $test -e $p/$trylib; then -- libc=`ls -l $p/$trylib | awk '{print $NF}'` -- if $test "X$libc" != X; then -- break -- fi -- fi -- done -- if $test "X$libc" != X; then -- break -- fi -- done -- ;; --esac -- - if ${sh:-/bin/sh} -c exit; then - echo '' - echo 'You appear to have a working bash. Good.' diff --git a/gnu/packages/patches/python-3-fix-tests.patch b/gnu/packages/patches/python-3-fix-tests.patch index e13790bd41..b44e743c71 100644 --- a/gnu/packages/patches/python-3-fix-tests.patch +++ b/gnu/packages/patches/python-3-fix-tests.patch @@ -1,10 +1,39 @@ -See the discussion about the issues fixed here at: -http://bugs.python.org/issue20868 . +From f0698133e7d6c353a3e6ae0fc62e57ba558a9bc0 Mon Sep 17 00:00:00 2001 +From: Maxim Cournoyer <maxim.cournoyer@gmail.com> +Date: Wed, 28 Oct 2020 22:55:05 -0400 +Subject: [PATCH] Skip problematic Python 3 tests in Guix. + +A subset of the hunks in this patch is tracked upstream at +https://bugs.python.org/issue38845, which was contributed by Tanguy Le +Carrour <tanguy@bioneland.org>. +--- + Lib/ctypes/test/test_callbacks.py | 3 +++ + Lib/ctypes/test/test_find.py | 1 + + Lib/ctypes/test/test_libc.py | 3 +++ + Lib/distutils/tests/test_archive_util.py | 2 ++ + Lib/distutils/tests/test_sdist.py | 1 + + Lib/test/_test_multiprocessing.py | 2 ++ + Lib/test/test_asyncio/test_base_events.py | 2 ++ + Lib/test/test_generators.py | 1 + + Lib/test/test_pathlib.py | 3 +-- + Lib/test/test_pdb.py | 4 ++-- + Lib/test/test_regrtest.py | 2 ++ + Lib/test/test_resource.py | 1 + + Lib/test/test_shutil.py | 2 ++ + Lib/test/test_signal.py | 4 ++++ + Lib/test/test_socket.py | 8 ++++++++ + Lib/test/test_spwd.py | 6 ++---- + Lib/test/test_tarfile.py | 9 ++++++--- + Lib/test/test_threading.py | 3 +++ + Lib/test/test_unicodedata.py | 1 + + Tools/scripts/run_tests.py | 2 +- + 20 files changed, 48 insertions(+), 12 deletions(-) diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks.py +index d8e9c5a760..94fc5929c9 100644 --- a/Lib/ctypes/test/test_callbacks.py +++ b/Lib/ctypes/test/test_callbacks.py -@@ -3,6 +3,7 @@ import unittest +@@ -5,6 +5,7 @@ from test import support from ctypes import * from ctypes.test import need_symbol import _ctypes_test @@ -12,7 +41,7 @@ diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks. class Callbacks(unittest.TestCase): functype = CFUNCTYPE -@@ -176,6 +177,8 @@ class SampleCallbacksTestCase(unittest.TestCase): +@@ -178,6 +179,8 @@ class SampleCallbacksTestCase(unittest.TestCase): self.assertLess(diff, 0.01, "%s not less than 0.01" % diff) @@ -21,7 +50,20 @@ diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks. def test_issue_8959_a(self): from ctypes.util import find_library libc_path = find_library("c") +diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py +index 92ac1840ad..c8eb75dedd 100644 +--- a/Lib/ctypes/test/test_find.py ++++ b/Lib/ctypes/test/test_find.py +@@ -116,6 +116,7 @@ class FindLibraryLinux(unittest.TestCase): + with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None): + self.assertNotEqual(find_library('c'), None) + ++ @unittest.skipIf(True, "ldconfig is not used on Guix") + def test_find_library_with_ld(self): + with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None), \ + unittest.mock.patch("ctypes.util._findLib_gcc", lambda *args: None): diff --git a/Lib/ctypes/test/test_libc.py b/Lib/ctypes/test/test_libc.py +index 56285b5ff8..c088ab3db8 100644 --- a/Lib/ctypes/test/test_libc.py +++ b/Lib/ctypes/test/test_libc.py @@ -2,6 +2,7 @@ import unittest @@ -42,6 +84,7 @@ diff --git a/Lib/ctypes/test/test_libc.py b/Lib/ctypes/test/test_libc.py comparefunc = CFUNCTYPE(c_int, POINTER(c_char), POINTER(c_char)) lib.my_qsort.argtypes = c_void_p, c_size_t, c_size_t, comparefunc diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test_archive_util.py +index e9aad0e40f..8bbaa51ee5 100644 --- a/Lib/distutils/tests/test_archive_util.py +++ b/Lib/distutils/tests/test_archive_util.py @@ -333,6 +333,7 @@ class ArchiveUtilTestCase(support.TempdirManager, @@ -61,6 +104,7 @@ diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test tmpdir = self._create_files() base_name = os.path.join(self.mkdtemp(), 'archive') diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py +index 23db126959..6e2329df7d 100644 --- a/Lib/distutils/tests/test_sdist.py +++ b/Lib/distutils/tests/test_sdist.py @@ -443,6 +443,7 @@ class SDistTestCase(BasePyPIRCCommandTestCase): @@ -72,9 +116,10 @@ diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist. # now building a sdist dist, cmd = self.get_cmd() diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py +index e47905c863..31a5a9c308 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py -@@ -1473,6 +1473,7 @@ class _TestCondition(BaseTestCase): +@@ -1577,6 +1577,7 @@ class _TestCondition(BaseTestCase): if pid is not None: os.kill(pid, signal.SIGINT) @@ -82,10 +127,19 @@ diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing. def test_wait_result(self): if isinstance(self, ProcessesMixin) and sys.platform != 'win32': pid = os.getpid() +@@ -3905,6 +3906,7 @@ class _TestSharedMemory(BaseTestCase): + sms.close() + + @unittest.skipIf(os.name != "posix", "not feasible in non-posix platforms") ++ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device") + def test_shared_memory_SharedMemoryServer_ignores_sigint(self): + # bpo-36368: protect SharedMemoryManager server process from + # KeyboardInterrupt signals. diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py +index 533d5cc7f5..c4f860cc3b 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py -@@ -1323,6 +1323,8 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase): +@@ -1341,6 +1341,8 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase): self._test_create_connection_ip_addr(m_socket, False) @patch_socket @@ -95,9 +149,10 @@ diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/t m_socket.getaddrinfo = socket.getaddrinfo sock = m_socket.socket.return_value diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py +index 3bf1522808..04bac8a7db 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py -@@ -34,6 +34,7 @@ class SignalAndYieldFromTest(unittest.TestCase): +@@ -33,6 +33,7 @@ class SignalAndYieldFromTest(unittest.TestCase): else: return "FAILED" @@ -105,30 +160,11 @@ diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py def test_raise_and_yield_from(self): gen = self.generator1() gen.send(None) -diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py ---- a/Lib/test/test_normalization.py -+++ b/Lib/test/test_normalization.py -@@ -2,6 +2,7 @@ from test.support import open_urlresource - import unittest - - from http.client import HTTPException -+from urllib.error import URLError - import sys - from unicodedata import normalize, unidata_version - -@@ -43,6 +44,8 @@ class NormalizationTest(unittest.TestCase): - except PermissionError: - self.skipTest(f"Permission error when downloading {TESTDATAURL} " - f"into the test data directory") -+ except URLError: -+ self.skipTest("DNS lookups are not enabled.") - except (OSError, HTTPException): - self.fail(f"Could not retrieve {TESTDATAURL}") - diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py +index 3da35710b9..5404f9193d 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py -@@ -2134,8 +2134,7 @@ class PosixPathTest(_BasePathTest, unittest.TestCase): +@@ -2408,8 +2408,7 @@ class PosixPathTest(_BasePathTest, unittest.TestCase): self.assertEqual(given, expect) self.assertEqual(set(p.rglob("FILEd*")), set()) @@ -139,9 +175,10 @@ diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py P = self.cls support.import_module('pwd') diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py +index 8016f81e5a..10190486b4 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py -@@ -1150,11 +1150,11 @@ def test_pdb_issue_20766(): +@@ -1219,11 +1219,11 @@ def test_pdb_issue_20766(): > <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function() -> print('pdb %d: %s' % (i, sess._previous_sigint_handler)) (Pdb) continue @@ -156,9 +193,10 @@ diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py +index a77638b10a..2069b349a8 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py -@@ -762,6 +762,7 @@ class ArgsTestCase(BaseTestCase): +@@ -811,6 +811,7 @@ class ArgsTestCase(BaseTestCase): output = self.run_tests('--fromfile', filename) self.check_executed_tests(output, tests) @@ -166,7 +204,7 @@ diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py def test_interrupted(self): code = TEST_INTERRUPTED test = self.create_test('sigint', code=code) -@@ -779,6 +780,7 @@ class ArgsTestCase(BaseTestCase): +@@ -828,6 +829,7 @@ class ArgsTestCase(BaseTestCase): % (self.TESTNAME_REGEX, len(tests))) self.check_line(output, regex) @@ -175,9 +213,10 @@ diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py # Issue #25373: test --slowest with an interrupted test code = TEST_INTERRUPTED diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py +index e5ece5284c..5299e54507 100644 --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py -@@ -145,6 +145,7 @@ class ResourceTest(unittest.TestCase): +@@ -148,6 +148,7 @@ class ResourceTest(unittest.TestCase): @unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit') @support.requires_linux_version(2, 6, 36) @@ -186,37 +225,75 @@ diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py self.assertRaises(TypeError, resource.prlimit) self.assertRaises(ProcessLookupError, resource.prlimit, diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py +index e19af64be0..1b893df6fa 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py -@@ -1143,6 +1143,7 @@ class TestShutil(unittest.TestCase): +@@ -1427,6 +1427,7 @@ class TestArchives(BaseTest, unittest.TestCase): + base_name = os.path.join(tmpdir, 'archive') self.assertRaises(ValueError, make_archive, base_name, 'xxx') - @support.requires_zlib -+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix") ++ @unittest.skipIf(True, "The Guix build container has no root user") + @support.requires_zlib() def test_make_archive_owner_group(self): # testing make_archive with owner and group, with various combinations - # this works even if there's not gid/uid support -@@ -1171,6 +1172,7 @@ class TestShutil(unittest.TestCase): +@@ -1455,6 +1456,7 @@ class TestArchives(BaseTest, unittest.TestCase): + self.assertTrue(os.path.isfile(res)) - @support.requires_zlib -+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix") ++ @unittest.skipIf(True, "The Guix build container has no root user") + @support.requires_zlib() @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support") def test_tarfile_root_owner(self): - root_dir, base_dir = self._create_files() +diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py +index 45553a6a42..55623f01a3 100644 +--- a/Lib/test/test_signal.py ++++ b/Lib/test/test_signal.py +@@ -78,6 +78,7 @@ class PosixTests(unittest.TestCase): + self.assertLess(len(s), signal.NSIG) + + @unittest.skipUnless(sys.executable, "sys.executable required.") ++ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device") + def test_keyboard_interrupt_exit_code(self): + """KeyboardInterrupt triggers exit via SIGINT.""" + process = subprocess.run( +@@ -128,6 +129,7 @@ class WindowsSignalTests(unittest.TestCase): + signal.signal(7, handler) + + @unittest.skipUnless(sys.executable, "sys.executable required.") ++ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device") + def test_keyboard_interrupt_exit_code(self): + """KeyboardInterrupt triggers an exit using STATUS_CONTROL_C_EXIT.""" + # We don't test via os.kill(os.getpid(), signal.CTRL_C_EVENT) here +@@ -1245,6 +1247,7 @@ class StressTest(unittest.TestCase): + + class RaiseSignalTest(unittest.TestCase): + ++ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device") + def test_sigint(self): + with self.assertRaises(KeyboardInterrupt): + signal.raise_signal(signal.SIGINT) +@@ -1275,6 +1278,7 @@ class RaiseSignalTest(unittest.TestCase): + + class PidfdSignalTest(unittest.TestCase): + ++ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device") + @unittest.skipUnless( + hasattr(signal, "pidfd_send_signal"), + "pidfd support not built in", diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py +index aefba4f397..6c89f558d5 100755 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py -@@ -875,6 +875,8 @@ class GeneralModuleTests(unittest.TestCase): +@@ -1009,6 +1009,8 @@ class GeneralModuleTests(unittest.TestCase): if not fqhn in all_host_names: self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names))) + @unittest.skipUnless(support.is_resource_enabled('network'), + 'network is not enabled') def test_host_resolution(self): - for addr in [support.HOSTv4, '10.0.0.1', '255.255.255.255']: + for addr in [socket_helper.HOSTv4, '10.0.0.1', '255.255.255.255']: self.assertEqual(socket.gethostbyname(addr), addr) -@@ -1004,6 +1006,8 @@ class GeneralModuleTests(unittest.TestCase): +@@ -1140,6 +1142,8 @@ class GeneralModuleTests(unittest.TestCase): self.assertWarns(DeprecationWarning, socket.ntohs, k) self.assertWarns(DeprecationWarning, socket.htons, k) @@ -225,7 +302,7 @@ diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py def testGetServBy(self): eq = self.assertEqual # Find one service that exists, then check all the related interfaces. -@@ -1358,6 +1362,8 @@ class GeneralModuleTests(unittest.TestCase): +@@ -1489,6 +1493,8 @@ class GeneralModuleTests(unittest.TestCase): raise self.assertRaises(TypeError, s.ioctl, socket.SIO_LOOPBACK_FAST_PATH, None) @@ -234,7 +311,7 @@ diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py def testGetaddrinfo(self): try: socket.getaddrinfo('localhost', 80) -@@ -1440,6 +1446,8 @@ class GeneralModuleTests(unittest.TestCase): +@@ -1571,6 +1577,8 @@ class GeneralModuleTests(unittest.TestCase): # only IP addresses are allowed self.assertRaises(OSError, socket.getnameinfo, ('mail.python.org',0), 0) @@ -244,6 +321,7 @@ diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py 'network is not enabled') def test_idna(self): diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py +index 07793c84c8..fec672bcbe 100644 --- a/Lib/test/test_spwd.py +++ b/Lib/test/test_spwd.py @@ -5,8 +5,7 @@ from test import support @@ -267,9 +345,10 @@ diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py def test_getspnam_exception(self): diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py +index 29cde91bf7..8d0f20e8bf 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py -@@ -2509,9 +2509,12 @@ def root_is_uid_gid_0(): +@@ -2607,9 +2607,12 @@ def root_is_uid_gid_0(): import pwd, grp except ImportError: return False @@ -286,9 +365,10 @@ diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py return True diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py +index c21cdf8eb7..6c9d575032 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py -@@ -1249,6 +1249,7 @@ class MiscTestCase(unittest.TestCase): +@@ -1398,6 +1398,7 @@ class MiscTestCase(unittest.TestCase): class InterruptMainTests(unittest.TestCase): @@ -296,7 +376,7 @@ diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py def test_interrupt_main_subthread(self): # Calling start_new_thread with a function that executes interrupt_main # should raise KeyboardInterrupt upon completion. -@@ -1260,6 +1261,8 @@ class InterruptMainTests(unittest.TestCase): +@@ -1409,6 +1410,8 @@ class InterruptMainTests(unittest.TestCase): t.join() t.join() @@ -305,10 +385,23 @@ diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py def test_interrupt_main_mainthread(self): # Make sure that if interrupt_main is called in main thread that # KeyboardInterrupt is raised instantly. +diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py +index b552d2bd17..28b1144e15 100644 +--- a/Lib/test/test_unicodedata.py ++++ b/Lib/test/test_unicodedata.py +@@ -309,6 +309,7 @@ class UnicodeMiscTest(UnicodeDatabaseTest): + self.assertEqual(len(lines), 1, + r"\u%.4x should not be a linebreak" % i) + ++@requires_resource('network') + class NormalizationTest(unittest.TestCase): + @staticmethod + def check_version(testfile): diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py +index bcfa5e943b..1f2484971b 100644 --- a/Tools/scripts/run_tests.py +++ b/Tools/scripts/run_tests.py -@@ -39,7 +39,7 @@ def main(regrtest_args): +@@ -41,7 +41,7 @@ def main(regrtest_args): if not any(is_multiprocess_flag(arg) for arg in regrtest_args): args.extend(['-j', '0']) # Use all CPU cores if not any(is_resource_use_flag(arg) for arg in regrtest_args): @@ -317,3 +410,6 @@ diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py args.extend(regrtest_args) print(' '.join(args)) if sys.platform == 'win32': +-- +2.29.2 + diff --git a/gnu/packages/patches/python-3-hurd-configure.patch b/gnu/packages/patches/python-3-hurd-configure.patch new file mode 100644 index 0000000000..aa25a401c5 --- /dev/null +++ b/gnu/packages/patches/python-3-hurd-configure.patch @@ -0,0 +1,27 @@ +Upstream status: Not upstreamed. + +The build system refuses to cross-compile for unknown targets +even though it works fine. Add GNU/Hurd target. + +--- Python-3.8.5/configure.orig 2020-10-26 14:06:09.665423525 +0100 ++++ Python-3.8.5/configure 2020-10-26 14:08:30.987765738 +0100 +@@ -3278,6 +3278,9 @@ + *-*-vxworks*) + ac_sys_system=VxWorks + ;; ++ *-*-gnu) ++ ac_sys_system=GNU ++ ;; + *) + # for now, limit cross builds to known configurations + MACHDEP="unknown" +@@ -3328,6 +3331,9 @@ + *-*-vxworks*) + _host_cpu=$host_cpu + ;; ++ *-*-gnu) ++ _host_cpu=$host_cpu ++ ;; + *) + # for now, limit cross builds to known configurations + MACHDEP="unknown" diff --git a/gnu/packages/patches/python-3.8-fix-tests.patch b/gnu/packages/patches/python-3.8-fix-tests.patch deleted file mode 100644 index 4fbdd444c7..0000000000 --- a/gnu/packages/patches/python-3.8-fix-tests.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py -index 1474624..887f8ee 100644 ---- a/Lib/test/_test_multiprocessing.py -+++ b/Lib/test/_test_multiprocessing.py -@@ -3801,6 +3801,7 @@ class _TestSharedMemory(BaseTestCase): - sms.close() - - @unittest.skipIf(os.name != "posix", "not feasible in non-posix platforms") -+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device") - def test_shared_memory_SharedMemoryServer_ignores_sigint(self): - # bpo-36368: protect SharedMemoryManager server process from - # KeyboardInterrupt signals. -diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py -index d41e94b..a1c15e7 100644 ---- a/Lib/test/test_signal.py -+++ b/Lib/test/test_signal.py -@@ -78,6 +78,7 @@ class PosixTests(unittest.TestCase): - self.assertLess(len(s), signal.NSIG) - - @unittest.skipUnless(sys.executable, "sys.executable required.") -+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device") - def test_keyboard_interrupt_exit_code(self): - """KeyboardInterrupt triggers exit via SIGINT.""" - process = subprocess.run( -@@ -128,6 +129,7 @@ class WindowsSignalTests(unittest.TestCase): - signal.signal(7, handler) - - @unittest.skipUnless(sys.executable, "sys.executable required.") -+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device") - def test_keyboard_interrupt_exit_code(self): - """KeyboardInterrupt triggers an exit using STATUS_CONTROL_C_EXIT.""" - # We don't test via os.kill(os.getpid(), signal.CTRL_C_EVENT) here -@@ -1245,6 +1247,7 @@ class StressTest(unittest.TestCase): - - class RaiseSignalTest(unittest.TestCase): - -+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device") - def test_sigint(self): - with self.assertRaises(KeyboardInterrupt): - signal.raise_signal(signal.SIGINT) --- -2.23.0 diff --git a/gnu/packages/patches/python-babel-fix-parse-future-test.patch b/gnu/packages/patches/python-babel-fix-parse-future-test.patch new file mode 100644 index 0000000000..8a90166ec5 --- /dev/null +++ b/gnu/packages/patches/python-babel-fix-parse-future-test.patch @@ -0,0 +1,68 @@ +From 7bdaa28a55e8d8228d5434effa4b1473ab7b3669 Mon Sep 17 00:00:00 2001 +From: Felix Schwarz <felix.schwarz@oss.schwarz.eu> +Date: Tue, 5 May 2020 08:05:56 +0000 +Subject: [PATCH] fix tests when using Python 3.9a6 + +In Python 3.9a6 integer values for future flags were changed to prevent +collision with compiler flags. We need to retrieve these at runtime so +the test suite works with Python <= 3.8 as well as Python 3.9. +--- + tests/test_util.py | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/tests/test_util.py b/tests/test_util.py +index a6a4450c..b9343aaa 100644 +--- a/tests/test_util.py ++++ b/tests/test_util.py +@@ -11,6 +11,7 @@ + # individuals. For the exact contribution history, see the revision + # history and logs, available at http://babel.edgewall.org/log/. + ++import __future__ + import unittest + + import pytest +@@ -20,6 +21,12 @@ + from babel.util import parse_future_flags + + ++class _FF: ++ division = __future__.division.compiler_flag ++ print_function = __future__.print_function.compiler_flag ++ with_statement = __future__.with_statement.compiler_flag ++ unicode_literals = __future__.unicode_literals.compiler_flag ++ + def test_distinct(): + assert list(util.distinct([1, 2, 1, 3, 4, 4])) == [1, 2, 3, 4] + assert list(util.distinct('foobar')) == ['f', 'o', 'b', 'a', 'r'] +@@ -70,25 +77,25 @@ def test_parse_encoding_non_ascii(): + from __future__ import print_function, + division, with_statement, + unicode_literals +-''', 0x10000 | 0x2000 | 0x8000 | 0x20000), ++''', _FF.print_function | _FF.division | _FF.with_statement | _FF.unicode_literals), + (''' + from __future__ import print_function, division + print('hello') +-''', 0x10000 | 0x2000), ++''', _FF.print_function | _FF.division), + (''' + from __future__ import print_function, division, unknown,,,,, + print 'hello' +-''', 0x10000 | 0x2000), ++''', _FF.print_function | _FF.division), + (''' + from __future__ import ( + print_function, + division) +-''', 0x10000 | 0x2000), ++''', _FF.print_function | _FF.division), + (''' + from __future__ import \\ + print_function, \\ + division +-''', 0x10000 | 0x2000), ++''', _FF.print_function | _FF.division), + ]) + def test_parse_future(source, result): + fp = BytesIO(source.encode('latin-1')) diff --git a/gnu/packages/patches/python-libxml2-python39-compat.patch b/gnu/packages/patches/python-libxml2-python39-compat.patch new file mode 100644 index 0000000000..a707ea3434 --- /dev/null +++ b/gnu/packages/patches/python-libxml2-python39-compat.patch @@ -0,0 +1,94 @@ +https://gitlab.gnome.org/GNOME/libxml2/-/commit/e4fb36841800038c289997432ca547c9bfef9db1.patch + +From e4fb36841800038c289997432ca547c9bfef9db1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz> +Date: Fri, 28 Feb 2020 12:48:14 +0100 +Subject: [PATCH] Parenthesize Py<type>_Check() in ifs + +In C, if expressions should be parenthesized. +PyLong_Check, PyUnicode_Check etc. happened to expand to a parenthesized +expression before, but that's not API to rely on. + +Since Python 3.9.0a4 it needs to be parenthesized explicitly. + +Fixes https://gitlab.gnome.org/GNOME/libxml2/issues/149 +--- + python/libxml.c | 4 ++-- + python/types.c | 12 ++++++------ + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/python/libxml.c b/python/libxml.c +index bc676c4e..81e709f3 100644 +--- a/python/libxml.c ++++ b/python/libxml.c +@@ -294,7 +294,7 @@ xmlPythonFileReadRaw (void * context, char * buffer, int len) { + lenread = PyBytes_Size(ret); + data = PyBytes_AsString(ret); + #ifdef PyUnicode_Check +- } else if PyUnicode_Check (ret) { ++ } else if (PyUnicode_Check (ret)) { + #if PY_VERSION_HEX >= 0x03030000 + Py_ssize_t size; + const char *tmp; +@@ -359,7 +359,7 @@ xmlPythonFileRead (void * context, char * buffer, int len) { + lenread = PyBytes_Size(ret); + data = PyBytes_AsString(ret); + #ifdef PyUnicode_Check +- } else if PyUnicode_Check (ret) { ++ } else if (PyUnicode_Check (ret)) { + #if PY_VERSION_HEX >= 0x03030000 + Py_ssize_t size; + const char *tmp; +diff --git a/python/types.c b/python/types.c +index c2bafeb1..ed284ec7 100644 +--- a/python/types.c ++++ b/python/types.c +@@ -602,16 +602,16 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj) + if (obj == NULL) { + return (NULL); + } +- if PyFloat_Check (obj) { ++ if (PyFloat_Check (obj)) { + ret = xmlXPathNewFloat((double) PyFloat_AS_DOUBLE(obj)); +- } else if PyLong_Check(obj) { ++ } else if (PyLong_Check(obj)) { + #ifdef PyLong_AS_LONG + ret = xmlXPathNewFloat((double) PyLong_AS_LONG(obj)); + #else + ret = xmlXPathNewFloat((double) PyInt_AS_LONG(obj)); + #endif + #ifdef PyBool_Check +- } else if PyBool_Check (obj) { ++ } else if (PyBool_Check (obj)) { + + if (obj == Py_True) { + ret = xmlXPathNewBoolean(1); +@@ -620,14 +620,14 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj) + ret = xmlXPathNewBoolean(0); + } + #endif +- } else if PyBytes_Check (obj) { ++ } else if (PyBytes_Check (obj)) { + xmlChar *str; + + str = xmlStrndup((const xmlChar *) PyBytes_AS_STRING(obj), + PyBytes_GET_SIZE(obj)); + ret = xmlXPathWrapString(str); + #ifdef PyUnicode_Check +- } else if PyUnicode_Check (obj) { ++ } else if (PyUnicode_Check (obj)) { + #if PY_VERSION_HEX >= 0x03030000 + xmlChar *str; + const char *tmp; +@@ -650,7 +650,7 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj) + ret = xmlXPathWrapString(str); + #endif + #endif +- } else if PyList_Check (obj) { ++ } else if (PyList_Check (obj)) { + int i; + PyObject *node; + xmlNodePtr cur; +-- +GitLab + diff --git a/gnu/packages/patches/tcsh-fix-autotest.patch b/gnu/packages/patches/tcsh-fix-autotest.patch index 200867cb9b..9f5790641b 100644 --- a/gnu/packages/patches/tcsh-fix-autotest.patch +++ b/gnu/packages/patches/tcsh-fix-autotest.patch @@ -63,17 +63,6 @@ AT_DATA([comment2.csh], [[echo testing...@%:@\ ---- tests/subst.at -+++ tests/subst.at -@@ -54,7 +54,7 @@ AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }') - , [1 - ]) - --AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }'); echo "echo ~$(id -un)/foo; echo \"\$HOME/foo\"" | tcsh -f | uniq dnl -+AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }'); echo "echo ~$(id -un)//foo; echo \"\$HOME/foo\"" | tcsh -f | uniq dnl - | wc -l | tr -d ' \t'], , [1 - ]) - --- tests/variables.at +++ tests/variables.at @@ -666,7 +666,8 @@ set listflags=(-xA $cwd/args.sh) diff --git a/gnu/packages/patches/zziplib-CVE-2018-16548.patch b/gnu/packages/patches/zziplib-CVE-2018-16548.patch deleted file mode 100644 index a17c6a9768..0000000000 --- a/gnu/packages/patches/zziplib-CVE-2018-16548.patch +++ /dev/null @@ -1,49 +0,0 @@ -The following 3 patches applied to 0.13.69 in this order, combined: -https://github.com/gdraheim/zziplib/commit/9411bde3e4a70a81ff3ffd256b71927b2d90dcbb.patch -https://github.com/gdraheim/zziplib/commit/d2e5d5c53212e54a97ad64b793a4389193fec687.patch -https://github.com/gdraheim/zziplib/commit/0e1dadb05c1473b9df2d7b8f298dab801778ef99.patch - -diff --git a/test/test.zip b/test/test.zip -index 2c992ea..952d475 100644 -Binary files a/test/test.zip and b/test/test.zip differ -diff --git a/zzip/zip.c b/zzip/zip.c -index 14e2e06..f97a40a 100644 ---- a/zzip/zip.c -+++ b/zzip/zip.c -@@ -472,9 +472,15 @@ __zzip_parse_root_directory(int fd, - } else - { - if (io->fd.seeks(fd, zz_rootseek + zz_offset, SEEK_SET) < 0) -+ { -+ free(hdr0); - return ZZIP_DIR_SEEK; -+ } - if (io->fd.read(fd, &dirent, sizeof(dirent)) < __sizeof(dirent)) -+ { -+ free(hdr0); - return ZZIP_DIR_READ; -+ } - d = &dirent; - } - -@@ -574,11 +580,18 @@ __zzip_parse_root_directory(int fd, - - if (hdr_return) - *hdr_return = hdr0; -+ else -+ { -+ /* If it is not assigned to *hdr_return, it will never be free()'d */ -+ free(hdr0); -+ } - } /* else zero (sane) entries */ -+ else -+ free(hdr0); - # ifndef ZZIP_ALLOW_MODULO_ENTRIES -- return (entries != zz_entries ? ZZIP_CORRUPTED : 0); -+ return (entries != zz_entries) ? ZZIP_CORRUPTED : 0; - # else -- return ((entries & (unsigned)0xFFFF) != zz_entries ? ZZIP_CORRUPTED : 0); -+ return ((entries & (unsigned)0xFFFF) != zz_entries) ? ZZIP_CORRUPTED : 0; - # endif - } - |