Patch reported issue observed on ARM32 based HW during bump
from Langdale to Scarthgap

Signed-off-by: Martin Siegumfeldt <m...@gomspace.com>
---
 ...-Use-lld-in-printf-for-64-bit-time_t.patch | 59 +++++++++++++++++++
 .../pps-tools/pps-tools_1.0.3.bb              |  4 +-
 2 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 
meta-oe/recipes-support/pps-tools/pps-tools/0001-Use-lld-in-printf-for-64-bit-time_t.patch

diff --git 
a/meta-oe/recipes-support/pps-tools/pps-tools/0001-Use-lld-in-printf-for-64-bit-time_t.patch
 
b/meta-oe/recipes-support/pps-tools/pps-tools/0001-Use-lld-in-printf-for-64-bit-time_t.patch
new file mode 100644
index 000000000..058217d68
--- /dev/null
+++ 
b/meta-oe/recipes-support/pps-tools/pps-tools/0001-Use-lld-in-printf-for-64-bit-time_t.patch
@@ -0,0 +1,59 @@
+From 6faed0a3b41fba4619fe4598a2834dfb4d2be7e4 Mon Sep 17 00:00:00 2001
+From: Matt Merhar <mattmer...@protonmail.com>
+Date: Fri, 10 Nov 2023 17:21:51 -0500
+Subject: [PATCH] Use %lld in printf for 64-bit time_t
+
+musl 1.2.0 switched to use 64-bit time_t everywhere, including 32-bit
+architectures, causing garbage values to be printed from ppswatch and
+ppstest.
+
+Use the correct format string for the affected printf statements and
+explicitly cast to long long to avoid potential compatibility issues
+with 32-bit glibc.
+
+Upstream-Status: Backport 
[https://github.com/redlab-i/pps-tools/commit/6faed0a3b41fba4619fe4598a2834dfb4d2be7e4]
+
+Signed-off-by: Matt Merhar <mattmer...@protonmail.com>
+---
+ ppstest.c  | 8 ++++----
+ ppswatch.c | 2 +-
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/ppstest.c b/ppstest.c
+index 0370794..c375a09 100644
+--- a/ppstest.c
++++ b/ppstest.c
+@@ -110,13 +110,13 @@ retry:
+       }
+ 
+       printf("source %d - "
+-             "assert %ld.%09ld, sequence: %ld - "
+-             "clear  %ld.%09ld, sequence: %ld\n",
++             "assert %lld.%09ld, sequence: %ld - "
++             "clear  %lld.%09ld, sequence: %ld\n",
+              i,
+-             infobuf.assert_timestamp.tv_sec,
++             (long long)infobuf.assert_timestamp.tv_sec,
+              infobuf.assert_timestamp.tv_nsec,
+              infobuf.assert_sequence,
+-             infobuf.clear_timestamp.tv_sec,
++             (long long)infobuf.clear_timestamp.tv_sec,
+              infobuf.clear_timestamp.tv_nsec, infobuf.clear_sequence);
+       fflush(stdout);
+ 
+diff --git a/ppswatch.c b/ppswatch.c
+index 5c6202b..15d7a77 100644
+--- a/ppswatch.c
++++ b/ppswatch.c
+@@ -148,7 +148,7 @@ int fetch_source(pps_handle_t handle, int avail_mode)
+       if (max_divergence < div)
+               max_divergence = div;
+       if (div >= margin) {
+-              printf("timestamp: %ld, sequence: %ld, offset: % 6ld\n", 
ts.tv_sec, seq, ts.tv_nsec);
++              printf("timestamp: %lld, sequence: %ld, offset: % 6ld\n", (long 
long)ts.tv_sec, seq, ts.tv_nsec);
+               fflush(stdout);
+               overflows++;
+               curr_unsync++;
+-- 
+2.47.1
+
diff --git a/meta-oe/recipes-support/pps-tools/pps-tools_1.0.3.bb 
b/meta-oe/recipes-support/pps-tools/pps-tools_1.0.3.bb
index 65c06c1bd..34b4bbf75 100644
--- a/meta-oe/recipes-support/pps-tools/pps-tools_1.0.3.bb
+++ b/meta-oe/recipes-support/pps-tools/pps-tools_1.0.3.bb
@@ -5,7 +5,9 @@ LICENSE = "GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
 
 SRCREV = "c50cb7183e252b47308fa22f420e0a877277aa29"
-SRC_URI = "git://github.com/ago/pps-tools.git;branch=master;protocol=https"
+SRC_URI = "git://github.com/ago/pps-tools.git;branch=master;protocol=https \
+           file://0001-Use-lld-in-printf-for-64-bit-time_t.patch \
+           "
 
 S = "${WORKDIR}/git"
 
-- 
2.43.2


________________________
This email was scanned by Bitdefender
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#114379): 
https://lists.openembedded.org/g/openembedded-devel/message/114379
Mute This Topic: https://lists.openembedded.org/mt/110194254/21656
Group Owner: openembedded-devel+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to