summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Siegumfeldt <mns@gomspace.com>2024-12-11 07:42:18 +0100
committerKhem Raj <raj.khem@gmail.com>2024-12-11 09:56:51 -0800
commit28ba66a2a417e7b95529eef7ace4b50d3659ac35 (patch)
treea765462484898dca6c90d67018f21c13cf846e23
parent1f4b413ebe623810007d430a73cc6f8a26c8f578 (diff)
downloadmeta-openembedded-28ba66a2a417e7b95529eef7ace4b50d3659ac35.tar.gz
pps-tools: backport a patch to fix prints
Patch reported issue observed on ARM32 based HW during bump from Langdale to Scarthgap Signed-off-by: Martin Siegumfeldt <mns@gomspace.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-support/pps-tools/pps-tools/0001-Use-lld-in-printf-for-64-bit-time_t.patch59
-rw-r--r--meta-oe/recipes-support/pps-tools/pps-tools_1.0.3.bb4
2 files changed, 62 insertions, 1 deletions
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 0000000000..058217d68d
--- /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 @@
1From 6faed0a3b41fba4619fe4598a2834dfb4d2be7e4 Mon Sep 17 00:00:00 2001
2From: Matt Merhar <mattmerhar@protonmail.com>
3Date: Fri, 10 Nov 2023 17:21:51 -0500
4Subject: [PATCH] Use %lld in printf for 64-bit time_t
5
6musl 1.2.0 switched to use 64-bit time_t everywhere, including 32-bit
7architectures, causing garbage values to be printed from ppswatch and
8ppstest.
9
10Use the correct format string for the affected printf statements and
11explicitly cast to long long to avoid potential compatibility issues
12with 32-bit glibc.
13
14Upstream-Status: Backport [https://github.com/redlab-i/pps-tools/commit/6faed0a3b41fba4619fe4598a2834dfb4d2be7e4]
15
16Signed-off-by: Matt Merhar <mattmerhar@protonmail.com>
17---
18 ppstest.c | 8 ++++----
19 ppswatch.c | 2 +-
20 2 files changed, 5 insertions(+), 5 deletions(-)
21
22diff --git a/ppstest.c b/ppstest.c
23index 0370794..c375a09 100644
24--- a/ppstest.c
25+++ b/ppstest.c
26@@ -110,13 +110,13 @@ retry:
27 }
28
29 printf("source %d - "
30- "assert %ld.%09ld, sequence: %ld - "
31- "clear %ld.%09ld, sequence: %ld\n",
32+ "assert %lld.%09ld, sequence: %ld - "
33+ "clear %lld.%09ld, sequence: %ld\n",
34 i,
35- infobuf.assert_timestamp.tv_sec,
36+ (long long)infobuf.assert_timestamp.tv_sec,
37 infobuf.assert_timestamp.tv_nsec,
38 infobuf.assert_sequence,
39- infobuf.clear_timestamp.tv_sec,
40+ (long long)infobuf.clear_timestamp.tv_sec,
41 infobuf.clear_timestamp.tv_nsec, infobuf.clear_sequence);
42 fflush(stdout);
43
44diff --git a/ppswatch.c b/ppswatch.c
45index 5c6202b..15d7a77 100644
46--- a/ppswatch.c
47+++ b/ppswatch.c
48@@ -148,7 +148,7 @@ int fetch_source(pps_handle_t handle, int avail_mode)
49 if (max_divergence < div)
50 max_divergence = div;
51 if (div >= margin) {
52- printf("timestamp: %ld, sequence: %ld, offset: % 6ld\n", ts.tv_sec, seq, ts.tv_nsec);
53+ printf("timestamp: %lld, sequence: %ld, offset: % 6ld\n", (long long)ts.tv_sec, seq, ts.tv_nsec);
54 fflush(stdout);
55 overflows++;
56 curr_unsync++;
57--
582.47.1
59
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 65c06c1bd5..34b4bbf75a 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"
5LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" 5LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
6 6
7SRCREV = "c50cb7183e252b47308fa22f420e0a877277aa29" 7SRCREV = "c50cb7183e252b47308fa22f420e0a877277aa29"
8SRC_URI = "git://github.com/ago/pps-tools.git;branch=master;protocol=https" 8SRC_URI = "git://github.com/ago/pps-tools.git;branch=master;protocol=https \
9 file://0001-Use-lld-in-printf-for-64-bit-time_t.patch \
10 "
9 11
10S = "${WORKDIR}/git" 12S = "${WORKDIR}/git"
11 13