[packages/powerman] - fix time_t printfs

baggins baggins at pld-linux.org
Wed Dec 31 02:20:37 CET 2025


commit 2aa5f0cdac18969a863d0febd21a34d7fc5eddd7
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Wed Dec 31 04:20:35 2025 +0100

    - fix time_t printfs

 powerman.spec |  2 ++
 time_t.patch  | 29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
---
diff --git a/powerman.spec b/powerman.spec
index 933df3d..338f854 100644
--- a/powerman.spec
+++ b/powerman.spec
@@ -16,6 +16,7 @@ Group:		Applications/System
 Source0:	https://github.com/chaos/powerman/releases/download/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	2995c10b1588186abc7bd7c6dd24f0f6
 Patch0:		lex.patch
+Patch1:		time_t.patch
 URL:		https://github.com/chaos/powerman
 BuildRequires:	bison
 BuildRequires:	curl-devel
@@ -94,6 +95,7 @@ Statyczna biblioteka PowerMan.
 %prep
 %setup -q
 %patch -P0 -p1
+%patch -P1 -p1
 
 %build
 %configure \
diff --git a/time_t.patch b/time_t.patch
new file mode 100644
index 0000000..642d81e
--- /dev/null
+++ b/time_t.patch
@@ -0,0 +1,29 @@
+From 8fbc1a13e34c656114c91ee6a51483b959e65039 Mon Sep 17 00:00:00 2001
+From: Boyuan Yang <byang at debian.org>
+Date: Thu, 12 Sep 2024 09:03:37 -0400
+Subject: [PATCH] device.c: Unconditionally cast tv_{sec,usec} to lld for
+ printf
+
+This would avoid build failure due to type mismatch on architecture where
+64-bit time_t and %ld printf formatter coexist and -Werror=format is enabled.
+
+This fixes #199.
+---
+ src/powerman/device.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/powerman/device.c b/src/powerman/device.c
+index 3cd6b422..b1938642 100644
+--- a/src/powerman/device.c
++++ b/src/powerman/device.c
+@@ -1332,8 +1332,8 @@ static bool _process_delay(Device *dev, Action *act, ExecCtx *e,
+     /* first time */
+     if (!e->processing) {
+         if (act->vpf_fun)
+-            act->vpf_fun(act->client_id, "delay(%s): %ld.%-6.6ld", dev->name,
+-                    delay.tv_sec, delay.tv_usec);
++            act->vpf_fun(act->client_id, "delay(%s): %lld.%-6.6lld", dev->name,
++                    (long long int)delay.tv_sec, (long long int)delay.tv_usec);
+         e->processing = true;
+         if (gettimeofday(&act->delay_start, NULL) < 0)
+             err_exit(true, "gettimeofday");
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/powerman.git/commitdiff/2aa5f0cdac18969a863d0febd21a34d7fc5eddd7



More information about the pld-cvs-commit mailing list