Hello community, here is the log from the commit of package sysfsutils for openSUSE:Factory checked in at 2020-06-30 21:53:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sysfsutils (Old) and /work/SRC/openSUSE:Factory/.sysfsutils.new.3060 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sysfsutils" Tue Jun 30 21:53:12 2020 rev:25 rq:817560 version:2.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/sysfsutils/sysfsutils.changes 2020-04-29 20:43:24.295802608 +0200 +++ /work/SRC/openSUSE:Factory/.sysfsutils.new.3060/sysfsutils.changes 2020-06-30 21:53:20.218178068 +0200 @@ -1,0 +2,19 @@ +Sun Jun 28 21:15:38 UTC 2020 - Lee Duncan <[email protected]> + +- Added a _service file, as per new OBS requirement +- Added a patch to bring sysfsutils up to latest upstream, which + now is in place: + * sysfsutils-latest-changes.diff.gz +- Added patches which have been submitted upstream but not yet + merged: + * 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 + And removing a patch that's subsumed by the above patches: + * sysfsutils-fix-compiler-issues.patch + Lastly, replaced the hand-rolled sysfsutils-2.1.0.tar.gz with + upstream archive file sysfsutils-sysfsutils-2_1_0.tar.gz + (retreived with OBS download service), though the contents + of the two are the same. + +------------------------------------------------------------------- Old: ---- sysfsutils-2.1.0.tar.gz sysfsutils-fix-compiler-issues.patch New: ---- 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 _service sysfsutils-latest-changes.diff.gz sysfsutils-sysfsutils-2_1_0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sysfsutils.spec ++++++ --- /var/tmp/diff_new_pack.buFXbb/_old 2020-06-30 21:53:21.074180717 +0200 +++ /var/tmp/diff_new_pack.buFXbb/_new 2020-06-30 21:53:21.078180729 +0200 @@ -22,10 +22,13 @@ Group: System/Libraries Version: 2.1.0 Release: 0 -URL: http://linux-diag.sourceforge.net -Source: http://aleron.dl.sourceforge.net/sourceforge/linux-diag/%{name}-%{version}.tar.gz +URL: https://github.com/linux-ras/sysfsutils +Source: %{name}-sysfsutils-2_1_0.tar.gz Source2: baselibs.conf -Patch1: %{name}-fix-compiler-issues.patch +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 @@ -62,8 +65,11 @@ This package contains the development files for libsysfs. %prep -%setup -q +%setup -n sysfsutils-sysfsutils-2_1_0 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build %global optflags %{optflags} -fcommon ++++++ 0001-Fix-compiler-complain-about-multiple-defs-of-my_stdo.patch ++++++ >From 65381221fca3a4bba17bd54054ad542a64ee3899 Mon Sep 17 00:00:00 2001 From: Lee Duncan <[email protected]> Date: Wed, 24 Jun 2020 11:07:53 -0700 Subject: [PATCH 1/6] Fix compiler complain about multiple defs of my_stdout. A simple fix: define it in one place, refer to it elsewhere. --- test/test-defs.h | 2 +- test/test.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test-defs.h b/test/test-defs.h index 28af1a5521c1..3378373db2e2 100644 --- a/test/test-defs.h +++ b/test/test-defs.h @@ -42,7 +42,7 @@ #define inval_path "/sys/invalid/path" #define FUNC_TABLE_SIZE (sizeof(func_table) / sizeof(void *)) -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 74db894ee19c..ab2397d1c847 100644 --- a/test/test.c +++ b/test/test.c @@ -27,6 +27,8 @@ #include "test-defs.h" #include <errno.h> +FILE *my_stdout; + /*************************************************/ char *function_name[] = { "sysfs_get_mnt_path", -- 2.26.2 ++++++ 0002-Fix-compiler-complaint-about-string-truncation.patch ++++++ >From 904296fbead9abe3369c3e455cd5cbf8c03419eb Mon Sep 17 00:00:00 2001 From: Lee Duncan <[email protected]> Date: Wed, 24 Jun 2020 11:09:30 -0700 Subject: [PATCH 2/6] Fix compiler complaint about string truncation. The compiler didn't like having to my_strncat()s defined, so define it in one place, and refer to it elsewhere. The string copying in this is still kind of crazy, but it seems to work, and if the compiler can be happy, so can I. --- cmd/systool.c | 12 +----------- lib/sysfs.h | 12 +----------- lib/sysfs_utils.c | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/cmd/systool.c b/cmd/systool.c index e273e6bf92ec..45ed36db1d54 100644 --- a/cmd/systool.c +++ b/cmd/systool.c @@ -32,17 +32,7 @@ #include "libsysfs.h" #include "names.h" -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) diff --git a/lib/sysfs.h b/lib/sysfs.h index ec9ba36b6eed..481c1e9b7cf2 100644 --- a/lib/sysfs.h +++ b/lib/sysfs.h @@ -33,17 +33,7 @@ #include <fcntl.h> #include <errno.h> -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) diff --git a/lib/sysfs_utils.c b/lib/sysfs_utils.c index 9ca207c7f1f0..43df36fb972c 100644 --- a/lib/sysfs_utils.c +++ b/lib/sysfs_utils.c @@ -305,3 +305,19 @@ 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; +} -- 2.26.2 ++++++ 0003-Fix-more-string-issues-for-gcc-10.patch ++++++ >From 0719881cad85f837f039ecb378b823306640902a Mon Sep 17 00:00:00 2001 From: Lee Duncan <[email protected]> Date: Thu, 25 Jun 2020 08:05:18 -0700 Subject: [PATCH 3/6] Fix more string issues for gcc-10 These issues only surfaced for 64-bit PPC and for s390, having to do with the home-grown strncat() the code was using, which was just a macro. --- cmd/systool.c | 3 ++- lib/sysfs.h | 3 ++- lib/sysfs_utils.c | 29 +++++++++++++++++++---------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/cmd/systool.c b/cmd/systool.c index 45ed36db1d54..f4060f57a6ca 100644 --- a/cmd/systool.c +++ b/cmd/systool.c @@ -36,7 +36,8 @@ 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 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 { \ diff --git a/lib/sysfs.h b/lib/sysfs.h index 481c1e9b7cf2..a9c14317ec4c 100644 --- a/lib/sysfs.h +++ b/lib/sysfs.h @@ -37,7 +37,8 @@ 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 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 { \ diff --git a/lib/sysfs_utils.c b/lib/sysfs_utils.c index 43df36fb972c..bd6f9c1b082b 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; @@ -321,3 +317,16 @@ char *my_strncpy(char *to, const char *from, size_t max) to[max-1] = '\0'; return to; } + +/** + * 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; +} -- 2.26.2 ++++++ _service ++++++ <services> <service name="download_url" mode="disabled"> <param name="protocol">https</param> <param name="host">github.com</param> <param name="filename">sysfsutils-sysfsutils-2_1_0.tar.gz</param> <param name="path">linux-ras/sysfsutils/archive/sysfsutils-2_1_0.tar.gz</param> </service> <service name="verify_file" mode="disabled"> <param name="file">sysfsutils-sysfsutils-2_1_0.tar.gz</param> <param name="verifier">sha256</param> <param name="checksum">035cd517c2465fa86e4f82d035ae5817d9a8b23ba2ba42fe623eb36d3d9b973f</param> </service> </services> ++++++ sysfsutils-latest-changes.diff.gz ++++++ ++++ 16178 lines (skipped)
