import python-dmidecode-3.12.3-2.el8

This commit is contained in:
CentOS Sources 2023-05-16 06:18:25 +00:00 committed by root
parent ea5a994424
commit a6500f716d
6 changed files with 112 additions and 81 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/python-dmidecode-3.12.2.tar.gz
SOURCES/python-dmidecode-3.12.3.tar.gz

View File

@ -1 +1 @@
7ca7536e340b4ffc92b41536bbfa44908f77732f SOURCES/python-dmidecode-3.12.2.tar.gz
f06f73840beba1575ff0109c23a9de0e7b8ab21f SOURCES/python-dmidecode-3.12.3.tar.gz

View File

@ -0,0 +1,26 @@
From c217e2bd9dfbd23c04dac19759a2d59845fcd6f6 Mon Sep 17 00:00:00 2001
From: Lichen Liu <lichliu@redhat.com>
Date: Mon, 6 Feb 2023 14:46:47 +0800
Subject: [PATCH] Fix dmi_cache_size_2 will add unit twice.
Signed-off-by: Lichen Liu <lichliu@redhat.com>
---
src/dmidecode.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/dmidecode.c b/src/dmidecode.c
index d1a10c1..d40f0ee 100644
--- a/src/dmidecode.c
+++ b/src/dmidecode.c
@@ -1843,8 +1843,6 @@ void dmi_cache_size_2(xmlNode *node, const char *tagname, u32 code)
size.l = code << 6;
size.h = code >> 26;
} else {
- dmixml_AddAttribute(caches_n, "unit", "KB");
- dmixml_AddTextContent(caches_n, "%i", code);
size.l = code;
size.h = 0;
}
--
2.39.1

View File

