File change-pid-file-from-var-to-run.patch of Package libvpd2.10188

From 7d959c5ff48978853b01c43e959236988a46a018 Mon Sep 17 00:00:00 2001
From: Brahadambal Srinivasan <latha@linux.vnet.ibm.com>
Date: Fri, 23 Jun 2017 11:13:27 +0530
Subject: [PATCH] Changes run.vpdupdate creation path from /var/lib/lsvpd to
 /run

Process '/bin/touch /var/lib/lsvpd/run.vpdupdate' failed with
 exit code 1.

Canonical folks suggested that it can happen if any of below condition meets:
  - If it's running before /var/lib/lsvpd is mounted
  - If it's being run while the root filesystem is still mounted read only?
and suggested to create file under /run/ if we are not worried about file data.

Advantage when we create file under /run:
 - If udev triggers libvpd rules before mounting /var or even if it is
read-only then also we won't get above mentioned issue.

This patch changes run.vpdupdate file creation path from /var/lib/lsvpd/ to /run/ .

Signed-off-by: Brahadambal Srinivasan <latha@linux.vnet.ibm.com>
Tested-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
Reviewed-by: Ankit Kumar <ankit@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 90-vpdupdate.rules   | 2 +-
 Makefile.am          | 2 --
 libvpd.spec.in       | 1 -
 src/vpdretriever.cpp | 4 ++--
 4 files changed, 3 insertions(+), 6 deletions(-)

Index: libvpd-2.2.5/90-vpdupdate.rules
===================================================================
--- libvpd-2.2.5.orig/90-vpdupdate.rules
+++ libvpd-2.2.5/90-vpdupdate.rules
@@ -1 +1 @@
-KERNELS=="*", ACTION=="*", DEVPATH=="/devices/*", RUN+="/bin/touch /var/lib/lsvpd/run.vpdupdate"
+KERNELS=="*", ACTION=="*", DEVPATH=="/devices/*", RUN+="/bin/touch /run/run.vpdupdate"
Index: libvpd-2.2.5/Makefile.am
===================================================================
--- libvpd-2.2.5.orig/Makefile.am
+++ libvpd-2.2.5/Makefile.am
@@ -67,7 +67,5 @@ libtool: $(LIBTOOL_DEPS)
 install-exec-hook:
 	mkdir -p $(DESTDIR)/usr/lib/udev/rules.d/
 	mkdir -p $(DESTDIR)/${localstatedir}/lib/lsvpd/
-	install -D --mode=644 run.vpdupdate \
-		${DESTDIR}/${localstatedir}/lib/lsvpd/run.vpdupdate
 	install -D --mode=644 90-vpdupdate.rules \
                 ${DESTDIR}/usr/lib/udev/rules.d/90-vpdupdate.rules
Index: libvpd-2.2.5/libvpd.spec.in
===================================================================
--- libvpd-2.2.5.orig/libvpd.spec.in
+++ libvpd-2.2.5/libvpd.spec.in
@@ -53,7 +53,6 @@ Contains header files for building with
 %{_libdir}/libvpd_cxx-@GENERIC_RELEASE@.so.*
 %{_libdir}/libvpd-@GENERIC_RELEASE@.so.*
 %{_sysconfdir}/udev/rules.d/90-vpdupdate.rules
-%{_var}/lib/lsvpd/run.vpdupdate
 
 %files devel
 %defattr(-,root,root,-)
Index: libvpd-2.2.5/src/vpdretriever.cpp
===================================================================
--- libvpd-2.2.5.orig/src/vpdretriever.cpp
+++ libvpd-2.2.5/src/vpdretriever.cpp
@@ -44,7 +44,7 @@ namespace lsvpd
 {
 	const string VpdRetriever::DEFAULT_DIR  ( "/var/lib/lsvpd/" );
 	const string VpdRetriever::DEFAULT_FILE ( "vpd.db" );
-	const string VpdRetriever::UDEV_NOTIFY_FILE ( "run.vpdupdate" );
+	const string VpdRetriever::UDEV_NOTIFY_FILE ( "/run/run.vpdupdate" );
 
 	VpdRetriever::VpdRetriever( string envDir,
 		string dbFileName ) throw( VpdException& )
@@ -63,7 +63,7 @@ namespace lsvpd
 	{
 		struct stat vpd_stat,udev_stat;
 		const string vpddb = VpdRetriever::DEFAULT_DIR + VpdRetriever::DEFAULT_FILE;
-		const string udev_file = VpdRetriever::DEFAULT_DIR + VpdRetriever::UDEV_NOTIFY_FILE;
+		const string udev_file = VpdRetriever::UDEV_NOTIFY_FILE;
 		Logger logger;
 		int flag = 1;
 
openSUSE Build Service is sponsored by