Accepting request 820020 from home:lee_duncan:branches:Base:System
- 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 OBS-URL: https://build.opensuse.org/request/show/820020 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysfsutils?expand=0&rev=22
This commit is contained in:
parent
d98bd7ca0d
commit
6c198beba6
@ -1,41 +0,0 @@
|
||||
From 65381221fca3a4bba17bd54054ad542a64ee3899 Mon Sep 17 00:00:00 2001
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
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
|
||||
|
@ -1,90 +0,0 @@
|
||||
From 904296fbead9abe3369c3e455cd5cbf8c03419eb Mon Sep 17 00:00:00 2001
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
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
|
||||
|
@ -1,98 +0,0 @@
|
||||
From 0719881cad85f837f039ecb378b823306640902a Mon Sep 17 00:00:00 2001
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
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
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:94bed9464795c88c2ebc1a238d6f0975c5cdd43f7b096e38bbf67ad4902dedbb
|
||||
size 93372
|
||||
oid sha256:d40b0f1b906e3e99609797b9f56afcf189f21ccb0e1e5fd2fa1872381b1b18ab
|
||||
size 95536
|
||||
|
@ -1,3 +1,31 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 10 15:52:03 UTC 2020 - Lee Duncan <lduncan@suse.com>
|
||||
|
||||
- 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
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Jun 28 21:15:38 UTC 2020 - Lee Duncan <lduncan@suse.com>
|
||||
|
||||
|
@ -26,9 +26,6 @@ URL: https://github.com/linux-ras/sysfsutils
|
||||
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 @@ This package contains the development files for libsysfs.
|
||||
%prep
|
||||
%setup -n sysfsutils-sysfsutils-2_1_0
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
%build
|
||||
%global optflags %{optflags} -fcommon
|
||||
|
Loading…
Reference in New Issue
Block a user