All of lore.kernel.org
 help / color / mirror / Atom feed
* [yocto][meta-gplv2][PATCH 1/2] diffutils: fix build with 64bit time_t on 32bit arches
@ 2020-01-08 15:07 Andr? Draszik
  2020-01-08 15:07 ` [yocto][meta-gplv2][PATCH 2/2] diffutils: musl has working malloc() and realloc() Andr? Draszik
  0 siblings, 1 reply; 2+ messages in thread
From: Andr? Draszik @ 2020-01-08 15:07 UTC (permalink / raw)
  To: yocto

See included patch.

Signed-off-by: André Draszik <git@andred.net>
---
 ...ilation-with-64bit-time_t-on-32bit-a.patch | 46 +++++++++++++++++++
 recipes-extended/diffutils/diffutils_2.8.1.bb |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 recipes-extended/diffutils/diffutils-2.8.1/0003-context-fix-compilation-with-64bit-time_t-on-32bit-a.patch

diff --git a/recipes-extended/diffutils/diffutils-2.8.1/0003-context-fix-compilation-with-64bit-time_t-on-32bit-a.patch b/recipes-extended/diffutils/diffutils-2.8.1/0003-context-fix-compilation-with-64bit-time_t-on-32bit-a.patch
new file mode 100644
index 0000000..a8fcde0
--- /dev/null
+++ b/recipes-extended/diffutils/diffutils-2.8.1/0003-context-fix-compilation-with-64bit-time_t-on-32bit-a.patch
@@ -0,0 +1,46 @@
+From 07c75310fecbaec62a24a3ee98b4209e1bf9ff62 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net>
+Date: Mon, 6 Jan 2020 13:31:50 +0000
+Subject: [PATCH] context: fix compilation with 64bit time_t on 32bit arches
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In file included from ../../diffutils-2.8.1/src/diff.h:23,
+                 from ../../diffutils-2.8.1/src/context.c:23:
+../../diffutils-2.8.1/src/context.c: In function 'print_context_label':
+../../diffutils-2.8.1/src/system.h:41:52: error: size of array 'a' is negative
+   41 | #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
+      |                                                    ^
+../../diffutils-2.8.1/src/context.c:65:4: note: in expansion of macro 'verify'
+   65 |    verify (info_preserved, sizeof inf->stat.st_mtime <= sizeof sec);
+      |    ^~~~~~
+
+struct stat::st_mtime is a time_t and will not fit into a
+long (when 64bit time_t has been requested on a 32bit machine).
+
+Signed-off-by: André Draszik <git@andred.net>
+Upstream-Status: Inappropriate [fixing an old version]
+---
+ src/context.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/context.c b/src/context.c
+index 18d7023..d41efde 100644
+--- a/src/context.c
++++ b/src/context.c
+@@ -61,9 +61,9 @@ print_context_label (char const *mark,
+       int nsec = TIMESPEC_NS (inf->stat.st_mtim);
+       if (! (tm && nstrftime (buf, sizeof buf, time_format, tm, 0, nsec)))
+ 	{
+-	  long sec = inf->stat.st_mtime;
++	  time_t sec = inf->stat.st_mtime;
+ 	  verify (info_preserved, sizeof inf->stat.st_mtime <= sizeof sec);
+-	  sprintf (buf, "%ld.%.9d", sec, nsec);
++	  sprintf (buf, "%lld.%.9d", (long long) sec, nsec);
+ 	}
+       fprintf (outfile, "%s %s\t%s\n", mark, inf->name, buf);
+     }
+-- 
+2.23.0.rc1
+
diff --git a/recipes-extended/diffutils/diffutils_2.8.1.bb b/recipes-extended/diffutils/diffutils_2.8.1.bb
index 5a71c94..4aad28f 100644
--- a/recipes-extended/diffutils/diffutils_2.8.1.bb
+++ b/recipes-extended/diffutils/diffutils_2.8.1.bb
@@ -10,6 +10,7 @@ SRC_URI = "${GNU_MIRROR}/diffutils/diffutils-${PV}.tar.gz \
            file://fix_gcc6.patch \
            file://0001-Make-it-build-with-compile-time-hardening-enabled.patch \
            file://0002-included-libc-use-mempcpy-instead-of.patch \
+           file://0003-context-fix-compilation-with-64bit-time_t-on-32bit-a.patch \
            "
 
 SRC_URI[md5sum] = "71f9c5ae19b60608f6c7f162da86a428"
-- 
2.23.0.rc1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [yocto][meta-gplv2][PATCH 2/2] diffutils: musl has working malloc() and realloc()
  2020-01-08 15:07 [yocto][meta-gplv2][PATCH 1/2] diffutils: fix build with 64bit time_t on 32bit arches Andr? Draszik
@ 2020-01-08 15:07 ` Andr? Draszik
  0 siblings, 0 replies; 2+ messages in thread
From: Andr? Draszik @ 2020-01-08 15:07 UTC (permalink / raw)
  To: yocto

diffutils tries to run a test program to determine if
malloc() and realloc() work, i.e. whether they fail if
given 0 for size. running a test program doesn't work
when cross-compiling, so it defaults to assuming non-
working malloc() / realloc()

Given they work correctly in musl, we can specify the
test-result, and avoid having to use diffutil's
replacement functions.

Signed-off-by: André Draszik <git@andred.net>
---
 recipes-extended/diffutils/diffutils_2.8.1.bb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/recipes-extended/diffutils/diffutils_2.8.1.bb b/recipes-extended/diffutils/diffutils_2.8.1.bb
index 4aad28f..fc4dfd9 100644
--- a/recipes-extended/diffutils/diffutils_2.8.1.bb
+++ b/recipes-extended/diffutils/diffutils_2.8.1.bb
@@ -16,6 +16,11 @@ SRC_URI = "${GNU_MIRROR}/diffutils/diffutils-${PV}.tar.gz \
 SRC_URI[md5sum] = "71f9c5ae19b60608f6c7f162da86a428"
 SRC_URI[sha256sum] = "c5001748b069224dd98bf1bb9ee877321c7de8b332c8aad5af3e2a7372d23f5a"
 
+EXTRA_OECONF_libc-musl = "\
+    jm_cv_func_working_malloc=yes \
+    jm_cv_func_working_realloc=yes \
+"
+
 do_configure_prepend () {
 	chmod u+w ${S}/po/Makefile.in.in
 }
-- 
2.23.0.rc1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-08 15:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 15:07 [yocto][meta-gplv2][PATCH 1/2] diffutils: fix build with 64bit time_t on 32bit arches Andr? Draszik
2020-01-08 15:07 ` [yocto][meta-gplv2][PATCH 2/2] diffutils: musl has working malloc() and realloc() Andr? Draszik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.