Hello community,

here is the log from the commit of package sysfsutils for openSUSE:Factory 
checked in at 2020-07-14 07:43:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/sysfsutils (Old)
 and      /work/SRC/openSUSE:Factory/.sysfsutils.new.3060 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "sysfsutils"

Tue Jul 14 07:43:46 2020 rev:26 rq:820021 version:2.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/sysfsutils/sysfsutils.changes    2020-06-30 
21:53:20.218178068 +0200
+++ /work/SRC/openSUSE:Factory/.sysfsutils.new.3060/sysfsutils.changes  
2020-07-14 07:43:58.630818643 +0200
@@ -1,0 +2,28 @@
+Fri Jul 10 15:52:03 UTC 2020 - Lee Duncan <[email protected]>
+
+- Updated to latest upstream, not yet tagged, by updating
+  sysfsutils-latest-changes.diff.gz. This adds the following
+  commits:
+  * Limit cdev name length comparsion to strlen()+1
+  * Fix issue with sysfs name comparisons.
+  * config.guess: linux - Add support for ppc64le machine
+  * path_is_file() should call stat(), not lstat()
+  * Ignore all cscope-generated files.
+  * Add a SUSE-specific libsysfs.conf.
+  * Use stat() not lstat() to find link target.
+  * Ignore more build files
+  * Fix more string issues for gcc-10
+  * Fix compiler complaint about string truncation.
+  * Fix compiler complain about multiple defs of my_stdout.
+  * Added ChangeLog entry for previous commits.
+  * Ignore various build files.
+  * fix of FUNC_TABLE_SIZE mentioned in prev commit
+  * Various changes to make gcc-7 happy.
+  * README: Update reporting bugs/contributions section
+  This removed the need for the 3 patches added previously,
+  now removed:
+  * 0001-Fix-compiler-complain-about-multiple-defs-of-my_stdo.patch
+  * 0002-Fix-compiler-complaint-about-string-truncation.patch
+  * 0003-Fix-more-string-issues-for-gcc-10.patch
+
+-------------------------------------------------------------------

Old:
----
  0001-Fix-compiler-complain-about-multiple-defs-of-my_stdo.patch
  0002-Fix-compiler-complaint-about-string-truncation.patch
  0003-Fix-more-string-issues-for-gcc-10.patch

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

Other differences:
------------------
++++++ sysfsutils.spec ++++++
--- /var/tmp/diff_new_pack.jCzp0o/_old  2020-07-14 07:44:00.262823911 +0200
+++ /var/tmp/diff_new_pack.jCzp0o/_new  2020-07-14 07:44:00.262823911 +0200
@@ -26,9 +26,6 @@
 Source:         %{name}-sysfsutils-2_1_0.tar.gz
 Source2:        baselibs.conf
 Patch1:         sysfsutils-latest-changes.diff.gz
-Patch2:         0001-Fix-compiler-complain-about-multiple-defs-of-my_stdo.patch
-Patch3:         0002-Fix-compiler-complaint-about-string-truncation.patch
-Patch4:         0003-Fix-more-string-issues-for-gcc-10.patch
 Provides:       libsysfs
 # bug437293
 %ifarch ppc64
@@ -67,9 +64,6 @@
 %prep
 %setup -n sysfsutils-sysfsutils-2_1_0
 %patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
 
 %build
 %global optflags %{optflags} -fcommon

++++++ sysfsutils-latest-changes.diff.gz ++++++
--- /var/tmp/diff_new_pack.jCzp0o/_old  2020-07-14 07:44:00.302824041 +0200
+++ /var/tmp/diff_new_pack.jCzp0o/_new  2020-07-14 07:44:00.310824066 +0200
@@ -1,14 +1,16 @@
 diff --git a/.gitignore b/.gitignore
 new file mode 100644
-index 000000000000..71c4db48620f
+index 000000000000..17b80af33854
 --- /dev/null
 +++ b/.gitignore