@ -1,63 +0,0 @@
From 4e29e6d5687cf25ac16e48ad41498526e6a56ca8 Mon Sep 17 00:00:00 2001
From: Lianbo Jiang <lijiang@redhat.com>
Date: Sun, 28 Apr 2019 14:06:59 +0800
Subject: [PATCH] Fix memory type detail map size
Note: (https://github.com/nima/python-dmidecode/pull/5/commits/
edca64c89d084a8c42b9c48a51eb5ac13eac52c6)
For index and array size in xml map, bit mapped type descriptions
array size must be kept coerent with bit mask otherwise it could
cause an error, e.g:
Python 3.6.8 (default, Apr 3 2019, 12:10:30)
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dmidecode
>>> dmidecode.memory()
IndexError: list assignment index out of range
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: <built-in function memory> returned a result with an error set
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
src/dmidecode.c | 4 ++--
src/pymap.xml | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/dmidecode.c b/src/dmidecode.c
index 0615bad315fb..d74a374a3a0f 100644
--- a/src/dmidecode.c
+++ b/src/dmidecode.c
@@ -2905,9 +2905,9 @@ void dmi_memory_device_type_detail(xmlNode *node, u16 code)
dmixml_AddAttribute(data_n, "dmispec", "7.18.3");
dmixml_AddAttribute(data_n, "flags", "0x%04x", code);
- if((code & 0x1FFE) != 0) {
+ if((code & 0xFFFE) != 0) {
int i;
- for(i = 1; i <= 14; i++) {
+ for(i = 1; i <= 15; i++) {
if(code & (1 << i)) {
xmlNode *td_n = dmixml_AddTextChild(data_n, "flag", "%s", detail[i - 1]);
assert( td_n != NULL );
diff --git a/src/pymap.xml b/src/pymap.xml
index 7d5de70bda65..7325a8527018 100644
--- a/src/pymap.xml
+++ b/src/pymap.xml
@@ -440,7 +440,7 @@
valuetype="string" value="concat(TotalWidth, ' ', TotalWidth/@unit)"/>
<Map keytype="constant" key="AssetTag" valuetype="string" value="AssetTag"/>
<Map keytype="constant" key="Type Detail" valuetype="list:string" value="TypeDetails/flag"
- fixedsize="12" index_attr="index"/>
+ fixedsize="15" index_attr="index"/>
<Map keytype="constant" key="Array Handle" valuetype="string" value="@ArrayHandle"/>
<Map keytype="constant" key="Form Factor" valuetype="string" value="FormFactor"/>
<Map keytype="constant" key="Size"
--
2.17.1

View File

@ -0,0 +1,59 @@
From 5643ecc7530489bf0875c4fe96031671b3cda435 Mon Sep 17 00:00:00 2001
From: Lichen Liu <lichliu@redhat.com>
Date: Fri, 17 Feb 2023 11:09:05 +0800
Subject: [PATCH] Fix wrong DMI structures count
SMBIOS v3 64-bit entry points do not announce a structures count,
and only indicate a maximum size for the table.
Remove debug log.
Signed-off-by: Lichen Liu <lichliu@redhat.com>
---
src/dmidecode.c | 10 +++++++---
src/efi.c | 4 ----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/dmidecode.c b/src/dmidecode.c
index d1a10c1..a013c53 100644
--- a/src/dmidecode.c
+++ b/src/dmidecode.c
@@ -6241,13 +6241,17 @@ static void dmi_table(Log_t *logp, int type, u32 base, u32 len, u16 num, u32 ver
dmixml_AddAttribute(handle_n, "type", "%i", type);
dmixml_AddAttribute(handle_n, "notfound", "1");
}
-
- if(i != num) {
+ /*
+ * SMBIOS v3 64-bit entry points do not announce a structures count,
+ * and only indicate a maximum size for the table.
+ */
+ if(num && i != num) {
log_append(logp, LOGFL_NODUPS, LOG_WARNING,
"Wrong DMI structures count: %d announced, only %d decoded.", num, i);
}
- if(data - buf != len) {
+ if((unsigned long)(data - buf) > len
+ || (num && (unsigned long)(data - buf) < len)) {
log_append(logp, LOGFL_NODUPS, LOG_WARNING,
"Wrong DMI structures length: %d bytes announced, structures occupy %d bytes.",
len, (unsigned int)(data - buf));
diff --git a/src/efi.c b/src/efi.c
index e519257..362e2f9 100644
--- a/src/efi.c
+++ b/src/efi.c
@@ -83,10 +83,6 @@ int address_from_efi(Log_t *logp, size_t * address)
log_append(logp, LOGFL_NODUPS, LOG_WARNING, "%s: SMBIOS entry point missing", filename);
}
- if(ret == 0){
- log_append(logp, LOGFL_NODUPS, LOG_DEBUG, "%s: entry point at 0x%08llx", eptype, (unsigned long long)*address);
- }
-
return ret;
}
--
2.39.1

View File

@ -1,12 +1,16 @@
Name: python-dmidecode
Summary: Python module to access DMI data
Version: 3.12.2
Release: 15%{?dist}
Version: 3.12.3
Release: 2%{?dist}
License: GPLv2
Group: System Environment/Libraries
URL: http://projects.autonomy.net.au/python-dmidecode/
Source0: https://fedorahosted.org/releases/p/y/%{name}/%{name}-%{version}.tar.gz
URL: https://github.com/nima/python-dmidecode
Source0: https://github.com/nima/python-dmidecode/archive/refs/tags/%{name}-%{version}.tar.gz
Patch0: 0001-Fix-dmi_cache_size_2-will-add-unit-twice.patch
Patch1: 0002-Fix-wrong-DMI-structures-count.patch
BuildRequires: make
BuildRequires: gcc
BuildRequires: libxml2-devel
BuildRequires: python3-devel
@ -26,8 +30,6 @@ Summary: Python 3 module to access DMI data
Requires: libxml2-python3
ExclusiveArch: x86_64
Patch0: 0001-Fix-memory-type-detail-map-size.patch
%description -n python3-dmidecode
python3-dmidecode is a Python 3 extension module that uses the
code-base of the 'dmidecode' utility, and presents the data
@ -36,24 +38,24 @@ as Python 3 data structures or as XML data using libxml2.
%prep
%setup -q
%patch0 -p1
%autosetup -p1
%build
# Not to get undefined symbol: dmixml_GetContent
export CFLAGS="${CFLAGS-} -std=gnu89"
make build PY_BIN=%{__python3}
# -std=gnu89 is there to avoid `undefined symbol: dmixml_GetContent`
export PYTHON_BIN=%{__python3}
export PYTHON_VERSION=%{python3_version}
export CFLAGS="%{build_cflags} -std=gnu89"
export CC=gcc
%make_build
%install
%{__python3} src/setup.py install --root %{buildroot} --prefix=%{_prefix}
%check
pushd unit-tests
make PY_BIN=%{__python3}
popd
export PYTHONPATH=%{buildroot}%{python3_sitearch}
export PYTHON_BIN=%{__python3}
make -C unit-tests
%files -n python3-dmidecode
@ -66,6 +68,13 @@ popd
%{_datadir}/python-dmidecode/
%changelog
* Fri Feb 17 2023 Lichen Liu <lichliu@redhat.com> - 3.12.3-2
- Resolves: rhbz#2103911
* Tue Feb 07 2023 Lichen Liu <lichliu@redhat.com> - 3.12.3-1
- Resolves: rhbz#2070727
- Resolves: rhbz#2103911
* Wed May 08 2019 Lianbo Jiang <lijiang@redhat.com> - 3.12.2-15
- Fix an index out of range when calling dmidecode.memory().
- Resolves: #1665443