Resolves: RHEL-23015, prevent adding duplicate entries
This commit is contained in:
parent
304d61d734
commit
b3c8c969b0
40
libvpd-prevent-adding-duplicate-entries.patch
Normal file
40
libvpd-prevent-adding-duplicate-entries.patch
Normal 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 );
|
||||||
|
}
|
@ -1,11 +1,13 @@
|
|||||||
Name: libvpd
|
Name: libvpd
|
||||||
Version: 2.2.9
|
Version: 2.2.9
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: VPD Database access library for lsvpd
|
Summary: VPD Database access library for lsvpd
|
||||||
|
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: https://github.com/power-ras/%{name}/releases
|
URL: https://github.com/power-ras/%{name}/releases
|
||||||
Source: https://github.com/power-ras/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
|
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: gcc-c++
|
||||||
BuildRequires: sqlite-devel zlib-devel libstdc++-devel libtool
|
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.
|
Contains header files for building with libvpd.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%autosetup -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export CXXFLAGS="-std=c++14 $RPM_OPT_FLAGS"
|
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
|
%{_libdir}/pkgconfig/libvpd_cxx-2.pc
|
||||||
|
|
||||||
%changelog
|
%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
|
* Fri May 06 2022 Than Ngo <than@redhat.com> - 2.2.9-1
|
||||||
- Resolves: #2051288, rebase to 2.2.9
|
- Resolves: #2051288, rebase to 2.2.9
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user