-@@ -0,0 +1,5 @@
+@@ -0,0 +1,7 @@
 +Makefile
 +autom4te.cache
 +config.*
 +stamp-h1
 +libtool
++tags
++cscope.*
 diff --git a/ChangeLog b/ChangeLog
 index 00277019c019..5f48a4e27cb4 100644
 --- a/ChangeLog
@@ -170,26 +172,16 @@
                unsigned int arg3, unsigned int arg4);
  extern void pci_free_name_list(struct pci_access *a);
 diff --git a/cmd/systool.c b/cmd/systool.c
-index aaa90a9e327e..e273e6bf92ec 100644
+index aaa90a9e327e..f4060f57a6ca 100644
 --- a/cmd/systool.c
 +++ b/cmd/systool.c
-@@ -32,14 +32,21 @@
+@@ -32,14 +32,12 @@
  #include "libsysfs.h"
  #include "names.h"
  
 -#define safestrcpy(to, from)  strncpy(to, from, sizeof(to)-1)
 -#define safestrcat(to, from)  strncat(to, from, sizeof(to) - strlen(to)-1)
-+inline void my_strncpy(char *to, const char *from, size_t max)
-+{
-+      size_t i;
-+
-+      for (i = 0; i < max && from[i] != '\0'; i++)
-+              to[i] = from[i];
-+      if (i < max)
-+              to[i] = '\0';
-+      else
-+              to[max-1] = '\0';
-+}
++extern char *my_strncpy(char *to, const char *from, size_t max);
 +#define safestrcpy(to, from)          my_strncpy(to, from, sizeof(to))
 +#define safestrcpymax(to, from, max)  my_strncpy(to, from, max)
  
@@ -198,11 +190,12 @@
 -      to[max-1] = '\0'; \
 -      strncpy(to, from, max-1); \
 -} while (0)
-+#define safestrcat(to, from)  strncat(to, from, sizeof(to) - strlen(to)-1)
++extern char *my_strncat(char *to, const char *from, size_t max);
++#define safestrcat(to, from)  my_strncat(to, from, sizeof(to) - strlen(to) - 
1)
  
  #define safestrcatmax(to, from, max) \
  do { \
-@@ -267,12 +274,13 @@ static void show_device(struct sysfs_device *device, int 
level)
+@@ -267,12 +265,13 @@ static void show_device(struct sysfs_device *device, int 
level)
                        attr = sysfs_open_attribute(path);
                        if (attr) {
                                if (!sysfs_read_attribute(attr)) {
@@ -221,7 +214,7 @@
                                                PCI_LOOKUP_VENDOR | 
                                                PCI_LOOKUP_DEVICE,
                                                vendor_id, device_id, 0, 0));
-@@ -690,6 +698,7 @@ int main(int argc, char *argv[])
+@@ -690,6 +689,7 @@ int main(int argc, char *argv[])
                        break;
                case 'm':
                        show_module = optarg;
@@ -229,6 +222,20 @@
                case 'p':
                        show_options |= SHOW_PATH;
                        break;
+diff --git a/config.guess b/config.guess
+index 2fc3acce2ea1..9b3e6741678c 100644
+--- a/config.guess
++++ b/config.guess
+@@ -864,6 +864,9 @@ EOF
+     ppc64:Linux:*:*)
+       echo powerpc64-${VENDOR:-unknown}-linux-gnu
+       exit 0 ;;
++    ppc64le:Linux:*:*)
++      echo powerpc64le-${VENDOR:-unknown}-linux-gnu
++      exit 0 ;;
+     alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
 diff --git a/config.h.in b/config.h.in
 index ac352fcf3d6b..86be81d5b049 100644
 --- a/config.h.in
@@ -16041,38 +16048,144 @@
  }
    
 diff --git a/lib/sysfs.h b/lib/sysfs.h
-index 76754a421649..ec9ba36b6eed 100644
+index 76754a421649..a9c14317ec4c 100644
 --- a/lib/sysfs.h
 +++ b/lib/sysfs.h
