Hello community,

here is the log from the commit of package ppc64-diag for openSUSE:Factory 
checked in at 2014-01-30 12:52:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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    2013-12-11 
15:43:52.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ppc64-diag.new/ppc64-diag.changes       
2014-01-30 12:52:25.000000000 +0100
@@ -1,0 +2,13 @@
+Fri Jan 17 10:47:35 UTC 2014 - dvla...@suse.com
+
+- drop ppc64-diag.unistd.patch 
+
+-------------------------------------------------------------------
+Fri Jan 10 17:44:52 UTC 2014 - jloe...@suse.com
+
+- version update to 2.6.2 (FATE#315459) 
+  - Minor bug fix in diag_encl and encl_led
+
+- drop ppc64-diag.makefile.patch
+
+-------------------------------------------------------------------

Old:
----
  ppc64-diag-2.6.1.tar.gz
  ppc64-diag.makefile.patch
  ppc64-diag.unistd.patch

New:
----
  ppc64-diag-2.6.2.tar.gz

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

Other differences:
------------------
++++++ ppc64-diag.spec ++++++
--- /var/tmp/diff_new_pack.2UALsm/_old  2014-01-30 12:52:26.000000000 +0100
+++ /var/tmp/diff_new_pack.2UALsm/_new  2014-01-30 12:52:26.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package ppc64-diag
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2014 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
@@ -18,7 +18,7 @@
 
 Url:            http://sourceforge.net/projects/linux-diag/files/ppc64-diag 
 Name:           ppc64-diag
-Version:        2.6.1
+Version:        2.6.2
 Release:        0
 Summary:        Linux for Power Platform Diagnostics
 License:        EPL-1.0
@@ -49,8 +49,9 @@
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source0:        
http://downloads.sourceforge.net/project/linux-diag/ppc64-diag/%{version}/%{name}-%{version}.tar.gz
 
 Source1:        rtas_errd.service
-Patch0:         %{name}.makefile.patch
+#PATCH-FIX-OPENSUSE - ppc64-diag.rtas_errd.patch - fix rtas_errd initscript to 
comply with openSUSE standards 
 Patch1:         %{name}.rtas_errd.patch
+#PATCH-FIX-OPENSUSE - ppc64-diag.varunused.patch - fix unused variables
 Patch2:         %{name}.varunused.patch
 
 %description
@@ -70,7 +71,6 @@
 
 %prep
 %setup -q
-%patch0
 %patch1 -p1
 %patch2 -p1
 

++++++ ppc64-diag-2.6.1.tar.gz -> ppc64-diag-2.6.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.6.1/diags/diag_encl.c 
new/ppc64-diag-2.6.2/diags/diag_encl.c
--- old/ppc64-diag-2.6.1/diags/diag_encl.c      2013-02-08 10:06:13.000000000 
+0100
+++ new/ppc64-diag-2.6.2/diags/diag_encl.c      2013-08-20 13:21:13.000000000 
+0200
@@ -10,6 +10,7 @@
 #include <time.h>
 #include <getopt.h>
 #include <errno.h>
+#include <dirent.h>
 #include <sys/wait.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_ioctl.h>
@@ -391,6 +392,11 @@
        struct dev_vpd *vpd = NULL;
        struct dev_vpd *v;
 
+       /* Validate sg device */
+       rc = valid_enclosure_device(sg);
+       if (rc)
+               return -1;
+
        printf("DIAGNOSING %s\n", sg);
 
        vpd = (struct dev_vpd *)malloc(sizeof(struct dev_vpd));
@@ -468,8 +474,8 @@
                *diagnosed = vpd;
        } else {
                free(vpd);
-               fprintf(stderr, "Unable to diagnose devices of machine "
-                               "type/model %s\n\n", vpd->mtm);
+               fprintf(stderr, "\tUnable to diagnose devices of machine "
+                               "type/model: %s\n\n", vpd->mtm);
        }
        return rc;
 
