GNU bug report logs - #48788
[PATCH] gnu: libaio: Fix build with newer GCC versions.

Previous Next

Package: guix-patches;

Reported by: Jonathan Brielmaier <jonathan.brielmaier <at> web.de>

Date: Wed, 2 Jun 2021 10:02:01 UTC

Severity: normal

Tags: patch

Done: Jonathan Brielmaier <jonathan.brielmaier <at> web.de>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jonathan Brielmaier <jonathan.brielmaier <at> web.de>
To: guix-patches <at> gnu.org
Cc: Jonathan Brielmaier <jonathan.brielmaier <at> web.de>
Subject: [PATCH] gnu: libaio: Fix build with newer GCC versions.
Date: Wed,  2 Jun 2021 12:01:07 +0200
* gnu/packages/patches/libaio-fix-build.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/linux.scm (libaio): Use the patch.
---
 gnu/local.mk                                |  1 +
 gnu/packages/linux.scm                      |  1 +
 gnu/packages/patches/libaio-fix-build.patch | 46 +++++++++++++++++++++
 3 files changed, 48 insertions(+)
 create mode 100644 gnu/packages/patches/libaio-fix-build.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index d5a832146e..1e8dab8989 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1251,6 +1251,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/jfsutils-include-systypes.patch		\
   %D%/packages/patches/julia-SOURCE_DATE_EPOCH-mtime.patch	\
   %D%/packages/patches/kdbusaddons-kinit-file-name.patch	\
+  %D%/packages/patches/libaio-fix-build.patch	\
   %D%/packages/patches/libblockdev-glib-compat.patch		\
   %D%/packages/patches/libffi-3.3-powerpc-fixes.patch		\
   %D%/packages/patches/libffi-float128-powerpc64le.patch	\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index cf020a153b..427335c8d5 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4861,6 +4861,7 @@ Linux Device Mapper multipathing driver:
               (uri (list
                     (string-append "https://releases.pagure.org/libaio/"
                                    name "-" version ".tar.gz")))
+              (patches (search-patches "libaio-fix-build.patch"))
               (sha256
                (base32
                 "14mlqdapjqq1dhpkdgy5z83mvsaz36fcxca7a4z6hinmr7r6415b"))))
diff --git a/gnu/packages/patches/libaio-fix-build.patch b/gnu/packages/patches/libaio-fix-build.patch
new file mode 100644
index 0000000000..68b69a5fb2
--- /dev/null
+++ b/gnu/packages/patches/libaio-fix-build.patch
@@ -0,0 +1,46 @@
+From b9e17f6afdc4d0e81b1598aecea7b80d0c54b13a Mon Sep 17 00:00:00 2001
+From: Guillem Jover <guillem <at> hadrons.org>
+Date: Jul 29 2019 16:26:10 +0000
+Subject: harness: Use destination strncpy() expression for sizeof() argument
+
+
+Even though this is the same size, as the sizeof() is derived from the
+source expression, recent gcc versions will emit a warning, which is
+turned into an error by -Werror:
+
+  error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression
+    as the source; did you mean to use the size of the destination?
+    [-Werror=sizeof-pointer-memaccess]
+
+Signed-off-by: Guillem Jover <guillem <at> hadrons.org>
+Signed-off-by: Jeff Moyer <jmoyer <at> redhat.com>
+
+---
+
+diff --git a/harness/cases/19.t b/harness/cases/19.t
+index 4989510..5c3e0d6 100644
+--- a/harness/cases/19.t
++++ b/harness/cases/19.t
+@@ -41,7 +41,7 @@ open_temp_file(void)
+ 	int fd;
+ 	char template[sizeof(TEMPLATE)];
+
+-	strncpy(template, TEMPLATE, sizeof(TEMPLATE));
++	strncpy(template, TEMPLATE, sizeof(template));
+ 	fd = mkostemp(template, O_DIRECT);
+ 	if (fd < 0) {
+ 		perror("mkstemp");
+diff --git a/harness/cases/21.t b/harness/cases/21.t
+index 441eaa8..fe33a9d 100644
+--- a/harness/cases/21.t
++++ b/harness/cases/21.t
+@@ -43,7 +43,7 @@ open_temp_file()
+ 	int fd;
+ 	char temp_file[sizeof(TEMPLATE)];
+
+-	strncpy(temp_file, TEMPLATE, sizeof(TEMPLATE));
++	strncpy(temp_file, TEMPLATE, sizeof(temp_file));
+ 	fd = mkstemp(temp_file);
+ 	if (fd < 0) {
+ 		perror("mkstemp");
+
--
2.31.1





This bug report was last modified 3 years and 314 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.