-@@ -33,14 +33,21 @@
+@@ -33,14 +33,12 @@
  #include <fcntl.h>
  #include <errno.h>
  
 -#define safestrcpy(to, from)  strncpy(to, from, sizeof(to)-1)
 -#define safestrcat(to, from)  strncat(to, from, sizeof(to) - strlen(to)-1)
-+inline void my_strncpy(char *to, const char *from, size_t max)
-+{
-+      size_t i;
++extern char *my_strncpy(char *to, const char *from, size_t max);
++#define safestrcpy(to, from)          my_strncpy(to, from, sizeof(to))
++#define safestrcpymax(to, from, max)  my_strncpy(to, from, max)
  
 -#define safestrcpymax(to, from, max) \
 -do { \
 -      to[max-1] = '\0'; \
 -      strncpy(to, from, max-1); \
 -} while (0)
++extern char *my_strncat(char *to, const char *from, size_t max);
++#define safestrcat(to, from)  my_strncat(to, from, sizeof(to) - strlen(to) - 
1)
+ 
+ #define safestrcatmax(to, from, max) \
+ do { \
+diff --git a/lib/sysfs_class.c b/lib/sysfs_class.c
+index 4fe0b82f2480..fcaa488b9943 100644
+--- a/lib/sysfs_class.c
++++ b/lib/sysfs_class.c
+@@ -60,13 +60,30 @@ void sysfs_close_class(struct sysfs_class *cls)
+       }
+ }
+ 
++/*
++ * pass this function to dlist_find_custom()
++ * so it can compare device names
++ *
++ * return 1 if pathnames are equal, else 0
++ */
+ static int cdev_name_equal(void *a, void *b)
+ {
++      size_t length_a, length_b;
++      char *str_a, *str_b;
++
+       if (!a || !b)
+               return 0;
+ 
+-      if (strncmp((char *)a, ((struct sysfs_class_device *)b)->name,
+-                              strlen((char *)a)) == 0)
++      str_a = (char *)a;
++      str_b = ((struct sysfs_class_device *)b)->name;
++
++      length_a = strnlen(str_a, SYSFS_NAME_LEN+1);
++      length_b = strnlen(str_b, SYSFS_NAME_LEN+1);
++
++      if (length_a != length_b)
++              return 0;
++
++      if (strncmp(str_a, str_b, length_a+1) == 0)
+               return 1;
+ 
+       return 0;
+diff --git a/lib/sysfs_utils.c b/lib/sysfs_utils.c
+index 9ca207c7f1f0..bddf72235ed7 100644
+--- a/lib/sysfs_utils.c
++++ b/lib/sysfs_utils.c
+@@ -152,12 +152,10 @@ int sysfs_get_link(const char *path, char *target, 
size_t len)
+                       else if (*(d+1) == '.')
+                               goto parse_path;
+                       s = strrchr(temp_path, '/');
+-                      if (s != NULL) {
+-                              *(s+1) = '\0';
+-                              safestrcat(temp_path, d);
+-                      } else {
++                      if (s != NULL)
++                              safestrcpy(s+1, d);
++                      else
+                               safestrcpy(temp_path, d);
+-                      }
+                       safestrcpymax(target, temp_path, len);
+                       break;
+                       /*
+@@ -187,12 +185,10 @@ parse_path:
+                       /* relative path from this directory */
+                       safestrcpy(temp_path, devdir);
+                       s = strrchr(temp_path, '/');
+-                      if (s != NULL) {
+-                              *(s+1) = '\0';
+-                              safestrcat(temp_path, linkpath);
+-                      } else {
++                      if (s != NULL)
++                              safestrcpy(s+1, linkpath);
++                      else
+                               safestrcpy(temp_path, linkpath);
+-                      }
+                       safestrcpymax(target, temp_path, len);
+       }
+       return 0;
+@@ -296,7 +292,7 @@ int sysfs_path_is_file(const char *path)
+               errno = EINVAL;
+               return 1;
+       }
+-      if ((lstat(path, &astats)) != 0) {
++      if ((stat(path, &astats)) != 0) {
+               dprintf("stat() failed\n");
+               return 1;
+       }
+@@ -305,3 +301,32 @@ int sysfs_path_is_file(const char *path)
+ 
+       return 1;
+ }
++
++/**
++ * my_strncpy -- a safe strncpy
++ */
++char *my_strncpy(char *to, const char *from, size_t max)
++{
++      size_t i;
++
 +      for (i = 0; i < max && from[i] != '\0'; i++)
 +              to[i] = from[i];
 +      if (i < max)
 +              to[i] = '\0';
 +      else
 +              to[max-1] = '\0';
++      return to;
 +}
