commit:     4622c79b0a1bad6dd0c741f3d10fbc987e4f565e
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 13 09:30:53 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Nov 13 09:30:53 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4622c79b

qmerge: don't call zstd with --long=31 on 32-bits platforms

32-bits recent versions of zstd do not grok this argument, so just drop
it for those platforms

Bug: https://bugs.gentoo.org/754102
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 configure.ac | 10 ++++++++++
 qmerge.c     | 11 ++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 0efdf3e..989a34f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,16 @@ AM_PROG_AR
 LT_INIT
 AC_SUBST([LIBTOOL_DEPS])
 
+headers='#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+'
+AC_CHECK_HEADERS([stddef.h unistd.h])
+AC_COMPILE_CHECK_SIZEOF([size_t], [${headers}])
+
 AC_CHECK_FUNCS_ONCE(m4_flatten([
           fmemopen
           scandirat

diff --git a/qmerge.c b/qmerge.c
index 143c4f3..36d3596 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -1191,8 +1191,17 @@ pkg_merge(int level, const depend_atom *atom, const 
struct pkg_t *pkg)
                                 * --long=xx where xx>27. The option is "safe" 
in the sense
                                 * that not more memory is allocated than what 
is really
                                 * needed to decompress the file. See
-                                * 
https://bugs.gentoo.org/show_bug.cgi?id=634980 */
+                                * 
https://bugs.gentoo.org/show_bug.cgi?id=634980,
+                                * however, on 32-bits arches this yields an 
parameter
+                                * out of bound error:
+                                * 
https://bugs.gentoo.org/show_bug.cgi?id=710444
+                                * 
https://bugs.gentoo.org/show_bug.cgi?id=754102
+                                * so only do this on 64-bits systems */
+#if SIZEOF_SIZE_T >= 8
                                compr = "zstd --long=31 -dc";
+#else
+                               compr = "zstd -dc";
+#endif
                                /* If really tar -I would be used we would have 
to quote:
                                 * compr = "I \"zstd --long=31\"";
                                 * But actually we use a pipe (see below) */

Reply via email to