import CS libvpd-2.2.9-2.el9

This commit is contained in:
eabdullin 2024-04-05 10:11:18 +00:00
parent 1556180dde
commit 4622395268
2 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,40 @@
commit 34ab92ebc818bc5b356f1d297868512225493eca
Author: Sathvika Vasireddy <sv@linux.ibm.com>
Date: Thu Nov 9 02:37:36 2023 +0530
libvpd: Prevent adding duplicate entries in addDeviceSpecific() function
Currently, addDeviceSpecific() adds new 'DataItem' to the
'mDeviceSpecific' vector without checking for duplicates. This
vector can be further used by the front end tools to list vpd
information. If this vector has duplicate entries, then vpd
information for a specific device is listed more than once.
To fix this, prevent duplicate entries with the same 'ac' value
from being stored in the vector. Check if a 'DataItem' with
the same ac value already exists in the vector, and add the new
object to the vector only if no matching item is found.
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
diff --git a/src/component.cpp b/src/component.cpp
index 44208ac..a945fc1 100644
--- a/src/component.cpp
+++ b/src/component.cpp
@@ -937,7 +937,6 @@ lderr:
d->ac = ac;
d->humanName = humanName;
d->setValue( val, lvl, __FILE__, __LINE__ );
-#if 0
/*
* There can be multiple records with the 'CL' key.
@@ -952,7 +951,6 @@ lderr:
if( (*i)->ac == ac )
return; //Failed to add - already present
}
-#endif
mDeviceSpecific.push_back( d );
}

View File

@ -1,11 +1,13 @@
Name: libvpd
Version: 2.2.9
Release: 1%{?dist}
Release: 2%{?dist}
Summary: VPD Database access library for lsvpd
License: LGPLv2+
URL: https://github.com/power-ras/%{name}/releases
Source: https://github.com/power-ras/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
# Prevent adding duplicate entries
Patch0: libvpd-prevent-adding-duplicate-entries.patch
BuildRequires: gcc-c++
BuildRequires: sqlite-devel zlib-devel libstdc++-devel libtool
@ -24,7 +26,7 @@ Requires: %{name} = %{version}-%{release} sqlite-devel pkgconfig
Contains header files for building with libvpd.
%prep
%setup -q
%autosetup -p1
%build
export CXXFLAGS="-std=c++14 $RPM_OPT_FLAGS"
@ -56,6 +58,9 @@ find %{buildroot} -type f -name "*.la" -delete
%{_libdir}/pkgconfig/libvpd_cxx-2.pc
%changelog
* Tue Jan 30 2024 Than Ngo <than@redhat.com> - 2.2.9-2
- Resolves: RHEL-23015, prevent adding duplicate entries
* Fri May 06 2022 Than Ngo <than@redhat.com> - 2.2.9-1
- Resolves: #2051288, rebase to 2.2.9