Package: ipmitool
Version: 1.8.19-10.1
Severity: minor
File: /usr/bin/ipmitool
Tags: upstream fixed-upstream patch

Dear Maintainer,

In verbose SEL output (sel get, sel elist -v) the Timestamp field shows the
same value twice instead of "<date> <time>".

Steps:
$ ipmitool -I lanplus -H <bmc> -U <user> -E -L USER sel get 0x0018 |
grep Timestamp
Timestamp : 19:22:05 UTC 19:22:05 UTC

$ ipmitool -I lanplus -H <bmc> -U <user> -E -L USER -v sel elist |
grep -m3 Timestamp
Timestamp : 21:15:31 UTC 21:15:31 UTC
Timestamp : 12:04:50 UTC 12:04:50 UTC
Timestamp : 12:05:06 UTC 12:05:06 UTC

Expected:
Timestamp : MM/DD/YY HH:MM:SS UTC (date followed by time)

"sel elist" and "-c sel elist" print the correct date and time.

Cause: ipmi_timestamp_date() and ipmi_timestamp_time() return the same static
buffer (ipmi_timestamp_fmt() in lib/ipmi_time.c). lib/ipmi_sel.c called both
inside one printf(), so only the last-evaluated result survives. Which one
survives depends on the compiler's argument evaluation order, so the symptom
differs between builds (date twice on some, time twice on others).

Fixed upstream on master: commit 01c572b911035726526b9bfe685031f2bf925130
(sel: Fix date/time output of timestamps for 'sel get'),
https://codeberg.org/IPMITool/ipmitool/commit/01c572b911035726526b9bfe685031f2bf925130
where the two calls are in separate printf() statements. Upstream has not
tagged a release since 1.8.19 (2022-09-01).

The problem was introduced upstream in f0d5c17 (2018-07-26, "Refactor
timestamp handling") and is present in all 1.8.19 builds. The fix is a
9-line change in lib/ipmi_sel.c only (patch attached).

Could the fix be cherry-picked into the Debian package?


-- System Information:
Debian Release: forky/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: arm64 (aarch64)

Kernel: Linux 7.1.3-200.fc44.aarch64 (SMP w/5 CPU threads; PREEMPT)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Versions of packages ipmitool depends on:
ii libc6 2.43-7
ii libfreeipmi17 1.6.20-1
ii libreadline8t64 8.3-4
ii libssl3t64 3.6.5-1

Versions of packages ipmitool recommends:
ii openipmi 2.0.37-1+b1

ipmitool suggests no packages.

-- no debconf information

-- 


*-----------------------------------------------------------------------------------------*

*This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you have received this email in error, please notify the 
system manager. This message contains confidential information and is 
intended only for the individual named. If you are not the named addressee, 
you should not disseminate, distribute or copy this email. Please notify 
the sender immediately by email if you have received this email by mistake 
and delete this email from your system. If you are not the intended 
recipient, you are notified that disclosing, copying, distributing or 
taking any action in reliance on the contents of this information is 
strictly prohibited.*****

 ****

*Any views or opinions presented in this 
email are solely those of the author and do not necessarily represent those 
of the organization. Any information on shares, debentures or similar 
instruments, recommended product pricing, valuations and the like are for 
information purposes only. It is not meant to be an instruction or 
recommendation, as the case may be, to buy or to sell securities, products, 
services nor an offer to buy or sell securities, products or services 
unless specifically stated to be so on behalf of the Flipkart group. 
Employees of the Flipkart group of companies are expressly required not to 
make defamatory statements and not to infringe or authorise any 
infringement of copyright or any other legal right by email communications. 
Any such communication is contrary to organizational policy and outside the 
scope of the employment of the individual concerned. The organization will 
not accept any liability in respect of such communication, and the employee 
responsible will be personally liable for any damages or other liability 
arising.*****

 ****

*Our organization accepts no liability for the 
content of this email, or for the consequences of any actions taken on the 
basis of the information *provided,* unless that information is 
subsequently confirmed in writing. If you are not the intended recipient, 
you are notified that disclosing, copying, distributing or taking any 
action in reliance on the contents of this information is strictly 
prohibited.*

_-----------------------------------------------------------------------------------------_
From 01c572b911035726526b9bfe685031f2bf925130 Mon Sep 17 00:00:00 2001
From: Dalton Durst <[email protected]>
Date: Thu, 10 Oct 2024 14:53:39 -0500
Subject: [PATCH] sel: Fix date/time output of timestamps for 'sel get'

Both ipmi_timestamp_date and ipmi_timestamp_time call ipmi_timestamp_fmt
which overwrites the static buffer datebuf. Therefore %s simply output
the same thing twice.

Before:
 Timestamp             : 10/08/2024 10/08/2024
After:
 Timestamp             : 10/08/2024 10:46:55 AM PDT

Signed-off-by: Dalton Durst <[email protected]>
---
 lib/ipmi_sel.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/ipmi_sel.c b/lib/ipmi_sel.c
index 9a97af3..482d460 100644
--- a/lib/ipmi_sel.c
+++ b/lib/ipmi_sel.c
@@ -2042,13 +2042,13 @@ ipmi_sel_print_std_entry_verbose(struct ipmi_intf * intf, struct sel_event_recor
 	if (evt->record_type < 0xe0)
 	{
 		printf(" Timestamp             : ");
-		if (evt->record_type < 0xc0)
-			printf("%s %s", ipmi_timestamp_date(evt->sel_type.standard_type.timestamp),
-				ipmi_timestamp_time(evt->sel_type.standard_type.timestamp));
-		else
-			printf("%s %s", ipmi_timestamp_date(evt->sel_type.oem_ts_type.timestamp),
-				ipmi_timestamp_time(evt->sel_type.oem_ts_type.timestamp));
-		printf("\n");
+		if (evt->record_type < 0xc0) {
+			printf("%s ", ipmi_timestamp_date(evt->sel_type.standard_type.timestamp));
+			printf("%s\n", ipmi_timestamp_time(evt->sel_type.standard_type.timestamp));
+		} else {
+			printf("%s ", ipmi_timestamp_date(evt->sel_type.oem_ts_type.timestamp));
+			printf("%s\n", ipmi_timestamp_time(evt->sel_type.oem_ts_type.timestamp));
+		}
 	}
 
 	if (evt->record_type >= 0xc0)
@@ -2133,8 +2133,8 @@ ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_
 	if (evt->record_type < 0xe0)
 	{
 		printf(" Timestamp             : ");
-		printf("%s %s\n", ipmi_timestamp_date(evt->sel_type.standard_type.timestamp),
-		ipmi_timestamp_time(evt->sel_type.standard_type.timestamp));
+		printf("%s ", ipmi_timestamp_date(evt->sel_type.standard_type.timestamp));
+		printf("%s\n", ipmi_timestamp_time(evt->sel_type.standard_type.timestamp));
 	}
 
 
-- 
2.50.1 (Apple Git-155)

Reply via email to