-+#define safestrcpy(to, from)          my_strncpy(to, from, sizeof(to))
-+#define safestrcpymax(to, from, max)  my_strncpy(to, from, max)
 +
-+#define safestrcat(to, from)  strncat(to, from, sizeof(to) - strlen(to)-1)
- 
- #define safestrcatmax(to, from, max) \
- do { \
++/**
++ * my_strncpy -- a safe strncpy
++ */
++char *my_strncat(char *to, const char *from, size_t max)
++{
++      size_t i = 0;
++
++      while (i < max && to[i] != '\0')
++              i++;
++      my_strncpy(to+i, from, max-i);
++      return to;
++}
 diff --git a/test/.gitignore b/test/.gitignore
 new file mode 100644
 index 000000000000..016610120048
@@ -16138,24 +16251,138 @@
  
        if (argc != 3) {
                print_usage();
+diff --git a/test/libsysfs.conf-suse b/test/libsysfs.conf-suse
+new file mode 100644
+index 000000000000..8bf6fc7d6ace
+--- /dev/null
++++ b/test/libsysfs.conf-suse
+@@ -0,0 +1,87 @@
++# The config file for libsysfs testsuite
++# All values in this file are in relation to the sysfs filesystem only
++#
++# Values defined here will be used to dynamically build a header file that
++# gets used while compiling the testsuite.
++
++# NOTE NOTE NOTE: If you change values in this file, please make sure that
++# you run "make clean" and "make" (in the "test" directory) for the changes
++# to take effect.
++
++
++# A valid directory path under sysfs
++# A valid link name under a subidirectory of VALID_DIRECTORY_PATH... eg., if
++# the VALID_DIRECTORY_PATH is /sys/bus/pci, then enter a pci device name for
++# VALID SUBDIR_LINK_NAME
++VALID_DIRECTORY_PATH=/sys/bus/pci
++VALID_SUBDIR_LINK_NAME=0000:00:00.0
++
++# A valid link path under sysfs - enter the absolute path to a soft-link here
++VALID_LINK_PATH=/sys/block/sda/device
++
++# Absolute path to a regular (readable) attribute (a normal file) under sysfs
++VALID_FILE_PATH=/sys/block/sda/dev
++
++# A valid subsystem name - an entry under /sys
++VALID_SUBSYSTEM=bus
++
++# A valid bus name supported on this system
++# A device belonging to the bus
++# Absolute path to the device
++# A valid attribute defined for this device
++VALID_BUS_NAME=pci
++VALID_BUS_ID=0000:00:00.0
++VALID_DEVICE_PATH=/sys/devices/pci0000:00/0000:00:00.0
++VALID_DEVICE_ATTR=vendor
++
++# A valid attribute exported under VALID_BUS_NAME
++# NOTE: As of now, no buses export attributes, change this to a valid value
++#     when one becomes avaliable
++VALID_BUS_ATTR=online
++
++# A valid directory under /sys/devices
++# Its absolute path
++# A valid subdirectory under VALID_ROOT_PATH
++VALID_ROOT_NAME=pci0000:00
++VALID_ROOT_PATH=/sys/devices/pci0000:00
++VALID_SUBDIR_NAME=0000:00:00.0
++
++# A valid class - directory under /sys/class
++# A valid class_device belonging to the class - a dir under VALID_CLASS
++# Abslolute path to the VALID_CLASS_DEVICE
++# A valid attribute defined for the VALID_CLASS_DEVICE
++VALID_CLASS=net
++VALID_CLASS_DEVICE=ens33
++VALID_CLASS_DEVICE_PATH=/sys/class/net/ens33
++VALID_CLASS_DEV_ATTR=type
++
++# A valid directory path under /sys/block/xxx - preferably a partition
++VALID_BLOCK_DEV_PATH=/sys/block/sda/sda1
++
++# A valid driver (preferably a driver that exports readable attributes)
++# The absolute path to the driver
++# The bus the driver is registered on
++# A device that is using it and
++# A valid attribute corresponding to the driver
++VALID_DRIVER=e1000
++VALID_DRIVER_PATH=/sys/bus/pci/drivers/e1000
++VALID_DRIVER_BUS=pci
++VALID_DRIVER_DEVICE=0000:02:01.0
++VALID_DRIVER_ATTR=new_id
++
++# Another valid driver - but one that is not being used by any device
++# Absolute path to the driver
++# The bus the driver is registered
++VALID_DRIVER1=usbfs
++VALID_DRIVER1_PATH=/sys/bus/usb/drivers/usbfs
++VALID_DRIVER1_BUS=usb
++
++# Path to a writable attribute - make sure that the tester has permission to
++# "write" to the file at VALID_WRITE_ATTR_PATH
++VALID_WRITE_ATTR_PATH=/sys/class/net/ens33/tx_queue_len
++
++VALID_MODULE_PATH=/sys/module/usbcore
++VALID_MODULE=usbcore
++VALID_MODULE_ATTRIBUTE=refcnt
++VALID_MODULE_PARAM=blinkenlights
++VALID_MODULE_SECTION=__verbose
 diff --git a/test/test-defs.h b/test/test-defs.h
-index b22909a02b40..28af1a5521c1 100644
+index b22909a02b40..3378373db2e2 100644
 --- a/test/test-defs.h
 +++ b/test/test-defs.h
-@@ -40,7 +40,7 @@
+@@ -40,9 +40,9 @@
  #define val_drv1_attr_name    "dummy2"
  #define inval_name            "invalid_name"
  #define inval_path            "/sys/invalid/path"
 -#define FUNC_TABLE_SIZE       (sizeof(func_table)/sizeof(int))
 +#define FUNC_TABLE_SIZE       (sizeof(func_table) / sizeof(void *))
  
- FILE *my_stdout;
+-FILE *my_stdout;
++extern FILE *my_stdout;
+ 
+ #define dbg_print(format, arg...) fprintf(my_stdout, format, ## arg)
  
 diff --git a/test/test.c b/test/test.c
-index 2e8f201aeeeb..74db894ee19c 100644
+index 2e8f201aeeeb..41a470c00698 100644
 --- a/test/test.c
 +++ b/test/test.c
-@@ -309,7 +309,7 @@ int main(int argc, char *argv[])
+@@ -27,6 +27,8 @@
+ #include "test-defs.h"
+ #include <errno.h>
+ 
++FILE *my_stdout;
++
+ /*************************************************/
+ char *function_name[] = {
+       "sysfs_get_mnt_path",
+@@ -163,7 +165,7 @@ static int path_is_dir(const char *path)
+ {
+       struct stat astats;
+ 
+-      if ((lstat(path, &astats)) != 0)
++      if ((stat(path, &astats)) != 0)
+               goto direrr;
+ 
+       if (S_ISDIR(astats.st_mode))
+@@ -309,7 +311,7 @@ int main(int argc, char *argv[])
        for (k = 0; k < num ; k++) {
                dbg_print("\nThis is the %d test run\n", k+1);
  


Reply via email to