Hello community,

here is the log from the commit of package ppc64-diag for openSUSE:Factory 
checked in at 2015-09-27 08:39:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ppc64-diag (Old)
 and      /work/SRC/openSUSE:Factory/.ppc64-diag.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ppc64-diag"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ppc64-diag/ppc64-diag.changes    2015-08-01 
11:37:10.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ppc64-diag.new/ppc64-diag.changes       
2015-09-27 08:39:02.000000000 +0200
@@ -1,0 +2,8 @@
+Wed Sep 16 16:48:35 UTC 2015 - jloe...@suse.com
+
+- create /var/log/dump directory on startup (bsc#945385)
+
+- added patches:
+  * ppc64-diag.bug-945385_create_dump_directory_on_startup.patch
+
+-------------------------------------------------------------------

New:
----
  ppc64-diag.bug-945385_create_dump_directory_on_startup.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ppc64-diag.spec ++++++
--- /var/tmp/diff_new_pack.EjQlIg/_old  2015-09-27 08:39:02.000000000 +0200
+++ /var/tmp/diff_new_pack.EjQlIg/_new  2015-09-27 08:39:02.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ppc64-diag
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -55,6 +55,7 @@
 #PATCH-FIX-OPENSUSE - ppc64-diag.opal_errd.patch - fix opal_errd initscript to 
comply with openSUSE standards
 Patch3:         %{name}.opal_errd.patch
 Patch4:         ppc64-diag.tmpraces.patch
+Patch5:         ppc64-diag.bug-945385_create_dump_directory_on_startup.patch
 
 %description
 This package contains various diagnostic tools for PowerLinux.
@@ -76,6 +77,7 @@
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
 %build
 %if 0%{?has_systemd}

++++++ ppc64-diag.bug-945385_create_dump_directory_on_startup.patch ++++++
>From 25797e8420d6cbcf8b64f062d347f21649d9d1f7 Mon Sep 17 00:00:00 2001
From: Kamalesh Babulal <kamal...@linux.vnet.ibm.com>
Date: Wed, 9 Sep 2015 10:43:29 +0530
Subject: [PATCH] opal_errd/extract_opal_dump: Create dump directory on startup
To: ltc...@lists.linux.ibm.com

extract_opal_dump is called, while starting opal_errd daemon. Following
failure message from extract_opal_dump is observed when output dump
directory (/var/log/dump default) is missing to extract the dump to.

opal_errd.service - opal_errd (PowerNV platform error handling) Service
   Loaded: loaded (/usr/lib/systemd/system/opal_errd.service; enabled)
   Active: active (running) since Wed 2015-09-09 09:41:03 BST; 2s ago
  Process: 84467 ExecStop=/usr/lib/opal_errd stop (code=exited, 
status=0/SUCCESS)
  Process: 84488 ExecStart=/usr/lib/opal_errd start (code=exited, 
status=0/SUCCESS)
 Main PID: 84500 (opal_errd)
   CGroup: /system.slice/opal_errd.service
           `-84500 /usr/sbin/opal_errd

Sep 09 09:41:03 linux ELOG[84500]: /usr/sbin/extract_opal_dump command 
execution failed
Sep 09 09:41:03 linux opal_errd[84488]: Starting opal_errd daemon: ..done
Sep 09 09:41:04 linux ELOG[84500]: /usr/sbin/extract_opal_dump command 
execution failed
Sep 09 09:41:05 linux ELOG[84500]: /usr/sbin/extract_opal_dump command 
execution failed

Fix this issue by creating missing output directory, mimicking opal_errd 
(creates
opal-elog directory, if missing on startup) instead of bailing out. Also replace
stat() with access(), in places where access() is sufficient.

Signed-off-by: Kamalesh Babulal <kamal...@linux.vnet.ibm.com>
Cc: Vasant Hegde <hegdevas...@linux.vnet.ibm.com>
---
 opal_errd/extract_opal_dump.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/opal_errd/extract_opal_dump.c b/opal_errd/extract_opal_dump.c
index 800d308bdbf5..6c3923bb1432 100644
--- a/opal_errd/extract_opal_dump.c
+++ b/opal_errd/extract_opal_dump.c
@@ -100,7 +100,6 @@ static void ack_dump(const char* dump_dir_path)
  */
 static void check_dup_dump_file(char *dumpname)
 {
-       struct stat sbuf;
        char dump_path[PATH_MAX];
        int rc;
 
@@ -111,7 +110,7 @@ static void check_dup_dump_file(char *dumpname)
                return;
        }
 
-       if (stat(dump_path, &sbuf) == -1)
+       if (access(dump_path, R_OK) == -1)
                return;
 
        if (unlink(dump_path) < 0)
@@ -379,7 +378,6 @@ int main(int argc, char *argv[])
        int rc;
        int fd;
        fd_set exceptfds;
-       struct stat s;
 
        setlogmask(LOG_UPTO(LOG_NOTICE));
        openlog("OPAL_DUMP", LOG_CONS | LOG_PID | LOG_NDELAY | LOG_PERROR,
@@ -422,18 +420,29 @@ int main(int argc, char *argv[])
        snprintf(sysfs_path, sizeof(sysfs_path), "%s/firmware/opal/dump",
                 opt_sysfs);
 
-       rc = stat(sysfs_path, &s);
+       rc = access(sysfs_path, R_OK);
        if (rc != 0) {
                syslog(LOG_ERR, "Error accessing sysfs: %s (%d: %s)\n",
                       sysfs_path, errno, strerror(errno));
                goto err_out;
        }
 
-       rc = stat(opt_output_dir, &s);
+       rc = access(opt_output_dir, W_OK);
        if (rc != 0) {
-               syslog(LOG_ERR, "Error accessing output dir: %s (%d: %s)\n",
-                      opt_output_dir, errno, strerror(errno));
-               goto err_out;
+               if (errno == ENOENT) {
+                       rc = mkdir(opt_output_dir,
+                                  S_IRGRP | S_IRUSR | S_IWGRP | S_IWUSR | 
S_IXUSR);
+                       if (rc != 0) {
+                               syslog(LOG_ERR, "Error creating output 
directory:"
+                                               "%s (%d: %s)\n", opt_output_dir,
+                                               errno, strerror(errno));
+                               goto err_out;
+                       }
+               } else {
+                       syslog(LOG_ERR, "Error accessing output dir: %s (%d: 
%s)\n",
+                                       opt_output_dir, errno, strerror(errno));
+                       goto err_out;
+               }
        }
 
 start:
-- 
1.9.1


Reply via email to