Hello community, here is the log from the commit of package ppc64-diag for openSUSE:Factory checked in at 2017-12-19 10:59:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ppc64-diag (Old) and /work/SRC/openSUSE:Factory/.ppc64-diag.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ppc64-diag" Tue Dec 19 10:59:23 2017 rev:40 rq:558183 version:2.7.4 Changes: -------- --- /work/SRC/openSUSE:Factory/ppc64-diag/ppc64-diag.changes 2017-10-23 16:53:52.927027170 +0200 +++ /work/SRC/openSUSE:Factory/.ppc64-diag.new/ppc64-diag.changes 2017-12-19 10:59:25.982611590 +0100 @@ -1,0 +2,12 @@ +Mon Dec 18 08:55:48 UTC 2017 - jloe...@suse.com + +- fix 'diag_encl -d' call (bsc#1072708) + +- added patches: + * ppc64-diag.bug-1072708_create_diag_disk_log_directory.patch + * ppc64-diag.bug-1072708_create_diag_disk_path.patch + * ppc64-diag.bug-1072708_fix_service_scripts.patch + * ppc64-diag.bug-1072708_increase_buffer_for_vpd.patch + * ppc64-diag.bug-1072708_remove_timestamp.patch + +------------------------------------------------------------------- New: ---- ppc64-diag.bug-1072708_create_diag_disk_log_directory.patch ppc64-diag.bug-1072708_create_diag_disk_path.patch ppc64-diag.bug-1072708_fix_service_scripts.patch ppc64-diag.bug-1072708_increase_buffer_for_vpd.patch ppc64-diag.bug-1072708_remove_timestamp.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ppc64-diag.spec ++++++ --- /var/tmp/diff_new_pack.SZSbMm/_old 2017-12-19 10:59:26.678577992 +0100 +++ /var/tmp/diff_new_pack.SZSbMm/_new 2017-12-19 10:59:26.682577799 +0100 @@ -53,6 +53,11 @@ Source0: http://downloads.sourceforge.net/project/linux-diag/ppc64-diag/v%{version}/%{name}-%{version}.tar.gz #PATCH-FIX-OPENSUSE - ppc64-diag.varunused.patch - fix unused variables Patch1: %{name}.varunused.patch +Patch2: ppc64-diag.bug-1072708_fix_service_scripts.patch +Patch3: ppc64-diag.bug-1072708_create_diag_disk_path.patch +Patch4: ppc64-diag.bug-1072708_increase_buffer_for_vpd.patch +Patch5: ppc64-diag.bug-1072708_remove_timestamp.patch +Patch6: ppc64-diag.bug-1072708_create_diag_disk_log_directory.patch %description This package contains various diagnostic tools for PowerLinux. @@ -71,6 +76,11 @@ %prep %setup -q %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 %build sed -i 's@/usr/libexec/ppc64-diag@%{_libexecdir}@g' scripts/opal_errd.service ++++++ ppc64-diag.bug-1072708_create_diag_disk_log_directory.patch ++++++ commit d2ec2733829b69f8b935f328f5cc2396e4c2af70 Author: Ankit Kumar <an...@linux.vnet.ibm.com> Date: Tue Dec 5 14:56:14 2017 +0530 diags: Create diag_disk log directory manually if not present disk diagnostics code populates disk health information under /var/log/ppc64-diag/diag_disk. If above path is not found then disk diagnostics will fail. This patch creates /var/log/ppc64-diag/diag_disk/ manually part of diag_disk code if not already created. It will help diag_disk code to remove dependency on ppc64-diag installation process. Signed-off-by: Ankit Kumar <an...@linux.vnet.ibm.com> [Removed inline function, renamed function name and also killed some of the redundant checks - Vasant] Signed-off-by: Vasant Hegde <hegdevas...@linux.vnet.ibm.com> Index: ppc64-diag-2.7.4/diags/diag_disk.c =================================================================== --- ppc64-diag-2.7.4.orig/diags/diag_disk.c +++ ppc64-diag-2.7.4/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 @@ static int get_page_34_data(int device_f 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) @@ -346,9 +388,8 @@ static int remove_old_log_file(void) 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; @@ -356,22 +397,17 @@ static int remove_old_log_file(void) 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); - } + closedir(d); + dir_sync(DISK_OUTPUT_PATH); return 0; } ++++++ ppc64-diag.bug-1072708_create_diag_disk_path.patch ++++++ commit d42252e93ea4a80fbad5646399f29ebe2a54013f Author: Ankit Kumar <an...@linux.vnet.ibm.com> Date: Mon Sep 25 12:36:24 2017 +0530 Create diag_disk path part of installation `make install` creates `/var/log/ppc64-diag/diag_disk` directory. But rpmbuild will not pick up this directory unless we specify explicitly under files section. Signed-off-by: Ankit Kumar <an...@linux.vnet.ibm.com> [Updated description - Vasant] Signed-off-by: Vasant Hegde <hegdevas...@linux.vnet.ibm.com> Index: ppc64-diag-2.7.4/ppc64-diag.spec.in =================================================================== --- ppc64-diag-2.7.4.orig/ppc64-diag.spec.in +++ ppc64-diag-2.7.4/ppc64-diag.spec.in @@ -61,6 +61,7 @@ mkdir -p $RPM_BUILD_ROOT/var/log/opal-el /usr/sbin/* %dir /etc/%{name} %dir /etc/%{name}/ses_pages +%dir /var/log/ppc64-diag/diag_disk %dir /var/log/dump %dir /var/log/opal-elog %config /etc/%{name}/* ++++++ ppc64-diag.bug-1072708_fix_service_scripts.patch ++++++ commit 608507ea8ed81209204feacbbde40e234d261141 Author: Vasant Hegde <hegdevas...@linux.vnet.ibm.com> Date: Wed Sep 13 21:54:45 2017 +0530 scripts: Fix service scripts By mistake I added wrong condition check which resulted in unnecessary log messages in PowerNV system. This patch fixes service script properly. Fixes: 1f49a51c (scripts: Improve service scripts) Reported-by: Frédéric Bonnard <fre...@linux.vnet.ibm.com> Signed-off-by: Vasant Hegde <hegdevas...@linux.vnet.ibm.com> Index: ppc64-diag-2.7.4/scripts/rtas_errd.service =================================================================== --- ppc64-diag-2.7.4.orig/scripts/rtas_errd.service +++ ppc64-diag-2.7.4/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] ++++++ ppc64-diag.bug-1072708_increase_buffer_for_vpd.patch ++++++ commit 1837ee17e201c66ed13ae1665a08a92fc42cb347 Author: Ankit Kumar <an...@linux.vnet.ibm.com> Date: Tue Dec 5 14:56:12 2017 +0530 diags: Increase buffer length size to read complete system vpd information System vpd information(system id, model) can have prefix substring as IBM and hence our buffer must handle those extra string to get correct serial number and model information. This patch increased buffer length to 16 bytes(8-serial/model number + 8 - to capture other substring). Signed-off-by: Ankit Kumar <an...@linux.vnet.ibm.com> Signed-off-by: Vasant Hegde <hegdevas...@linux.vnet.ibm.com> Index: ppc64-diag-2.7.4/diags/diag_disk.c =================================================================== --- ppc64-diag-2.7.4.orig/diags/diag_disk.c +++ ppc64-diag-2.7.4/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 @@ static int get_system_vpd(char *machine_ 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 @@ static int get_system_vpd(char *machine_ 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; ++++++ ppc64-diag.bug-1072708_remove_timestamp.patch ++++++ commit 7be810122b48af0c095c1d1d5e8bd0b124026ed4 Author: Ankit Kumar <an...@linux.vnet.ibm.com> Date: Tue Dec 5 14:56:13 2017 +0530 diags: Remove timestamp from disk health log file This patch removes timestamp from filename. Function call sequence is changed as old and new file will have same name. Signed-off-by: Ankit Kumar <an...@linux.vnet.ibm.com> [Modified to continue with file creation even if remove_old_log_file fails - Vasant] Signed-off-by: Vasant Hegde <hegdevas...@linux.vnet.ibm.com> Index: ppc64-diag-2.7.4/diags/diag_disk.c =================================================================== --- ppc64-diag-2.7.4.orig/diags/diag_disk.c +++ ppc64-diag-2.7.4/diags/diag_disk.c @@ -341,7 +341,7 @@ static int sysfs_sg_disk_scan(const char return rc; } -static int remove_old_log_file(char *xml_filename) +static int remove_old_log_file(void) { DIR *d; struct dirent *namelist; @@ -356,9 +356,6 @@ static int remove_old_log_file(char *xml if (namelist->d_name[0] == '.') continue; - if (!strcmp(xml_filename, namelist->d_name)) - continue; - snprintf(filename, sizeof(filename) - 1, "%s/%s", OUTPUT_PATH, namelist->d_name); if (unlink(filename) < 0) { @@ -413,10 +410,11 @@ int diag_disk(char *disk_name) /* 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); @@ -438,12 +436,5 @@ int diag_disk(char *disk_name) /* 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; }