Compare commits

...

2 Commits

Author SHA1 Message Date
Than Ngo 9a318a986c Resolves: RHEL-23015, prevent adding duplicate entries 2024-01-31 02:57:56 +00:00
Than Ngo 304d61d734 Related: #2051288, enable gating test 2022-05-09 10:45:41 +02:00
4 changed files with 54 additions and 2 deletions

1
.libvpd.metadata Normal file
View File

@ -0,0 +1 @@
17fcca6874e97490e2b44868b50bb1e2c456dc35 libvpd-2.2.9.tar.gz

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

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