From 77057e758b904665189151c6f8deb8b9b5a485c5 Mon Sep 17 00:00:00 2001 From: basebuilder_pel7ppc64bebuilder0 Date: Tue, 29 May 2018 15:51:50 +0200 Subject: [PATCH] ppc64-diag package update Signed-off-by: basebuilder_pel7ppc64bebuilder0 --- SOURCES/ppc64-diag-2.4.2-chkconfig.patch | 20 ++ .../ppc64-diag-2.7.4-fix-build-warning.patch | 56 ++++ SOURCES/ppc64-diag-2.7.4-lpdscriptloc.patch | 57 ++++ ...4-diag-2.7.4-messagecatalog-location.patch | 77 ++++++ SOURCES/ppc64-diag-2.7.4-scriptlocation.patch | 122 +++++++++ SOURCES/ppc64-diag-tmpraces.patch | 27 ++ ...og-directory-manually-if-not-present.patch | 107 ++++++++ ...pc64-diag-v2.7.4-fix-service-scripts.patch | 12 + ...-read-complete-system-vpd-infomation.patch | 38 +++ ...-timestamp-from-disk-health-log-file.patch | 52 ++++ SPECS/ppc64-diag.spec | 258 ++++++++++++++++++ 11 files changed, 826 insertions(+) create mode 100644 SOURCES/ppc64-diag-2.4.2-chkconfig.patch create mode 100644 SOURCES/ppc64-diag-2.7.4-fix-build-warning.patch create mode 100644 SOURCES/ppc64-diag-2.7.4-lpdscriptloc.patch create mode 100644 SOURCES/ppc64-diag-2.7.4-messagecatalog-location.patch create mode 100644 SOURCES/ppc64-diag-2.7.4-scriptlocation.patch create mode 100644 SOURCES/ppc64-diag-tmpraces.patch create mode 100644 SOURCES/ppc64-diag-v2.7.4-create-diag_disk-log-directory-manually-if-not-present.patch create mode 100644 SOURCES/ppc64-diag-v2.7.4-fix-service-scripts.patch create mode 100644 SOURCES/ppc64-diag-v2.7.4-increase-buffer-length-size-to-read-complete-system-vpd-infomation.patch create mode 100644 SOURCES/ppc64-diag-v2.7.4-remove-timestamp-from-disk-health-log-file.patch create mode 100644 SPECS/ppc64-diag.spec diff --git a/SOURCES/ppc64-diag-2.4.2-chkconfig.patch b/SOURCES/ppc64-diag-2.4.2-chkconfig.patch new file mode 100644 index 00000000..bdd55ae8 --- /dev/null +++ b/SOURCES/ppc64-diag-2.4.2-chkconfig.patch @@ -0,0 +1,20 @@ +diff --git a/scripts/rtas_errd b/scripts/rtas_errd +index d5d40fe..dff1445 100755 +--- a/scripts/rtas_errd ++++ b/scripts/rtas_errd +@@ -30,11 +30,14 @@ + # 8 - 199 reserved + # + ++# chkconfig: - 95 5 ++# description: Daemon to retrieve platform errors ++ + ### BEGIN INIT INFO + # Provides: rtas_errd + # Required-Start: $local_fs $syslog $time + # Required-Stop: +-# Default-Start: 2 3 5 ++# Default-Start: + # Default-Stop: 0 1 4 6 + # Short-Description: Daemon to retrieve platform errors + # Description: Starts rtas_errd daemon to retrieve platform errors diff --git a/SOURCES/ppc64-diag-2.7.4-fix-build-warning.patch b/SOURCES/ppc64-diag-2.7.4-fix-build-warning.patch new file mode 100644 index 00000000..917f92ae --- /dev/null +++ b/SOURCES/ppc64-diag-2.7.4-fix-build-warning.patch @@ -0,0 +1,56 @@ +commit ce22168173e63d77a566f753b3d697288f62fbcc +Author: Ankit Kumar +Date: Mon Dec 4 11:48:55 2017 +0530 + + Fixes build warning + + This patch fixes ppc64-diag build warning. + + Signed-off-by: Ankit Kumar + Signed-off-by: Vasant Hegde + +diff --git a/diags/homerun.c b/diags/homerun.c +index cdae58b..d9a6fc9 100644 +--- a/diags/homerun.c ++++ b/diags/homerun.c +@@ -274,8 +274,7 @@ hr_report_faults_to_svclog(int fd, struct dev_vpd *vpd, + build_srn(srn, SRN_RC_TEMP_THRESHOLD); + callouts = NULL; + create_esm_callout(&callouts, location, i, fd); +- if (rc == 0) +- servevent(srn, sev, description, vpd, callouts); ++ servevent(srn, sev, description, vpd, callouts); + } + + /* ESM electronics */ +diff --git a/rtas_errd/dump.c b/rtas_errd/dump.c +index 6f8e2dc..237def4 100644 +--- a/rtas_errd/dump.c ++++ b/rtas_errd/dump.c +@@ -315,7 +315,12 @@ check_platform_dump(struct event *event) + setup_sigchld_handler(); + return; + } +- fgets(filename, DUMP_MAX_FNAME_LEN + 20, f); ++ if (!fgets(filename, DUMP_MAX_FNAME_LEN + 20, f)) { ++ dbg("Failed to collect filename info"); ++ spclose(f, cpid); ++ setup_sigchld_handler(); ++ return; ++ } + rc = spclose(f, cpid); + + setup_sigchld_handler(); +diff --git a/rtas_errd/ela.c b/rtas_errd/ela.c +index d9bfcc3..939f3ce 100644 +--- a/rtas_errd/ela.c ++++ b/rtas_errd/ela.c +@@ -1922,7 +1922,7 @@ process_v2_epow(struct event *event, int error_type) + { + int rc = 1; + int class; +- int *reg, rlen, ext_epow; ++ int *reg, rlen, ext_epow = 0; + + class = error_type & 0xFF; + diff --git a/SOURCES/ppc64-diag-2.7.4-lpdscriptloc.patch b/SOURCES/ppc64-diag-2.7.4-lpdscriptloc.patch new file mode 100644 index 00000000..0065fc23 --- /dev/null +++ b/SOURCES/ppc64-diag-2.7.4-lpdscriptloc.patch @@ -0,0 +1,57 @@ +diff --git a/lpd/scripts/lp_diag_notify b/lpd/scripts/lp_diag_notify +index 52dc242..f500299 100755 +--- a/lpd/scripts/lp_diag_notify ++++ b/lpd/scripts/lp_diag_notify +@@ -1,4 +1,4 @@ +-#!/usr/bin/perl -I /etc/ppc64-diag ++#!/usr/bin/perl -I /usr/libexec/ppc64-diag + # @file lp_diag_notify + # + # This script is to be registered with servicelog as a notification tool. +diff --git a/lpd/scripts/lp_diag_setup b/lpd/scripts/lp_diag_setup +index 8dabb75..4b4d0a2 100755 +--- a/lpd/scripts/lp_diag_setup ++++ b/lpd/scripts/lp_diag_setup +@@ -1,4 +1,4 @@ +-#!/usr/bin/perl -I /etc/ppc64-diag ++#!/usr/bin/perl -I /usr/libexec/ppc64-diag + # @file lp_diag_setup + # @brief Register/unregister Light Path notification tools + # with servicelog +@@ -91,10 +91,10 @@ sub unregister { + } + + @notification_tools = ( +- ["/etc/ppc64-diag/lp_diag_notify -e", ++ ["/usr/libexec/ppc64-diag/lp_diag_notify -e", + "--match='disposition>=1 and severity>=4 and serviceable=1' ". + "--type=EVENT --method=num_arg"], +- ["/etc/ppc64-diag/lp_diag_notify -r", ++ ["/usr/libexec/ppc64-diag/lp_diag_notify -r", + "--type=REPAIR --method=num_arg"], + ); + +diff -up ppc64-diag-2.7.4/lpd/Makefile.am.than ppc64-diag-2.7.4/lpd/Makefile.am +--- ppc64-diag-2.7.4/lpd/Makefile.am.than 2017-09-15 19:08:58.247913980 +0200 ++++ ppc64-diag-2.7.4/lpd/Makefile.am 2017-09-15 19:10:12.941556817 +0200 +@@ -46,16 +46,16 @@ all-local-lpd: + AM_LOCALS += all-local-lpd + + install-exec-hook-lpd: +- install -d --mode=755 $(DESTDIR)/etc/ppc64-diag +- install -D --mode=744 $(LPD_SCRIPT) $(DESTDIR)/etc/ppc64-diag/ ++ install -d --mode=755 $(DESTDIR)/usr/libexec/ppc64-diag ++ install -D --mode=744 $(LPD_SCRIPT) $(DESTDIR)/usr/libexec/ppc64-diag/ + $(LN_S) $(sbindir)/usysident $(DESTDIR)/$(sbindir)/usysattn + $(LN_S) $(sbindir)/usysident $(DESTDIR)/$(sbindir)/usysfault + + INSTALL_EXEC_HOOKS += install-exec-hook-lpd + + uninstall-hook-lpd: +- rm -f $(DESTDIR)/etc/ppc64-diag/lp_diag_setup +- rm -f $(DESTDIR)/etc/ppc64-diag/lp_diag_notify ++ rm -f $(DESTDIR)/usr/libexec/ppc64-diag/lp_diag_setup ++ rm -f $(DESTDIR)/usr/libexec/ppc64-diag/lp_diag_notify + rm -f $(sbindir)/usysattn + rm -f $(sbindir)/usysfault + diff --git a/SOURCES/ppc64-diag-2.7.4-messagecatalog-location.patch b/SOURCES/ppc64-diag-2.7.4-messagecatalog-location.patch new file mode 100644 index 00000000..c2a10677 --- /dev/null +++ b/SOURCES/ppc64-diag-2.7.4-messagecatalog-location.patch @@ -0,0 +1,77 @@ +diff --git a/ela/catalogs.h b/ela/catalogs.h +index ce68a86..f77ee01 100644 +--- a/ela/catalogs.h ++++ b/ela/catalogs.h +@@ -34,7 +34,7 @@ using namespace std; + #include + #include + +-#define ELA_CATALOG_DIR "/etc/ppc64-diag/message_catalog" ++#define ELA_CATALOG_DIR "/usr/share/ppc64-diag/message_catalog" + + class Parser { + protected: +diff --git a/ela/explain_syslog.cpp b/ela/explain_syslog.cpp +index f2ecc25..fc96334 100644 +--- a/ela/explain_syslog.cpp ++++ b/ela/explain_syslog.cpp +@@ -97,7 +97,7 @@ print_help(void) + printf( + "-b begin_time\tIgnore messages with timestamps prior to begin_time.\n" + "-C catalog_dir\tUse message catalog in catalog_dir. Defaults to\n" +-"\t\t\t/etc/ppc64-diag/message_catalog.\n" ++"\t\t\t/usr/share/ppc64-diag/message_catalog.\n" + "-d\t\tPrint debugging output on stderr.\n" + "-e end_time\tStop upon reading message with timestamp after end_time.\n" + "-h\t\tPrint this help text and exit.\n" +diff --git a/ela/syslog_to_svclog.cpp b/ela/syslog_to_svclog.cpp +index ca5cd2f..69a8db9 100644 +--- a/ela/syslog_to_svclog.cpp ++++ b/ela/syslog_to_svclog.cpp +@@ -682,7 +682,7 @@ print_help(void) + printf( + "-b begin_time\tIgnore messages with timestamps prior to begin_time.\n" + "-C catalog_dir\tUse message catalog in catalog_dir. Defaults to\n" +-"\t\t\t/etc/ppc64-diag/message_catalog.\n" ++"\t\t\t/usr/share/ppc64-diag/message_catalog.\n" + "-d\t\tPrint debugging output on stderr.\n" + "-e end_time\tStop upon reading message with timestamp after end_time.\n" + "-F\t\tDon't stop at EOF; process newly logged messages as they occur.\n" +diff -up ppc64-diag-2.7.4/ela/catalogs.h.than ppc64-diag-2.7.4/ela/catalogs.h +diff -up ppc64-diag-2.7.4/ela/Makefile.am.than ppc64-diag-2.7.4/ela/Makefile.am +--- ppc64-diag-2.7.4/ela/Makefile.am.than 2017-09-15 18:56:29.914492445 +0200 ++++ ppc64-diag-2.7.4/ela/Makefile.am 2017-09-15 19:00:31.470337345 +0200 +@@ -68,22 +68,22 @@ clean-local-ela: + CLEAN_LOCALS += clean-local-ela + + install-exec-hook-ela: +- install -d --mode=755 $(DESTDIR)/etc/ppc64-diag/message_catalog/with_regex/ +- install -D --mode=744 $(CATALOG) $(DESTDIR)/etc/ppc64-diag/message_catalog/ ++ install -d --mode=755 $(DESTDIR)/usr/share/ppc64-diag/message_catalog/with_regex/ ++ install -D --mode=744 $(CATALOG) $(DESTDIR)/usr/share/ppc64-diag/message_catalog/ + install -D --mode=744 $(CATALOG_REGEX) \ +- $(DESTDIR)/etc/ppc64-diag/message_catalog/with_regex/ ++ $(DESTDIR)/usr/share/ppc64-diag/message_catalog/with_regex/ + + INSTALL_EXEC_HOOKS += install-exec-hook-ela + + uninstall-hook-ela: +- rm -f $(DESTDIR)/etc/ppc64-diag/message_catalog/cxgb3 +- rm -f $(DESTDIR)/etc/ppc64-diag/message_catalog/e1000e +- rm -f $(DESTDIR)/etc/ppc64-diag/message_catalog/exceptions +- rm -f $(DESTDIR)/etc/ppc64-diag/message_catalog/reporters +- rm -f $(DESTDIR)/etc/ppc64-diag/message_catalog/gpfs +- rm -f $(DESTDIR)/etc/ppc64-diag/message_catalog/with_regex/cxgb3 +- rm -f $(DESTDIR)/etc/ppc64-diag/message_catalog/with_regex/e1000e +- rm -f $(DESTDIR)/etc/ppc64-diag/message_catalog/with_regex/gpfs ++ rm -f $(DESTDIR)/usr/share/ppc64-diag/message_catalog/cxgb3 ++ rm -f $(DESTDIR)/usr/share/ppc64-diag/message_catalog/e1000e ++ rm -f $(DESTDIR)/usr/share/ppc64-diag/message_catalog/exceptions ++ rm -f $(DESTDIR)/usr/share/ppc64-diag/message_catalog/reporters ++ rm -f $(DESTDIR)/usr/share/ppc64-diag/message_catalog/gpfs ++ rm -f $(DESTDIR)/usr/share/ppc64-diag/message_catalog/with_regex/cxgb3 ++ rm -f $(DESTDIR)/usr/share/ppc64-diag/message_catalog/with_regex/e1000e ++ rm -f $(DESTDIR)/usr/share/ppc64-diag/message_catalog/with_regex/gpfs + + UNINSTALL_HOOKS += uninstall-hook-ela + diff --git a/SOURCES/ppc64-diag-2.7.4-scriptlocation.patch b/SOURCES/ppc64-diag-2.7.4-scriptlocation.patch new file mode 100644 index 00000000..f1f4d142 --- /dev/null +++ b/SOURCES/ppc64-diag-2.7.4-scriptlocation.patch @@ -0,0 +1,122 @@ +diff -up ppc64-diag-2.7.4/scripts/Makefile.am.script_loc ppc64-diag-2.7.4/scripts/Makefile.am +--- ppc64-diag-2.7.4/scripts/Makefile.am.script_loc 2017-07-24 00:43:44.000000000 -0400 ++++ ppc64-diag-2.7.4/scripts/Makefile.am 2017-09-16 10:21:58.786296122 -0400 +@@ -11,21 +11,22 @@ INIT_FILES = scripts/rtas_errd scripts/o + SERVICE_SCRIPT = scripts/rtas_errd.service scripts/opal_errd.service + + install-exec-hook-scripts: ++ install -d --mode=755 $(DESTDIR)/usr/libexec/ppc64-diag/ ++ install -D --mode=744 $(PPC64_DIAG_SCRIPT) $(DESTDIR)/usr/libexec/ppc64-diag/ + install -d --mode=755 $(DESTDIR)/etc/ppc64-diag/ +- install -D --mode=744 $(PPC64_DIAG_SCRIPT) $(DESTDIR)/etc/ppc64-diag/ +- install -D --mode=644 $(CONFIG_FILE) $(DESTDIR)/etc/ppc64-diag ++ install -D --mode=644 $(CONFIG_FILE) $(DESTDIR)/etc/ppc64-diag/ + install -d --mode=755 $(DESTDIR)/usr/libexec/ppc64-diag/ + install -D --mode=755 $(INIT_FILES) $(DESTDIR)/usr/libexec/ppc64-diag/ + install -d --mode=755 $(DESTDIR)/usr/lib/systemd/system/ + install -D --mode=644 $(SERVICE_SCRIPT) $(DESTDIR)/usr/lib/systemd/system/ + + uninstall-hook-scripts: +- rm -f $(DESTDIR)/etc/ppc64-diag/ppc64_diag_setup +- rm -f $(DESTDIR)/etc/ppc64-diag/ppc64_diag_mkrsrc +- rm -f $(DESTDIR)/etc/ppc64-diag/ppc64_diag_notify +- rm -f $(DESTDIR)/etc/ppc64-diag/ppc64_diag_migrate +- rm -f $(DESTDIR)/etc/ppc64-diag/servevent_parse.pl +- rm -f $(DESTDIR)/etc/ppc64-diag/ppc64-diag.config ++ rm -f $(DESTDIR)/usr/libexec/ppc64-diag/ppc64_diag_setup ++ rm -f $(DESTDIR)/usr/libexec/ppc64-diag/ppc64_diag_mkrsrc ++ rm -f $(DESTDIR)/usr/libexec/ppc64-diag/ppc64_diag_notify ++ rm -f $(DESTDIR)/usr/libexec/ppc64-diag/ppc64_diag_migrate ++ rm -f $(DESTDIR)/usr/libexec/ppc64-diag/servevent_parse.pl ++ rm -f $(DESTDIR)/usr/libexec/ppc64-diag/ppc64-diag.config + rm -f $(DESTDIR)/usr/libexec/ppc64-diag/rtas_errd + rm -f $(DESTDIR)/usr/libexec/ppc64-diag/opal_errd + rm -f $(DESTDIR)/usr/lib/systemd/system/rtas_errd.service +diff -up ppc64-diag-2.7.4/scripts/ppc64_diag_mkrsrc.script_loc ppc64-diag-2.7.4/scripts/ppc64_diag_mkrsrc +--- ppc64-diag-2.7.4/scripts/ppc64_diag_mkrsrc.script_loc 2017-07-24 00:43:44.000000000 -0400 ++++ ppc64-diag-2.7.4/scripts/ppc64_diag_mkrsrc 2017-09-16 10:21:15.736295426 -0400 +@@ -1,4 +1,4 @@ +-#! /usr/bin/perl -I /etc/ppc64-diag ++#! /usr/bin/perl -I /usr/libexec/ppc64-diag + # + # This script is to be registered with servicelog as a notification tool. It + # is responsible for creating a new IBM.ServiceEvent RMC resource when a +@@ -27,7 +27,7 @@ + # along with this program; if not, write to the Free Software + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +-require "/etc/ppc64-diag/servevent_parse.pl"; ++require "/usr/libexec/ppc64-diag/servevent_parse.pl"; + + # Check to make sure that devices.chrp.base.ServiceRM is installed + $rc = system("which rpm >/dev/null 2>&1"); +diff -up ppc64-diag-2.7.4/scripts/ppc64_diag_notify.script_loc ppc64-diag-2.7.4/scripts/ppc64_diag_notify +--- ppc64-diag-2.7.4/scripts/ppc64_diag_notify.script_loc 2017-07-24 00:43:44.000000000 -0400 ++++ ppc64-diag-2.7.4/scripts/ppc64_diag_notify 2017-09-16 10:21:15.736295426 -0400 +@@ -1,4 +1,4 @@ +-#! /usr/bin/perl -I /etc/ppc64-diag ++#! /usr/bin/perl -I /usr/libexec/ppc64-diag + # + # This script is to be registered with servicelog as a notification tool. It + # is responsible for sending out e-mail notifications of new ppc64 platform +@@ -22,7 +22,7 @@ + + use Getopt::Long; + +-require "/etc/ppc64-diag/servevent_parse.pl"; ++require "/usr/libexec/ppc64-diag/servevent_parse.pl"; + + sub usage { + print "$0 [OPTIONS]\n"; +diff -up ppc64-diag-2.7.4/scripts/ppc64_diag_servagent.script_loc ppc64-diag-2.7.4/scripts/ppc64_diag_servagent +--- ppc64-diag-2.7.4/scripts/ppc64_diag_servagent.script_loc 2017-07-24 00:43:44.000000000 -0400 ++++ ppc64-diag-2.7.4/scripts/ppc64_diag_servagent 2017-09-16 10:21:15.736295426 -0400 +@@ -1,4 +1,4 @@ +-#! /usr/bin/perl -I /etc/ppc64-diag ++#! /usr/bin/perl -I /usr/libexec/ppc64-diag + # + # This script is to be registered with servicelog as a notification tool. It + # is responsible for invoking Electronic Service Agent in response to a +@@ -25,7 +25,7 @@ + # along with this program; if not, write to the Free Software + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +-require "/etc/ppc64-diag/servevent_parse.pl"; ++require "/usr/libexec/ppc64-diag/servevent_parse.pl"; + + if (!-e "/usr/svcagent/bin/callsa2") { + # eSA is not installed; exit quietly +diff -up ppc64-diag-2.7.4/scripts/ppc64_diag_setup.script_loc ppc64-diag-2.7.4/scripts/ppc64_diag_setup +--- ppc64-diag-2.7.4/scripts/ppc64_diag_setup.script_loc 2017-07-24 00:43:44.000000000 -0400 ++++ ppc64-diag-2.7.4/scripts/ppc64_diag_setup 2017-09-16 10:21:15.736295426 -0400 +@@ -89,15 +89,15 @@ sub unregister { + + @notification_tools = ( + +- ["/etc/ppc64-diag/ppc64_diag_notify -q -e root -l /var/log/platform", ++ ["/usr/libexec/ppc64-diag/ppc64_diag_notify -q -e root -l /var/log/platform", + "--match='serviceable=1' ". + "--type=EVENT --method=pairs_stdin"], + +- ["/etc/ppc64-diag/ppc64_diag_mkrsrc", ++ ["/usr/libexec/ppc64-diag/ppc64_diag_mkrsrc", + "--match='serviceable=1' ". + "--type=EVENT --method=pairs_stdin"], + +- ["/etc/ppc64-diag/ppc64_diag_migrate", ++ ["/usr/libexec/ppc64-diag/ppc64_diag_migrate", + "--match=\'refcode=\"#MIGRATE\" and serviceable=0\' ". + "--type=EVENT --method=pairs_stdin"], + ); +diff -up ppc64-diag-2.7.4/scripts/rtas_errd.script_loc ppc64-diag-2.7.4/scripts/rtas_errd +--- ppc64-diag-2.7.4/scripts/rtas_errd.script_loc 2017-09-16 10:21:15.726295425 -0400 ++++ ppc64-diag-2.7.4/scripts/rtas_errd 2017-09-16 10:21:15.736295426 -0400 +@@ -69,7 +69,7 @@ case "$1" in + echo "registering ppc64-diag with system" + rm -f /var/cache/ppc64-diag.registered + mkdir -v /var/cache/ppc64-diag.registered +- /etc/ppc64-diag/ppc64_diag_setup --register ++ /usr/libexec/ppc64-diag/ppc64_diag_setup --register + fi + echo -n "Starting rtas_errd (platform error handling) daemon: " + if [ $INSSERV -eq 1 ]; then diff --git a/SOURCES/ppc64-diag-tmpraces.patch b/SOURCES/ppc64-diag-tmpraces.patch new file mode 100644 index 00000000..f77bc698 --- /dev/null +++ b/SOURCES/ppc64-diag-tmpraces.patch @@ -0,0 +1,27 @@ +diff --git a/lpd/test/lpd_ela_test.sh b/lpd/test/lpd_ela_test.sh +index 0e0ebea..8f0c751 100755 +--- a/lpd/test/lpd_ela_test.sh ++++ b/lpd/test/lpd_ela_test.sh +@@ -22,7 +22,7 @@ EXECUTION_LOG="$LOG_DIR/$SCRIPT_NAME.log" + ERROR_LOG="$LOG_DIR/$SCRIPT_NAME.err" + + TMP_DIR="/var/tmp/ras" +-mkdir -p $TMP_DIR ++mkdir $TMP_DIR || exit 1 + MESSAGE_FILE="$TMP_DIR/messages" + TMP_FILE="$TMP_DIR/$SCRIPT_NAME.tmp" + +diff --git a/scripts/ppc64_diag_mkrsrc b/scripts/ppc64_diag_mkrsrc +index 6023a71..4df8b72 100755 +--- a/scripts/ppc64_diag_mkrsrc ++++ b/scripts/ppc64_diag_mkrsrc +@@ -149,7 +149,7 @@ if (-e "/proc/device-tree/ibm,converged-loc-codes") { + } + + # Retrieve Extended Error Data (EED) +-mkdir "/tmp/diagSEsnap", 0775; ++mkdir "/tmp/diagSEsnap", 0700 || die "mkdir failed: $!"; + $general_eed_file = "/tmp/diagSEsnap/snapH.tar.gz"; + system("/usr/sbin/snap -o $general_eed_file 2>/dev/null 1>&2"); + $cstop_eed_file = ""; + diff --git a/SOURCES/ppc64-diag-v2.7.4-create-diag_disk-log-directory-manually-if-not-present.patch b/SOURCES/ppc64-diag-v2.7.4-create-diag_disk-log-directory-manually-if-not-present.patch new file mode 100644 index 00000000..4d9f71a3 --- /dev/null +++ b/SOURCES/ppc64-diag-v2.7.4-create-diag_disk-log-directory-manually-if-not-present.patch @@ -0,0 +1,107 @@ +--- a/diags/diag_disk.c ++++ b/diags/diag_disk.c +@@ -38,7 +38,8 @@ + + #include "encl_util.h" + +-#define OUTPUT_PATH "/var/log/ppc64-diag/diag_disk" ++#define DIAG_OUTPUT_PATH "/var/log/ppc64-diag/" ++#define DISK_OUTPUT_PATH DIAG_OUTPUT_PATH"diag_disk" + #define SYSFS_SG_PATH "/sys/class/scsi_generic" + #define DEVICE_TREE "/proc/device-tree/" + #define DEVICE_TREE_SYSTEM_ID DEVICE_TREE"system-id" +@@ -142,12 +143,53 @@ + return 0; + } + +-static inline int open_output_xml_file(const char *xml_filename) ++static inline void dir_sync(char * path) ++{ ++ int dir_fd; ++ ++ dir_fd = open(path, O_RDONLY|O_DIRECTORY); ++ if (dir_fd >= 0) { ++ fsync(dir_fd); ++ close(dir_fd); ++ } ++} ++ ++static int open_output_xml_file(const char *xml_filename) + { + char filename[PATH_MAX]; ++ int rc; ++ ++ rc = access(DISK_OUTPUT_PATH, W_OK); ++ if (rc) { ++ /* Return if it fails with error code other than ENOENT */ ++ if (errno != ENOENT) ++ return -1; ++ ++ /* Check for the existence of parent directory */ ++ rc = access(DIAG_OUTPUT_PATH, W_OK); ++ if (rc) { ++ if (errno != ENOENT) ++ return -1; ++ ++ rc = mkdir(DIAG_OUTPUT_PATH, ++ S_IRGRP | S_IRUSR | S_IWGRP | S_IWUSR | S_IXUSR); ++ if (rc) ++ return -1; ++ ++ dir_sync(DIAG_OUTPUT_PATH); ++ } ++ ++ rc = mkdir(DISK_OUTPUT_PATH, ++ S_IRGRP | S_IRUSR | S_IWGRP | S_IWUSR | S_IXUSR); ++ if (rc) ++ return -1; ++ ++ dir_sync(DISK_OUTPUT_PATH); ++ } ++ + + snprintf(filename, sizeof(filename) - 1, "%s/%s", +- OUTPUT_PATH, xml_filename); ++ DISK_OUTPUT_PATH, xml_filename); + + result_file = fopen(filename, "w"); + if (!result_file) +@@ -349,9 +391,8 @@ + DIR *d; + struct dirent *namelist; + char filename[PATH_MAX]; +- int dir_fd; +- +- d = opendir(OUTPUT_PATH); ++ ++ d = opendir(DISK_OUTPUT_PATH); + if (!d) + return -errno; + +@@ -359,22 +400,17 @@ + if (namelist->d_name[0] == '.') + continue; + +- snprintf(filename, sizeof(filename) - 1, "%s/%s", OUTPUT_PATH, +- namelist->d_name); ++ snprintf(filename, sizeof(filename) - 1, "%s/%s", ++ DISK_OUTPUT_PATH, namelist->d_name); + if (unlink(filename) < 0) { + fprintf(stderr, + "\nUnable to remove old log file[%s]. continuing.\n\n", + filename); + } + } ++ + closedir(d); +- +- dir_fd = open(OUTPUT_PATH, O_RDONLY|O_DIRECTORY); +- if (dir_fd >= 0) { +- fsync(dir_fd); +- close(dir_fd); +- } +- ++ dir_sync(DISK_OUTPUT_PATH); + return 0; + } + diff --git a/SOURCES/ppc64-diag-v2.7.4-fix-service-scripts.patch b/SOURCES/ppc64-diag-v2.7.4-fix-service-scripts.patch new file mode 100644 index 00000000..b79ced08 --- /dev/null +++ b/SOURCES/ppc64-diag-v2.7.4-fix-service-scripts.patch @@ -0,0 +1,12 @@ +--- a/scripts/rtas_errd.service ++++ b/scripts/rtas_errd.service +@@ -1,7 +1,7 @@ + [Unit] + Description=ppc64-diag rtas_errd (platform error handling) Service +-ConditionPathExists=|!/proc/ppc64/rtas/error_log +-ConditionPathExists=|!/proc/ppc64/error_log ++ConditionPathExists=|/proc/ppc64/rtas/error_log ++ConditionPathExists=|/proc/ppc64/error_log + After=syslog.target + + [Service] diff --git a/SOURCES/ppc64-diag-v2.7.4-increase-buffer-length-size-to-read-complete-system-vpd-infomation.patch b/SOURCES/ppc64-diag-v2.7.4-increase-buffer-length-size-to-read-complete-system-vpd-infomation.patch new file mode 100644 index 00000000..0583df79 --- /dev/null +++ b/SOURCES/ppc64-diag-v2.7.4-increase-buffer-length-size-to-read-complete-system-vpd-infomation.patch @@ -0,0 +1,38 @@ +--- a/diags/diag_disk.c ++++ b/diags/diag_disk.c +@@ -44,6 +44,7 @@ + #define DEVICE_TREE_SYSTEM_ID DEVICE_TREE"system-id" + #define DEVICE_TREE_MODEL DEVICE_TREE"model" + ++#define BUFFER_LENGTH 16 + #define SERIAL_NUM_LEN 8 + #define MACHINE_MODEL_LEN 8 + +@@ -196,15 +197,15 @@ + int device_fd; + int rc; + int start_index = 0; +- char serial[SERIAL_NUM_LEN + 1] = {0}; +- char model[MACHINE_MODEL_LEN + 1] = {0}; ++ char serial[BUFFER_LENGTH] = {0}; ++ char model[BUFFER_LENGTH] = {0}; + char *temp; + + device_fd = open(DEVICE_TREE_SYSTEM_ID, O_RDONLY); + if (device_fd < 0) + return -1; + +- rc = read(device_fd, serial, SERIAL_NUM_LEN); ++ rc = read(device_fd, serial, BUFFER_LENGTH); + close(device_fd); + if (rc <= 0) + return -1; +@@ -218,7 +219,7 @@ + if (device_fd < 0) + return -1; + +- rc = read(device_fd, model, MACHINE_MODEL_LEN); ++ rc = read(device_fd, model, BUFFER_LENGTH); + close(device_fd); + if (rc <= 0) + return -1; diff --git a/SOURCES/ppc64-diag-v2.7.4-remove-timestamp-from-disk-health-log-file.patch b/SOURCES/ppc64-diag-v2.7.4-remove-timestamp-from-disk-health-log-file.patch new file mode 100644 index 00000000..226eac4f --- /dev/null +++ b/SOURCES/ppc64-diag-v2.7.4-remove-timestamp-from-disk-health-log-file.patch @@ -0,0 +1,52 @@ +--- a/diags/diag_disk.c ++++ b/diags/diag_disk.c +@@ -344,7 +344,7 @@ + return rc; + } + +-static int remove_old_log_file(char *xml_filename) ++static int remove_old_log_file(void) + { + DIR *d; + struct dirent *namelist; +@@ -357,9 +357,6 @@ + + while ((namelist = readdir(d)) != NULL) { + if (namelist->d_name[0] == '.') +- continue; +- +- if (!strcmp(xml_filename, namelist->d_name)) + continue; + + snprintf(filename, sizeof(filename) - 1, "%s/%s", OUTPUT_PATH, +@@ -416,10 +413,11 @@ + + /* file format */ + snprintf(xml_filename, sizeof(xml_filename) - 1, +- "%s~%s~%s~diskAnalytics~%d%02d%02d%02d%02d%02d.xml", +- mach_type_model, mach_model, serial_num, +- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, +- tm.tm_hour, tm.tm_min, tm.tm_sec); ++ "%s~%s~%s~diskAnalytics.xml", ++ mach_type_model, mach_model, serial_num); ++ ++ /* Try to remove old log file. We will continue even if this fails */ ++ remove_old_log_file(); + + /* open file */ + ret = open_output_xml_file(xml_filename); +@@ -441,12 +439,5 @@ + /* close output xml file descriptor */ + close_output_xml_file(); + +- /* remove old log file */ +- ret = remove_old_log_file(xml_filename); +- if (ret) { +- fprintf(stderr, "Unable to remove old output log file.\n"); +- return -1; +- } +- +- return 0; +-} ++ return 0; ++} diff --git a/SPECS/ppc64-diag.spec b/SPECS/ppc64-diag.spec new file mode 100644 index 00000000..d4c6a5c1 --- /dev/null +++ b/SPECS/ppc64-diag.spec @@ -0,0 +1,258 @@ +Name: ppc64-diag +Version: 2.7.4 +Release: 3%{?dist} +Summary: PowerLinux Platform Diagnostics +URL: http://sourceforge.net/projects/linux-diag/files/ppc64-diag/ +Group: System Environment/Base +License: GPLv2 +ExclusiveArch: ppc64 ppc64le +BuildRequires: libservicelog-devel, flex, perl, byacc, librtas-devel >= 1.4.0 +BuildRequires: libvpd-devel, systemd, systemd-devel +BuildRequires: ncurses-devel +BuildRequires: autoconf automake libtool +Requires(post): systemd +Requires(preun): systemd +Requires: servicelog, lsvpd >= 1.7.1 +# PRRN RTAS event notification handler depends on below librtas +# and powerpc-utils versions. +Requires: librtas +Requires: powerpc-utils >= 1.3.2 +Source0: http://downloads.sourceforge.net/project/linux-diag/ppc64-diag/v%{version}/%{name}-%{version}.tar.gz +Source1: rtas_errd.service + +Patch0: ppc64-diag-2.7.4-messagecatalog-location.patch +Patch1: ppc64-diag-2.4.2-chkconfig.patch +Patch2: ppc64-diag-2.7.4-scriptlocation.patch +Patch4: ppc64-diag-2.7.4-lpdscriptloc.patch +# patch5-patch9 fix bz#1525443, disk diagnostics issues +Patch5: ppc64-diag-v2.7.4-fix-service-scripts.patch +Patch6: ppc64-diag-v2.7.4-increase-buffer-length-size-to-read-complete-system-vpd-infomation.patch +Patch7: ppc64-diag-v2.7.4-remove-timestamp-from-disk-health-log-file.patch +Patch8: ppc64-diag-v2.7.4-create-diag_disk-log-directory-manually-if-not-present.patch +Patch9: ppc64-diag-2.7.4-fix-build-warning.patch +# patch from https://bugzilla.novell.com/show_bug.cgi?id=882667 +# attachment https://bugzilla.novell.com/attachment.cgi?id=599147 +# resolving https://bugzilla.redhat.com/show_bug.cgi?id=1109371 +Patch10: ppc64-diag-tmpraces.patch + +%description +This package contains various diagnostic tools for PowerLinux. +These tools captures the diagnostic events from Power Systems +platform firmware, SES enclosures and device drivers, and +write events to servicelog database. It also provides automated +responses to urgent events such as environmental conditions and +predictive failures, if appropriate modifies the FRUs fault +indicator(s) and provides event notification to system +administrators or connected service frameworks. + +# BZ#860040: +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}\/usr\/libexec\/ppc64-diag\/servevent_parse.pl + +%prep +%setup -q +%patch0 -p1 -b .msg_loc +%patch1 -p1 -b .chkconfig +%patch2 -p1 -b .script_loc +%patch4 -p1 -b .lpdscriptloc +%patch5 -p1 -b .fix-service-scripts +%patch6 -p1 -b .increase-buffer-length-size-to-read-complete-system-vpd-infomation +%patch7 -p1 -b .remove-timestamp-from-disk-health-log-file +%patch8 -p1 -b .create-diag_disk-log-directory-manually-if-not-present +%patch9 -p1 -b .fix-build-warning.patch +%patch10 -p1 -b .tmpraces + +%build +%global optflags %{optflags} -fno-strict-aliasing +./autogen.sh +%configure +make V=1 %{?_smp_mflags} + +%install +make install DESTDIR=$RPM_BUILD_ROOT +chmod 644 COPYING +rm -f $RPM_BUILD_ROOT/usr/share/doc/packages/ppc64-diag/COPYING +mkdir -p $RPM_BUILD_ROOT/%{_unitdir} +install -m644 %{SOURCE1} $RPM_BUILD_ROOT/%{_unitdir} +mkdir $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/ses_pages +mkdir -p $RPM_BUILD_ROOT/%{_var}/log/dump +#pushd $RPM_BUILD_ROOT/%{_sbindir}/ +#ln -sf usysattn usysfault +#ln -sf usysident usysattn +#popd +#rm -f $RPM_BUILD_ROOT%{_docdir}/%{name}/COPYING $RPM_BUILD_ROOT%{_docdir}/%{name}/README + +%files +%defattr (-,root,root,-) +%doc %{_docdir}/%{name}/COPYING +%doc %{_docdir}/%{name}/README +%dir %{_sysconfdir}/%{name} +%dir %{_sysconfdir}/%{name}/ses_pages +%dir %{_var}/log/ppc64-diag/diag_disk +%dir %{_var}/log/dump +%dir %{_datadir}/%{name} +%dir %{_datadir}/%{name}/message_catalog +%config(noreplace) %{_sysconfdir}/%{name}/ppc64-diag.config +%{_sbindir}/* +%{_mandir}/man8/* +%attr(755,root,root) %{_libexecdir}/%{name}/ppc64_diag_migrate +%attr(755,root,root) %{_libexecdir}/%{name}/ppc64_diag_mkrsrc +%attr(755,root,root) %{_libexecdir}/%{name}/ppc64_diag_notify +%attr(755,root,root) %{_libexecdir}/%{name}/ppc64_diag_setup +%attr(755,root,root) %{_libexecdir}/%{name}/lp_diag_setup +%attr(755,root,root) %{_libexecdir}/%{name}/lp_diag_notify +%attr(644,root,root) %{_libexecdir}/%{name}/servevent_parse.pl +%attr(644,root,root) %{_datadir}/%{name}/message_catalog/cxgb3 +%attr(644,root,root) %{_datadir}/%{name}/message_catalog/e1000e +%attr(644,root,root) %{_datadir}/%{name}/message_catalog/exceptions +%attr(644,root,root) %{_datadir}/%{name}/message_catalog/gpfs +%attr(644,root,root) %{_datadir}/%{name}/message_catalog/reporters +%attr(644,root,root) %{_datadir}/%{name}/message_catalog/with_regex/* +%attr(755,root,root) %{_sysconfdir}/rc.powerfail +%attr(755,root,root) %{_libexecdir}/%{name}/rtas_errd +%attr(755,root,root) %{_libexecdir}/%{name}/opal_errd +%attr(644,root,root) %{_unitdir}/rtas_errd.service +%attr(644,root,root) %{_unitdir}/opal_errd.service +%attr(755,root,root) /etc/cron.daily/run_diag_encl + +%post +# Post-install script -------------------------------------------------- +%{_libexecdir}/%{name}/lp_diag_setup --register >/dev/null +%{_libexecdir}/%{name}/ppc64_diag_setup --register >/dev/null +systemctl daemon-reload >/dev/null 2>&1 || : +if [ "$1" = "1" ]; then # first install + systemctl -q enable opal_errd.service >/dev/null 2>&1 || : + systemctl -q enable rtas_errd.service >/dev/null 2>&1 || : + systemctl start opal_errd.service >/dev/null 2>&1 || : + systemctl start rtas_errd.service >/dev/null 2>&1 || : +elif [ "$1" = "2" ]; then # upgrade + systemctl try-restart opal_errd.service >/dev/null 2>&1 || : + systemctl try-restart rtas_errd.service >/dev/null 2>&1 || : +fi + +%preun +# Pre-uninstall script ------------------------------------------------- +if [ "$1" = "0" ]; then # last uninstall + systemctl stop opal_errd.service >/dev/null 2>&1 || : + systemctl stop rtas_errd.service >/dev/null 2>&1 || : + systemctl -q disable opal_errd.service >/dev/null 2>&1 || : + systemctl -q disable rtas_errd.service >/dev/null 2>&1 || : + %{_libexecdir}/%{name}/ppc64_diag_setup --unregister >/dev/null + %{_libexecdir}/%{name}/lp_diag_setup --unregister >/dev/null +fi + +%triggerin -- librtas +# trigger on librtas upgrades ------------------------------------------ +if [ "$2" = "2" ]; then + systemctl try-restart opal_errd.service >/dev/null 2>&1 || : + systemctl try-restart rtas_errd.service >/dev/null 2>&1 || : +fi + + +%changelog +* Wed Dec 13 2017 Than Ngo - 2.7.4-3 +- Resolves: #1525443 - resolve disk diagnostics issues + +* Sat Sep 16 2017 Than Ngo - 2.7.4-2 +- Related: #1456537 - make verbose and build with -fno-strict-aliasing + +* Fri Sep 15 2017 Than Ngo - 2.7.4-1 +- Resolves: #1456537 - update to 2.7.4 + +* Fri May 19 2017 Than Ngo - 2.7.3-3 +- Resolves: #1452130 - display help and version information + +* Wed Mar 22 2017 Sinny Kumari - 2.7.3-2 +- Related: #1380656 - Rebuild due to soname change in librtas package + +* Mon Jan 23 2017 Rafael Fonseca - 2.7.3-1 +- Resolves: #1380649 - Update to 2.7.3 + +* Thu Jun 09 2016 Rafael Fonseca - 2.7.1-2 +- Resolves: #1343992 - opal_errd service fails to start + +* Wed May 18 2016 Rafael Fonseca - 2.7.1-1 +- Rebase to 2.7.1 +- Resolves: #1274398 - [7.3 FEAT] ppc64-diag package update - ppc64/ppc64le +- Resolves: #1302730 - [LEGAL] License change from EPL to the GNU GPL license + +* Thu Aug 27 2015 Jakub Čajka - 2.6.9-2 +- Resolves: #1257504 - opal-elog-parse -a does not display any results + +* Tue Jun 30 2015 Jakub Čajka - 2.6.9-1 +- Resolves: #1182027 - [7.2 FEAT] ppc64-diag package update - ppc64/ppc64le + +* Tue Jun 16 2015 Jakub Čajka - 2.6.8-1 +- Resolves: #1182027 - [7.2 FEAT] ppc64-diag package update - ppc64/ppc64le + +* Fri Jan 02 2015 Jakub Čajka - 2.6.7-6 +- Resolves: #1175808 - missing /var/log/dump directory + +* Thu Dec 04 2014 Jakub Čajka - 2.6.7-5 +- Resolves: #1170146 - ppc64-diag: rtas_errd is not started by default + +* Fri Nov 14 2014 Jakub Čajka - 2.6.7-4 +- Resolves: #1164148 - CVE-2014-4039 CVE-2014-4038 ppc64-diag: multiple temporary file races [rhel-7.1] + +* Mon Nov 10 2014 Jakub Čajka - 2.6.7-3 +- Related: #1160352 - use -fno-strict-aliasing during build + +* Mon Nov 10 2014 Jakub Čajka - 2.6.7-2 +- Resolves: #1160352 - ppc64-diag: please integrate additional LE fixes + +* Mon Aug 25 2014 Jakub Čajka - 2.6.7-1 +- Resolves: #1088493 - [7.1 FEAT] ppc64-diag package update - ppc64 +- Resolves: #1084062 - ppc64-diag: add support for hotplugging of qemu pci virtio devices +- Resolves: #1124007 - ppc64-diag needs ppc64le added to ExclusiveArch + +* Mon Mar 03 2014 Dan Horák - 2.6.1-4 +- modernize spec a bit and switch to verbose build in Makefiles +- use system-wide CFLAGS during build (#1070784) +- Resolves: #1070784 + +* Fri Dec 27 2013 Daniel Mach - 2.6.1-3 +- Mass rebuild 2013-12-27 + +* Tue May 21 2013 Vasant Hegde - 2.6.1-2 +- Add ncurses-devel as build dependency +- Fix script location issue + +* Mon May 20 2013 Vasant Hegde - 2.6.1 +- Update to latest upstream 2.6.1 + +* Thu Feb 14 2013 Fedora Release Engineering - 2.4.3-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Sep 26 2012 Karsten Hopp 2.4.3-6 +- revert permissions fix, filter requirement instead + +* Mon Sep 24 2012 karsten Hopp 2.4.3-4 +- fix permissions of servevent_parse.pl + +* Fri Jul 27 2012 Lukáš Nykrýn - 2.4.3-3 +- rename .service file +- auto start rtas_errd (#843471) + +* Sat Jul 21 2012 Fedora Release Engineering - 2.4.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri May 04 2012 Karsten Hopp 2.4.3-1 +- update to 2.4.3 + +* Wed Feb 15 2012 Karsten Hopp 2.4.2-5 +- don't strip binaries +- fix some build issues + +* Thu Sep 22 2011 Karsten Hopp 2.4.2-4 +- fix preun and post install scriptlets + +* Fri Sep 09 2011 Karsten Hopp 2.4.2-3 +- add buildrequirement systemd-units for _unitdir rpm macro +- move helper scripts to libexecdir/ppc64-diag + +* Wed Sep 07 2011 Karsten Hopp 2.4.2-2 +- additional fixes for Fedora package review (bugzilla #736062) + +* Wed Aug 17 2011 Karsten Hopp 2.4.2-1 +- initial Fedora version, based on IBM spec file with rpmlint cleanups + - move scripts to /usr/share/ppc-diag + - don't start service automatically after install