@@ -482,8 +488,9 @@
 main(int argc, char *argv[])
 {
        int failure = 0, option_index, rc;
-       char buf[128], *sg;
-       FILE *fp;
+       char path[128];
+       DIR *edir, *sdir;
+       struct dirent *sdirent, *edirent;
        struct dev_vpd *diagnosed = NULL;
 
        memset(&cmd_opts, 0, sizeof(cmd_opts));
@@ -569,21 +576,38 @@
                        failure += diagnose(argv[optind++], &diagnosed);
 
        } else {
-               /* use lsvpd to find all sg devices */
-               fp = popen("lsvpd | grep sg", "r");
-               if (fp == NULL) {
-                       fprintf(stderr, "Could not obtain a list of sg devices."
-                                       " Ensure that lsvpd is installed.\n");
+               edir = opendir(SCSI_SES_PATH);
+               if (!edir) {
+                       fprintf(stderr,
+                               "System does not have SCSI enclsoure(s).\n");
                        return -1;
                }
-               while (fgets_nonl(buf, 128, fp) != NULL) {
-                       /* Handle both old and new formats. */
-                       if (strstr(buf, "/dev/sg") || strstr(buf, "*AX sg")) {
-                               sg = strstr(buf, "sg");
-                               failure += diagnose(sg, &diagnosed);
+
+               /* loop over all enclosures */
+               while ((edirent = readdir(edir)) != NULL) {
+                       if (!strcmp(edirent->d_name, ".") ||
+                           !strcmp(edirent->d_name, ".."))
+                               continue;
+
+                       snprintf(path, 128, "%s/%s/device/scsi_generic",
+                                SCSI_SES_PATH, edirent->d_name);
+
+                       sdir = opendir(path);
+                       if (!sdir)
+                               continue;
+
+                       while ((sdirent = readdir(sdir)) != NULL) {
+                               if (!strcmp(sdirent->d_name, ".") ||
+                                   !strcmp(sdirent->d_name, ".."))
+                                       continue;
+
+                               /* run diagnostics */
+                               failure += diagnose(sdirent->d_name,
+                                                   &diagnosed);
                        }
-               }
-               pclose(fp);
+                       closedir(sdir);
+               } /* outer while loop */
+               closedir(edir);
        }
 
        free(cmd_opts.prev_path);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.6.1/diags/encl_led.c 
new/ppc64-diag-2.6.2/diags/encl_led.c
--- old/ppc64-diag-2.6.1/diags/encl_led.c       2013-02-08 10:06:13.000000000 
+0100
+++ new/ppc64-diag-2.6.2/diags/encl_led.c       2013-08-20 13:21:13.000000000 
+0200
@@ -78,16 +78,16 @@
 static int
 loc_code_device(const char *loccode, char *sg, int sg_size)
 {
-       int found = 0;
-       char buf[128];
+       int rc, found = 0;
+       char buf[128], cmd[128];
        char *dev;
        FILE *fp;
-       struct dev_vpd vpd;
 
-       fp = popen("lsvpd | grep sg", "r");
+       snprintf(cmd, 128, "lsvpd -l %s", loccode);
+       fp = popen(cmd, "r");
        if (fp == NULL) {
-               fprintf(stderr, "Could not obtain a list of sg devices."
-                                " Ensure that lsvpd is installed.\n");
+               fprintf(stderr, "Could not obtain the sg device details."
+                       " Ensure that lsvpd is installed.\n");
                return -1;
        }
 
@@ -97,12 +97,14 @@
                /* Handle both old and new formats. */
                if (strstr(buf, "/dev/sg") || strstr(buf, "*AX sg")) {
                        dev = strstr(buf, "sg");
-                       memset(&vpd, 0, sizeof(vpd));
-                       if (read_vpd_from_lscfg(&vpd, dev) == 0)
-                               if (!strcmp(vpd.location, loccode)) {
-                                       strncpy(sg, dev, sg_size);
-                                       found = 1;
-                               }
+
+                       /* validate sg device */
+                       rc = valid_enclosure_device(dev);
+                       if (rc)
+                               continue;
+
+                       strncpy(sg, dev, sg_size);
+                       found = 1;
                }
        }
 
@@ -129,7 +131,7 @@
 {
        if (!strncmp(encl, "sg", 2) && strlen(encl) < DEVSG_MAXLEN - 6) {
                strncpy(sg, encl, sg_size);
-               return 0;
+               return valid_enclosure_device(sg);
        }
        return loc_code_device(encl, sg, sg_size);
 }
@@ -223,11 +225,8 @@
 
        /* Get sg dev name for the given sg/location code */
        memset(sg, 0, sizeof(sg));
-       if (enclosure_dev_name(enclosure, sg, sizeof(sg)) != 0) {
-               fprintf(stderr, "%s: %s is not a valid enclosure device\n",
-                               progname, enclosure);
+       if (enclosure_dev_name(enclosure, sg, sizeof(sg)) != 0)
                exit(1);
-       }
 
        /* Get enclosure type as "Machine Type" from VPD. */
        memset(&vpd, 0, sizeof(vpd));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.6.1/diags/encl_util.c 
new/ppc64-diag-2.6.2/diags/encl_util.c
--- old/ppc64-diag-2.6.1/diags/encl_util.c      2013-02-08 10:06:13.000000000 
+0100
+++ new/ppc64-diag-2.6.2/diags/encl_util.c      2013-08-20 13:21:13.000000000 
+0200
@@ -5,6 +5,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
+#include <dirent.h>
 #include <sys/types.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_ioctl.h>
@@ -205,3 +206,60 @@
 
        return 0;
 }
+
+/*
+ * Validate sg device.
+ *
+ * Note:
+ *  /sys/class/enclosure/<ID>/device/scsi_generic/ dir
+ *  will have the 'scsi' generic name of the device.
+ *
+ * Returns: 0 on valid enclosure device, -1 on invalid enclosure device.
+ */
+int
+valid_enclosure_device(const char *sg)
+{
+       struct dirent *edirent, *sdirent;
+       DIR *edir, *sdir;
+       char path[128];
+
+       edir = opendir(SCSI_SES_PATH);
+       if (!edir) {
+               fprintf(stderr, "System does not have SCSI enclsoure(s).\n");
+               return -1;
+       }
+
+       /* loop over all enclosures */
+       while ((edirent = readdir(edir)) != NULL) {
+               if (!strcmp(edirent->d_name, ".") ||
+                   !strcmp(edirent->d_name, ".."))
+                       continue;
+
+               snprintf(path, 128, "%s/%s/device/scsi_generic",
+                        SCSI_SES_PATH, edirent->d_name);
+
+               sdir = opendir(path);
+               if (!sdir)
+                       continue;
+
+               while ((sdirent = readdir(sdir)) != NULL) {
+                       if (!strcmp(sdirent->d_name, ".") ||
+                           !strcmp(sdirent->d_name, ".."))
+                               continue;
+
+                       /* found sg device */
+                       if (!strcmp(sdirent->d_name, sg))
+                               goto out;
+               }
+               closedir(sdir);
+       }
+
+       closedir(edir);
+       fprintf(stderr, "%s is not a valid enclosure device\n", sg);
+       return -1;
+
+out:
+       closedir(sdir);
+       closedir(edir);
+       return 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.6.1/diags/encl_util.h 
new/ppc64-diag-2.6.2/diags/encl_util.h
--- old/ppc64-diag-2.6.1/diags/encl_util.h      2013-02-08 10:06:13.000000000 
+0100
+++ new/ppc64-diag-2.6.2/diags/encl_util.h      2013-08-20 13:21:13.000000000 
+0200
@@ -6,6 +6,9 @@
 
 #include <stdint.h>
 
+/* SES sys path */
+#define SCSI_SES_PATH          "/sys/class/enclosure"
+
 /* device vpd */
 struct dev_vpd {
        char mtm[128];
@@ -24,5 +27,6 @@
 extern char *fgets_nonl(char *buf, int size, FILE *s);
 extern int read_vpd_from_lscfg(struct dev_vpd *vpd, const char *sg);
 extern void trim_location_code(struct dev_vpd *vpd);
+extern int valid_enclosure_device(const char *sg);
 
 #endif /* _ENCL_UTIL_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.6.1/ela/Makefile 
new/ppc64-diag-2.6.2/ela/Makefile
--- old/ppc64-diag-2.6.1/ela/Makefile   2013-02-08 10:06:13.000000000 +0100
+++ new/ppc64-diag-2.6.2/ela/Makefile   2013-08-20 13:21:13.000000000 +0200
@@ -75,7 +75,7 @@
        @$(call 
install_files,$(CATALOG),744,$(DESTDIR)/etc/ppc64-diag/message_catalog)
        @$(call 
install_files,$(CATALOG_REGEX),744,$(DESTDIR)/etc/ppc64-diag/message_catalog/with_regex)
        @$(call install_man,$(MANPAGES),$(DESTDIR))
-       $(INSTALL) -d -m 755 /var/log/ppc64-diag
+       $(INSTALL) -d -m 755 $(DESTDIR)/var/log/ppc64-diag
 
 clean:
        @rm -rf $(CMDS) *.o lex.*.c *.tab.c *.tab.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.6.1/ppc64-diag.spec 
new/ppc64-diag-2.6.2/ppc64-diag.spec
--- old/ppc64-diag-2.6.1/ppc64-diag.spec        2013-02-08 10:06:13.000000000 
+0100
+++ new/ppc64-diag-2.6.2/ppc64-diag.spec        2013-08-20 13:21:13.000000000 
+0200
@@ -1,5 +1,5 @@
 Name:  ppc64-diag
-Version:       2.6.1
+Version:       2.6.2
 Release:       0
 Summary:       PowerLinux Platform Diagnostics
 Group:                 System Environment/Base
@@ -78,6 +78,9 @@
 fi
 
 %changelog
+* Tue Aug 20 2013 - Vasant Hegde <hegdevas...@linux.vnet.ibm.com> - 2.6.2
+- Minor bug fix in diag_encl and encl_led
+
 * Fri Feb 08 2013 - Vasant Hegde <hegdevas...@in.ibm.com> - 2.6.1
 - Handler to handle PRRN RTAS notification
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.6.1/rtas_errd/config.c 
new/ppc64-diag-2.6.2/rtas_errd/config.c
--- old/ppc64-diag-2.6.1/rtas_errd/config.c     2013-02-08 10:06:13.000000000 
+0100
+++ new/ppc64-diag-2.6.2/rtas_errd/config.c     2013-08-20 13:21:13.000000000 
+0200
@@ -251,6 +251,35 @@
 }
 
 /**
+ * get_restart_policy_value
+ * @brief Retrieve Auto Restart Policy value
+ *
+ * Same as get_config_num(), except we handle 0 and negative
+ * values here.
+ */
+static char *
+get_restart_policy_value(char *start, char *end, int *val, int *line_no)
+{
+       char    tok[1024];
+       char    *next_char;
+
+       /* The first token should be '=' */
+       start = get_token(start, end, tok, line_no);
+       if ((start == NULL) || (tok[0] != '='))
+               return NULL;
+
+       /* Next token should be the value */
+       start = get_token(start, end, tok, line_no);
+       if (start != NULL) {
+               *val = (int)strtol(tok, &next_char, 10);
+               if (*next_char != '\0')
+                   *val = -1;
+       }
+
+       return start;
+}
+
+/**
  * config_restart_policy
  * @brief Configure the Auto Restart Policy for this machine, if present.
  *
@@ -275,7 +304,8 @@
        char            param[3];
        int             rc;
 
-       cur = get_config_num(start, end, &d_cfg.restart_policy, line_no);
+       cur = get_restart_policy_value(start, end,
+                                      &d_cfg.restart_policy, line_no);
        if (cur == NULL) {
                d_cfg.log_msg("Parsing error for configuration file "
                              "entry \"AutoRestartPolicy\", " "line %d", 
@@ -286,9 +316,10 @@
        /* Validate the restart value */
        if (! (d_cfg.restart_policy == 0 || d_cfg.restart_policy == 1)) {
                d_cfg.log_msg("Invalid parameter (%d) specified for the "
-                             "AutoRestartPolicy (line %d), expecting a 0 "
-                             "or a 1.  The Auto Restart Policy has not been "
-                             "configured", d_cfg.restart_policy, line_no);
+                             "AutoRestartPolicy (line %d) in config file "
+                             "(%s), expecting a 0 or a 1.  The Auto Restart "
+                             "Policy has not been configured",
+                             d_cfg.restart_policy, *line_no, config_file);
                d_cfg.restart_policy = -1;
                return cur;
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.6.1/rtas_errd/files.c 
new/ppc64-diag-2.6.2/rtas_errd/files.c
--- old/ppc64-diag-2.6.1/rtas_errd/files.c      2013-02-08 10:06:13.000000000 
+0100
+++ new/ppc64-diag-2.6.2/rtas_errd/files.c      2013-08-20 13:21:13.000000000 
+0200
@@ -398,6 +398,10 @@
                        j += 2;
                        sscanf(str, "%02x", &ch);
                        buf[k++] = ch;
+                       if (k >= buflen) { /* Buffer overflow */
+                               log_msg(NULL, "Invalid test file");
+                               return -1;
+                       }
                }
 
                len = tf_sbuf.st_size;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.6.1/rtas_errd/rtas_errd.c 
new/ppc64-diag-2.6.2/rtas_errd/rtas_errd.c
--- old/ppc64-diag-2.6.1/rtas_errd/rtas_errd.c  2013-02-08 10:06:13.000000000 
+0100
+++ new/ppc64-diag-2.6.2/rtas_errd/rtas_errd.c  2013-08-20 13:21:13.000000000 
+0200
@@ -151,7 +151,7 @@
                break;
 
            case RTAS_HDR_TYPE_PRRN:
-               dbg("Entring PRRN handler");
+               dbg("Entering PRRN handler");
                handle_prrn_event(event);
 
                /* Nothing left to do for PRRN Events, there is no exthdr

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to