Accepting request 817114 from home:lee_duncan:branches:Base:System
- fixes build issus on 64-bit ppc and s390 - 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, though the contents of the two are the same. OBS-URL: https://build.opensuse.org/request/show/817114 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysfsutils?expand=0&rev=18
This commit is contained in:
parent
01f455f368
commit
101c9a4968
@ -0,0 +1,41 @@
|
|||||||
|
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
|
||||||
|
|
90
0002-Fix-compiler-complaint-about-string-truncation.patch
Normal file
90
0002-Fix-compiler-complaint-about-string-truncation.patch
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
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
|
||||||
|
|
98
0003-Fix-more-string-issues-for-gcc-10.patch
Normal file
98
0003-Fix-more-string-issues-for-gcc-10.patch
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
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 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:65c7258f3c006f07078506c227acb94c2c4e451eab7cce7095e9e2cf283fd1de
|
|
||||||
size 1071810
|
|
File diff suppressed because it is too large
Load Diff
3
sysfsutils-latest-changes.diff.gz
Normal file
3
sysfsutils-latest-changes.diff.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:94bed9464795c88c2ebc1a238d6f0975c5cdd43f7b096e38bbf67ad4902dedbb
|
||||||
|
size 93372
|
3
sysfsutils-sysfsutils-2_1_0.tar.gz
Normal file
3
sysfsutils-sysfsutils-2_1_0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:035cd517c2465fa86e4f82d035ae5817d9a8b23ba2ba42fe623eb36d3d9b973f
|
||||||
|
size 398079
|
@ -1,3 +1,20 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jun 25 17:20:08 UTC 2020 - Lee Duncan <lduncan@suse.com>
|
||||||
|
|
||||||
|
- 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,
|
||||||
|
though the contents of the two are the same.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Apr 27 19:28:46 UTC 2020 - Martin Liška <mliska@suse.cz>
|
Mon Apr 27 19:28:46 UTC 2020 - Martin Liška <mliska@suse.cz>
|
||||||
|
|
||||||
|
@ -22,10 +22,13 @@ License: LGPL-2.1-or-later
|
|||||||
Group: System/Libraries
|
Group: System/Libraries
|
||||||
Version: 2.1.0
|
Version: 2.1.0
|
||||||
Release: 0
|
Release: 0
|
||||||
URL: http://linux-diag.sourceforge.net
|
URL: https://github.com/linux-ras/sysfsutils
|
||||||
Source: http://aleron.dl.sourceforge.net/sourceforge/linux-diag/%{name}-%{version}.tar.gz
|
Source: %{name}-sysfsutils-2_1_0.tar.gz
|
||||||
Source2: baselibs.conf
|
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
|
Provides: libsysfs
|
||||||
# bug437293
|
# bug437293
|
||||||
%ifarch ppc64
|
%ifarch ppc64
|
||||||
@ -62,8 +65,11 @@ for the current users, but no new software should use this library.
|
|||||||
This package contains the development files for libsysfs.
|
This package contains the development files for libsysfs.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -n sysfsutils-sysfsutils-2_1_0
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
%patch4 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%global optflags %{optflags} -fcommon
|
%global optflags %{optflags} -fcommon
|
||||||
|
Loading…
x
Reference in New Issue
Block a user