Back-port small python year/date range fix for RHEL 9.5
Resolves: RHEL-25543
This commit is contained in:
parent
2f0b5967c9
commit
ca85c78730
6
pcp.spec
6
pcp.spec
@ -1,6 +1,6 @@
|
||||
Name: pcp
|
||||
Version: 6.2.0
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: System-level performance monitoring and performance management
|
||||
License: GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
|
||||
URL: https://pcp.io
|
||||
@ -8,6 +8,7 @@ URL: https://pcp.io
|
||||
Source0: https://github.com/performancecopilot/pcp/releases/pcp-%{version}.src.tar.gz
|
||||
|
||||
Patch1: redhat-issues-RHEL-2317-default-archive-version.patch
|
||||
Patch2: redhat-issues-RHEL-25543-python-year-day-range.patch
|
||||
|
||||
%if 0%{?fedora} >= 40 || 0%{?rhel} >= 10
|
||||
ExcludeArch: %{ix86}
|
||||
@ -3492,6 +3493,9 @@ fi
|
||||
%files zeroconf -f pcp-zeroconf-files.rpm
|
||||
|
||||
%changelog
|
||||
* Wed Mar 20 2024 Nathan Scott <nathans@redhat.com> - 6.2.0-2
|
||||
- Fix python sub-package year day range issue (RHEL-25543)
|
||||
|
||||
* Mon Feb 12 2024 Nathan Scott <nathans@redhat.com> - 6.2.0-1
|
||||
- Rebase to latest stable version of PCP (RHEL-2317)
|
||||
|
||||
|
35
redhat-issues-RHEL-25543-python-year-day-range.patch
Normal file
35
redhat-issues-RHEL-25543-python-year-day-range.patch
Normal file
@ -0,0 +1,35 @@
|
||||
commit ce6112399ebf0ff39069a34bc9286242c875555e
|
||||
Author: adam kaminski <adam@adamkaminski.com>
|
||||
Date: Fri Feb 9 12:49:34 2024 -0500
|
||||
|
||||
pmapi.py : fix for struct_time() and day of year out of range on yyyy-01-01
|
||||
|
||||
Fix for `day of year out of range` on 2024-01-01, due to self.tm_yday - 1, which returns `[2024, 1, 1, 2, 3, 0, 0, -1, 0]`. The range for tm_yday should be [1, 366].
|
||||
|
||||
# timedatectl set-ntp false
|
||||
# timedatectl set-time "2024-01-01 00:00:00"
|
||||
# /usr/libexec/pcp/bin/pcp-mpstat -P ALL -t 1 -s 2
|
||||
Traceback (most recent call last):
|
||||
File "/usr/libexec/pcp/bin/pcp-mpstat", line 653, in <module>
|
||||
sts = manager.run()
|
||||
File "/usr/lib64/python3.6/site-packages/pcp/pmcc.py", line 687, in run
|
||||
self._printer.report(self)
|
||||
File "/usr/libexec/pcp/bin/pcp-mpstat", line 606, in report
|
||||
self.print_machine_info(group, manager)
|
||||
File "/usr/libexec/pcp/bin/pcp-mpstat", line 585, in print_machine_info
|
||||
time_string = time.strftime("%x", timestamp.struct_time())
|
||||
ValueError: day of year out of range
|
||||
|
||||
diff --git a/src/python/pcp/pmapi.py b/src/python/pcp/pmapi.py
|
||||
index fd8d40e32c..05c8afb079 100644
|
||||
--- a/src/python/pcp/pmapi.py
|
||||
+++ b/src/python/pcp/pmapi.py
|
||||
@@ -330,7 +330,7 @@ class tm(Structure):
|
||||
pywday = 6
|
||||
stlist = [self.tm_year + 1900, self.tm_mon + 1, self.tm_mday,
|
||||
self.tm_hour, self.tm_min, self.tm_sec,
|
||||
- pywday, self.tm_yday - 1, self.tm_isdst]
|
||||
+ pywday, self.tm_yday + 1, self.tm_isdst]
|
||||
return time.struct_time(stlist)
|
||||
|
||||
def __str__(self):
|
Loading…
Reference in New Issue
Block a user