Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package lsvpd for openSUSE:Factory checked in at 2022-04-20 16:56:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lsvpd (Old) and /work/SRC/openSUSE:Factory/.lsvpd.new.1941 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lsvpd" Wed Apr 20 16:56:43 2022 rev:60 rq:970856 version:1.7.14 Changes: -------- --- /work/SRC/openSUSE:Factory/lsvpd/lsvpd.changes 2021-12-20 14:18:07.278603771 +0100 +++ /work/SRC/openSUSE:Factory/.lsvpd.new.1941/lsvpd.changes 2022-04-20 16:57:14.774618354 +0200 @@ -1,0 +2,6 @@ +Thu Apr 14 20:56:17 UTC 2022 - Michal Suchanek <msucha...@suse.com> + +- Update to version 1.7.14 + - Prevent corruption of database file when running vpdupdate (bsc#1187665 ltc#194646) + +------------------------------------------------------------------- Old: ---- lsvpd-1.7.13.tar.gz New: ---- lsvpd-1.7.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lsvpd.spec ++++++ --- /var/tmp/diff_new_pack.sDh9rJ/_old 2022-04-20 16:57:15.318618861 +0200 +++ /var/tmp/diff_new_pack.sDh9rJ/_new 2022-04-20 16:57:15.322618865 +0200 @@ -1,7 +1,7 @@ # # spec file for package lsvpd # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: lsvpd -Version: 1.7.13 +Version: 1.7.14 Release: 0 Summary: VPD Hardware Inventory Utilities for Linux License: GPL-2.0-or-later @@ -28,7 +28,7 @@ BuildRequires: gcc-c++ BuildRequires: librtas-devel BuildRequires: libtool -BuildRequires: libvpd2-devel +BuildRequires: libvpd-devel BuildRequires: sg3_utils-devel BuildRequires: zlib-devel Requires: /bin/sed ++++++ lsvpd-1.7.13.tar.gz -> lsvpd-1.7.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsvpd-1.7.13/ChangeLog new/lsvpd-1.7.14/ChangeLog --- old/lsvpd-1.7.13/ChangeLog 2021-09-09 08:30:34.000000000 +0200 +++ new/lsvpd-1.7.14/ChangeLog 2022-02-27 17:52:13.000000000 +0100 @@ -1,3 +1,6 @@ +1.7.14: Mahesh Salgaonkar <mah...@linux.ibm.com> - Fri Feb 25 2022 +- Prevent corruption of database file when running vpdupdate + 1.7.13: Vasant Hegde <hegdevas...@linux.vnet.ibm.com> - Thu Sep 9 2021 - Add support for SCSI loc code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsvpd-1.7.13/configure.ac new/lsvpd-1.7.14/configure.ac --- old/lsvpd-1.7.13/configure.ac 2021-09-09 08:30:34.000000000 +0200 +++ new/lsvpd-1.7.14/configure.ac 2022-02-27 17:52:13.000000000 +0100 @@ -3,7 +3,7 @@ AC_PREREQ([2.69]) #base -AC_INIT([lsvpd],[1.7.13],[hegdevas...@linux.vnet.ibm.com, kamal...@linux.vnet.ibm.com]) +AC_INIT([lsvpd],[1.7.14],[mah...@linux.ibm.com,s...@linux.ibm.com]) AC_CONFIG_HEADER([config/config.h]) AC_SUBST(DATE, [`date`]) AC_CONFIG_MACRO_DIR([m4]) @@ -56,8 +56,8 @@ # exit 1 ]) AM_CONDITIONAL([SGUTIL1], [ test x$SGUTILS_LIB == xsgutils ]) AM_CONDITIONAL([SGUTIL2], [ test x$SGUTILS_LIB == xsgutils2 ]) -AC_CHECK_LIB(vpd,unpack_system,[],[ - echo "VPD library(libvpd) version 2 is required for lsvpd" +PKG_CHECK_MODULES([LIBVPD2], [libvpd_cxx-2 >= 2.2.9],[],[ + echo "VPD library(libvpd) version 2.2.9 is required for lsvpd" exit 1]) AC_FUNC_CLOSEDIR_VOID diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsvpd-1.7.13/lsvpd.spec.in new/lsvpd-1.7.14/lsvpd.spec.in --- old/lsvpd-1.7.13/lsvpd.spec.in 2021-09-09 08:30:34.000000000 +0200 +++ new/lsvpd-1.7.14/lsvpd.spec.in 2022-02-27 17:52:13.000000000 +0100 @@ -20,7 +20,7 @@ Requires(pre): iprutils >= 2.3.12 Requires(postun): iprutils >= 2.3.12 -BuildRequires: libvpd-devel >= 2.2.5 +BuildRequires: libvpd-devel >= 2.2.9 BuildRequires: librtas-devel BuildRequires: zlib-devel BuildRequires: sg3_utils-devel @@ -79,6 +79,9 @@ %changelog +* Fri Feb 25 2022 - Mahesh Salgaonkar <mah...@linux.ibm.com> - 1.7.14 +- Prevent corruption of database file when running vpdupdate + * Thu Sep 9 2021 - Vasant Hegde <hegdevas...@linux.vnet.ibm.com> - 1.7.13 - Add support for SCSI loc code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsvpd-1.7.13/src/internal/updater.cpp new/lsvpd-1.7.14/src/internal/updater.cpp --- old/lsvpd-1.7.13/src/internal/updater.cpp 2021-09-09 08:30:34.000000000 +0200 +++ new/lsvpd-1.7.14/src/internal/updater.cpp 2022-02-27 17:52:13.000000000 +0100 @@ -62,9 +62,9 @@ int storeComponents( Component* root, VpdDbEnv& db ); void printUsage( ); void printVersion( ); -int ensureEnv( const string& env ); +int ensureEnv( const string& env, const string& file ); void archiveDB( const string& fullPath ); -int __lsvpdInit(string env, string file); +int __lsvpdInit( VpdDbEnv::UpdateLock *lock ); void __lsvpdFini(void); void lsvpdSighandler(int sig); @@ -74,6 +74,7 @@ bool isRoot(void); VpdDbEnv *db; +VpdDbEnv::UpdateLock *dblock; string env = DB_DIR, file = DB_FILENAME; @@ -83,6 +84,7 @@ bool done = false; int index = 0, rc = 1; bool limitSCSISize = false; + VpdDbEnv::UpdateLock *lock; string platform = PlatformCollector::get_platform_name(); switch (PlatformCollector::platform_type) { @@ -127,7 +129,9 @@ return 0; case 'a': + lock = new VpdDbEnv::UpdateLock(env, file, false); archiveDB( env + '/' + file ); + delete lock; return 0; case -1: @@ -151,12 +155,9 @@ l.log( "vpdupdate: Constructing full devices database", LOG_NOTICE ); rc = initializeDB( limitSCSISize ); - if (rc) { - __lsvpdFini(); - return rc; - } __lsvpdFini(); + return rc; } bool isRoot() @@ -325,23 +326,28 @@ */ int initializeDB( bool limitSCSI ) { + VpdDbEnv::UpdateLock *lock; System * root; int ret; - if( ensureEnv( env ) != 0 ) + if( ensureEnv( env, file ) != 0 ) return -1; string fullPath = env + "/" + file; + lock = new VpdDbEnv::UpdateLock(env, file, false); removeOldArchiveDB( ); archiveDB( fullPath ); + /* The db is now archived so when signal handler runs it should remove + * any db it finds */ + dblock = lock; Gatherer info( limitSCSI ); - ret = __lsvpdInit(env, file); + ret = __lsvpdInit(lock); if ( ret != 0 ) { Logger l; - l.log( " Could not allocate memory for the VPD database.", LOG_ERR); + l.log( "Could not allocate memory for the VPD database.", LOG_ERR); return ret; } @@ -358,11 +364,10 @@ { Logger l; l.log( "Saving components to database failed.", LOG_ERR ); - return ret; } delete root; - return 0; + return ret; } /** @@ -409,7 +414,7 @@ return 0; } -int ensureEnv( const string& env ) +int ensureEnv( const string& env, const string& file ) { struct stat info; int ret = -1; @@ -418,14 +423,14 @@ if( stat( env.c_str( ), &info ) == 0 ) { if (!S_ISDIR(info.st_mode & S_IFMT)) { - logger.log("/var/lib/lsvpd is not a directory\n", LOG_ERR); + logger.log(env + " is not a directory\n", LOG_ERR); return ret; } if ( ((info.st_mode & S_IRWXU) != S_IRWXU) || ((info.st_mode & S_IRGRP) != S_IRGRP) || ((info.st_mode & S_IROTH) != S_IROTH) ) { - logger.log("Failed to create vpd.db, no valid " + logger.log("Failed to create " + file + ", no valid " "permission\n", LOG_ERR); return ret; } @@ -438,7 +443,7 @@ return ret; } - if( ( ret = ensureEnv( env.substr( 0, idx ) ) ) != 0 ) + if( ( ret = ensureEnv( env.substr( 0, idx ) , env.substr( idx + 1 ) ) ) != 0 ) { return ret; } @@ -448,7 +453,7 @@ S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH ) != 0 ) { - logger.log( "Failed to create directory for vpd db.", LOG_ERR ); + logger.log( "Failed to create directory " + env + " for vpd db.", LOG_ERR ); return -1; } return ret; @@ -458,7 +463,7 @@ * @brief initializes data base access, sets up signal handling * to ensure proper cleanup if process if prematurely aborted */ -int __lsvpdInit(string env, string file) +int __lsvpdInit( VpdDbEnv::UpdateLock *lock ) { struct sigaction sigact; @@ -475,7 +480,7 @@ sigaction(SIGQUIT, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); - db = new VpdDbEnv( env, file, false ); + db = new VpdDbEnv( *lock ); if ( db == NULL ) return -1; else @@ -491,6 +496,7 @@ if (db != NULL) { try { delete db; + dblock = NULL; } catch (VpdException & ve) { } } /* if */ @@ -499,7 +505,6 @@ void lsvpdSighandler(int sig) { - int fp; struct sigaction sigact; switch (sig) { @@ -516,12 +521,9 @@ sigemptyset(&sigact.sa_mask); sigaction(sig, &sigact, NULL); - /* Remove temporary file */ - unlink((env + "/" + file).c_str()); - fp = open(env.c_str(), O_RDWR); - if (fp >= 0) { - fsync(fp); - close(fp); + if (dblock != NULL) { + /* Remove temporary file */ + unlink((env + "/" + file).c_str()); } __lsvpdFini();