Use new upstream tarball, backport relevant upstream fixes up to commit b688c65
The new tarball hosted on GitHub is not identical to the original one, but contains no functional differences All of Fedora's patches to sysfsutils 2.1.0 have been merged upstream and will be included in the next sysfsutils release. This commit incorporates all previous patches. Additionally, it backports various fixes added upstream, that mainly deal with compiler warnings when using moden compilers.
This commit is contained in:
parent
6c48bfb3e5
commit
c1dfc3ce6e
40
0001-update-README.patch
Normal file
40
0001-update-README.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From a9957ec35dfd2368c25d02b27859066299cf849c Mon Sep 17 00:00:00 2001
|
||||
From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
|
||||
Date: Wed, 26 Feb 2020 19:22:54 +0530
|
||||
Subject: [PATCH 1/8] README: Update reporting bugs/contributions section
|
||||
|
||||
We have moved to a new home at GitHub. Update the reporting
|
||||
bugs/contributions sections to reflect GitHub's work flow.
|
||||
|
||||
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
|
||||
---
|
||||
README | 15 ++++++++++-----
|
||||
1 file changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/README b/README
|
||||
index 6deefcf..bd1f832 100644
|
||||
--- a/README
|
||||
+++ b/README
|
||||
@@ -62,9 +62,14 @@ sysfsutils/lib/LGPL
|
||||
4. Reporting Bugs
|
||||
-----------------
|
||||
|
||||
-Please direct all bugs to either the linux-diag mailing list -
|
||||
-linux-diag-devel@lists.sourceforge.net - or to the authors:
|
||||
+Feel free to report bugs by opening an issue in the GitHub Issue Tracker.
|
||||
|
||||
-Ananth Mavinakayanahalli <ananth@in.ibm.com>
|
||||
-Daniel Stekloff <dsteklof@us.ibm.com>
|
||||
-Mohan Kumar <mohan@in.ibm.com>
|
||||
+5. Contributions
|
||||
+----------------
|
||||
+
|
||||
+For submitting patches, open a GitHub pull request. Please make sure that they
|
||||
+are rebased on top of the current master. Code submission guidelines are the
|
||||
+same as the Linux Kernel contribution guidelines.
|
||||
+
|
||||
+You probably want to read the through Linux kernel Documentation/SubmittingPatches
|
||||
+for guidance.
|
||||
--
|
||||
2.28.0
|
||||
|
||||
16225
0002-fix-compiler-complaints.patch
Normal file
16225
0002-fix-compiler-complaints.patch
Normal file
File diff suppressed because it is too large
Load Diff
43
0003-use-stat-not-lstat.patch
Normal file
43
0003-use-stat-not-lstat.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From 88b1ba388e6908e1bca3ef1779325e5b9a688f9c Mon Sep 17 00:00:00 2001
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
Date: Thu, 25 Jun 2020 10:04:40 -0700
|
||||
Subject: [PATCH 3/8] Use stat() not lstat() to find link target.
|
||||
|
||||
The test was backwards? We are trying to find what the
|
||||
link points at, not info about the link.
|
||||
|
||||
path_is_file() should call stat(), not lstat()
|
||||
---
|
||||
lib/sysfs_utils.c | 2 +-
|
||||
test/test.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/sysfs_utils.c b/lib/sysfs_utils.c
|
||||
index bd6f9c1..bddf722 100644
|
||||
--- a/lib/sysfs_utils.c
|
||||
+++ b/lib/sysfs_utils.c
|
||||
@@ -292,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;
|
||||
}
|
||||
diff --git a/test/test.c b/test/test.c
|
||||
index ab2397d..41a470c 100644
|
||||
--- a/test/test.c
|
||||
+++ b/test/test.c
|
||||
@@ -165,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))
|
||||
--
|
||||
2.28.0
|
||||
|
||||
31
0004-support-ppc64le.patch
Normal file
31
0004-support-ppc64le.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From d4a7c673f65ac4ed257be7d3c380108a88f5c510 Mon Sep 17 00:00:00 2001
|
||||
From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
|
||||
Date: Mon, 29 Jun 2020 14:26:30 +0530
|
||||
Subject: [PATCH 4/8] config.guess: linux - Add support for ppc64le machine
|
||||
|
||||
Configure fails to guess ppc64le machine type under the Linux system.
|
||||
This patch adds support to recognize ppc64le by adding it to the list
|
||||
of valid Linux systems.
|
||||
|
||||
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
|
||||
---
|
||||
config.guess | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/config.guess b/config.guess
|
||||
index 2fc3acc..9b3e674 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 ;;
|
||||
--
|
||||
2.28.0
|
||||
|
||||
58
0005-fix-sysfs-name-comparisons.patch
Normal file
58
0005-fix-sysfs-name-comparisons.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 0277758bed2870a6feb3757ffd88930b7128f31a Mon Sep 17 00:00:00 2001
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
Date: Fri, 3 Jul 2020 11:14:20 -0700
|
||||
Subject: [PATCH 5/8] Fix issue with sysfs name comparisons.
|
||||
|
||||
It turns out that cdev_name_equal() is used
|
||||
by dlist_find_custom() to compare sysfs
|
||||
entry names to ones already seen. But it was
|
||||
comparing using the length of the shortest string
|
||||
as a maximum, so when it compared, for example,
|
||||
"eth1" and "eth10", it thought they were the same.
|
||||
So now just return failure if the strings
|
||||
aren't the same length, else go ahead and
|
||||
compare them.
|
||||
---
|
||||
lib/sysfs_class.c | 21 +++++++++++++++++++--
|
||||
1 file changed, 19 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/sysfs_class.c b/lib/sysfs_class.c
|
||||
index 4fe0b82..c696ff0 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, SYSFS_NAME_LEN+1) == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
--
|
||||
2.28.0
|
||||
|
||||
30
0006-limit-cdev-name-length-comparsion.patch
Normal file
30
0006-limit-cdev-name-length-comparsion.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 34df9af8e15e331f45c3a453852d5a24486744ed Mon Sep 17 00:00:00 2001
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
Date: Wed, 8 Jul 2020 11:17:18 -0700
|
||||
Subject: [PATCH 6/8] Limit cdev name length comparsion to strlen()+1
|
||||
|
||||
In commit 270af678d4241306 cdev_name_equal() was updated
|
||||
so that "eth1" and "eth10" did not match, but the limit
|
||||
on the length of the compare was too large, as we know
|
||||
the length of both strings. This is just a cleanup, and
|
||||
should cause no functional change.
|
||||
---
|
||||
lib/sysfs_class.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/sysfs_class.c b/lib/sysfs_class.c
|
||||
index c696ff0..fcaa488 100644
|
||||
--- a/lib/sysfs_class.c
|
||||
+++ b/lib/sysfs_class.c
|
||||
@@ -83,7 +83,7 @@ static int cdev_name_equal(void *a, void *b)
|
||||
if (length_a != length_b)
|
||||
return 0;
|
||||
|
||||
- if (strncmp(str_a, str_b, SYSFS_NAME_LEN+1) == 0)
|
||||
+ if (strncmp(str_a, str_b, length_a+1) == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
--
|
||||
2.28.0
|
||||
|
||||
175
0007-fix-sysfs_get_link.patch
Normal file
175
0007-fix-sysfs_get_link.patch
Normal file
@ -0,0 +1,175 @@
|
||||
From b93c115b71c08a2f19262e6adccfdb5a5e5b2a78 Mon Sep 17 00:00:00 2001
|
||||
From: Christopher Engelhard <ce@lcts.de>
|
||||
Date: Tue, 28 Jul 2020 17:35:05 +0200
|
||||
Subject: [PATCH 7/8] Fix bug in sysfs_get_link
|
||||
|
||||
This fixes RHBZ #447220/Debian Bug #481015 by applying the patch
|
||||
provided in those bugs.
|
||||
---
|
||||
lib/sysfs_utils.c | 128 +++++++++++++++++++++++++++-------------------
|
||||
1 file changed, 76 insertions(+), 52 deletions(-)
|
||||
|
||||
diff --git a/lib/sysfs_utils.c b/lib/sysfs_utils.c
|
||||
index bddf722..e9bc555 100644
|
||||
--- a/lib/sysfs_utils.c
|
||||
+++ b/lib/sysfs_utils.c
|
||||
@@ -117,80 +117,104 @@ int sysfs_get_link(const char *path, char *target, size_t len)
|
||||
{
|
||||
char devdir[SYSFS_PATH_MAX];
|
||||
char linkpath[SYSFS_PATH_MAX];
|
||||
- char temp_path[SYSFS_PATH_MAX];
|
||||
- char *d = NULL, *s = NULL;
|
||||
- int slashes = 0, count = 0;
|
||||
+ char *d, *s;
|
||||
+ int count;
|
||||
|
||||
if (!path || !target || len == 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
- memset(devdir, 0, SYSFS_PATH_MAX);
|
||||
- memset(linkpath, 0, SYSFS_PATH_MAX);
|
||||
- memset(temp_path, 0, SYSFS_PATH_MAX);
|
||||
- safestrcpy(devdir, path);
|
||||
-
|
||||
- if ((readlink(path, linkpath, SYSFS_PATH_MAX)) < 0) {
|
||||
+ count = readlink(path, linkpath, SYSFS_PATH_MAX);
|
||||
+ if (count < 0)
|
||||
return -1;
|
||||
- }
|
||||
- d = linkpath;
|
||||
+ else
|
||||
+ linkpath[count] = '\0';
|
||||
/*
|
||||
* Three cases here:
|
||||
* 1. relative path => format ../..
|
||||
* 2. absolute path => format /abcd/efgh
|
||||
* 3. relative path _from_ this dir => format abcd/efgh
|
||||
*/
|
||||
- switch (*d) {
|
||||
- case '.':
|
||||
+ if (*linkpath == '/') {
|
||||
+ /* absolute path - copy as is */
|
||||
+ safestrcpymax(target, linkpath, len);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ safestrcpy(devdir, path);
|
||||
+ s = strrchr(devdir, '/');
|
||||
+ if (s == NULL)
|
||||
+ s = devdir - 1;
|
||||
+ d = linkpath;
|
||||
+ while (*d == '.') {
|
||||
+ if (*(d+1) == '/') {
|
||||
/*
|
||||
* handle the case where link is of type ./abcd/xxx
|
||||
*/
|
||||
- safestrcpy(temp_path, devdir);
|
||||
- if (*(d+1) == '/')
|
||||
- d += 2;
|
||||
- else if (*(d+1) == '.')
|
||||
- goto parse_path;
|
||||
- s = strrchr(temp_path, '/');
|
||||
- if (s != NULL)
|
||||
- safestrcpy(s+1, d);
|
||||
- else
|
||||
- safestrcpy(temp_path, d);
|
||||
- safestrcpymax(target, temp_path, len);
|
||||
- break;
|
||||
+ d += 2;
|
||||
+ while (*d == '/')
|
||||
+ d++;
|
||||
+ continue;
|
||||
+ } else if (*(d+1) != '.' || *(d+2) != '/')
|
||||
/*
|
||||
- * relative path, getting rid of leading "../.."
|
||||
+ * relative path from this directory, starting
|
||||
+ * with a hidden directory
|
||||
*/
|
||||
-parse_path:
|
||||
- while (*d == '/' || *d == '.') {
|
||||
- if (*d == '/')
|
||||
- slashes++;
|
||||
- d++;
|
||||
- }
|
||||
- d--;
|
||||
- s = &devdir[strlen(devdir)-1];
|
||||
- while (s != NULL && count != (slashes+1)) {
|
||||
+ break;
|
||||
+
|
||||
+ /*
|
||||
+ * relative path, getting rid of leading "../.."; must
|
||||
+ * be careful here since any path component of devdir
|
||||
+ * could be a symlink again
|
||||
+ */
|
||||
+ for (;;) {
|
||||
+ while (s > devdir && *s == '/') {
|
||||
s--;
|
||||
- if (*s == '/')
|
||||
- count++;
|
||||
+ if (*s == '.'
|
||||
+ && (s == devdir || *(s-1) == '/'))
|
||||
+ s--;
|
||||
}
|
||||
- safestrcpymax(s, d, (SYSFS_PATH_MAX-strlen(devdir)));
|
||||
- safestrcpymax(target, devdir, len);
|
||||
- break;
|
||||
- case '/':
|
||||
- /* absolute path - copy as is */
|
||||
- safestrcpymax(target, linkpath, len);
|
||||
+ *(s+1) = '\0';
|
||||
+ if (*devdir == '\0' || sysfs_path_is_link(devdir))
|
||||
+ /*
|
||||
+ * condition will be true eventually
|
||||
+ * because we already know that all
|
||||
+ * but the last component of path
|
||||
+ * resolve to a directory
|
||||
+ */
|
||||
+ break;
|
||||
+ if (sysfs_get_link(devdir, devdir, SYSFS_PATH_MAX))
|
||||
+ return -1;
|
||||
+ s = devdir + strlen(devdir) - 1;
|
||||
+ }
|
||||
+ while (s >= devdir) {
|
||||
+ if (*s == '/') {
|
||||
+ if (*(s+1) != '.' || *(s+2) != '.'
|
||||
+ || *(s+3) != '\0') {
|
||||
+ d += 3;
|
||||
+ while (*d == '/')
|
||||
+ d++;
|
||||
+ } else
|
||||
+ s += 2;
|
||||
+ break;
|
||||
+ }
|
||||
+ s--;
|
||||
+ }
|
||||
+ if (s < devdir || *(s+1) == '\0')
|
||||
break;
|
||||
- default:
|
||||
- /* relative path from this directory */
|
||||
- safestrcpy(temp_path, devdir);
|
||||
- s = strrchr(temp_path, '/');
|
||||
- if (s != NULL)
|
||||
- safestrcpy(s+1, linkpath);
|
||||
- else
|
||||
- safestrcpy(temp_path, linkpath);
|
||||
- safestrcpymax(target, temp_path, len);
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * appending to devdir a slash and the (possibly shortened)
|
||||
+ * relative path to the link source
|
||||
+ */
|
||||
+ s++;
|
||||
+ if (s > devdir && *s == '\0')
|
||||
+ *s++ = '/';
|
||||
+ *s = '\0';
|
||||
+ safestrcpymax(s, d, SYSFS_PATH_MAX-(s-devdir));
|
||||
+ safestrcpymax(target, devdir, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.28.0
|
||||
|
||||
1633
0008-clarify-license-fix-typos.patch
Normal file
1633
0008-clarify-license-fix-typos.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,27 @@
|
||||
%global major_version 2
|
||||
%global minor_version 1
|
||||
%global patch_version 0
|
||||
|
||||
%global so_major_version 2
|
||||
%global so_minor_version 0
|
||||
%global so_patch_version 1
|
||||
|
||||
Name: sysfsutils
|
||||
Version: %{major_version}.%{minor_version}.%{patch_version}
|
||||
Version: 2.1.0
|
||||
Release: 30%{?dist}
|
||||
Summary: Utilities for interfacing with sysfs
|
||||
URL: https://github.com/linux-ras/sysfsutils
|
||||
License: GPLv2
|
||||
|
||||
Source0: http://prdownloads.sourceforge.net/linux-diag/%{name}-%{version}.tar.gz
|
||||
Patch0: sysfsutils-2.0.0-redhatify.patch
|
||||
Patch1: sysfsutils-2.0.0-class-dup.patch
|
||||
Patch2: sysfsutils-2.1.0-get_link.patch
|
||||
Patch3: sysfsutils-2.1.0-manpages.patch
|
||||
Patch4: sysfsutils-aarch64.patch
|
||||
Source0: https://github.com/linux-ras/sysfsutils/archive/sysfsutils-%(echo %{version} | tr '.' '_').tar.gz
|
||||
# backport upstrean fixes up to commit b688c65
|
||||
# these also obsolete sysfsutils-2.0.0-class-dup.patch & sysfsutils-aarch64.patch
|
||||
Patch1: 0001-update-README.patch
|
||||
Patch2: 0002-fix-compiler-complaints.patch
|
||||
Patch3: 0003-use-stat-not-lstat.patch
|
||||
Patch4: 0004-support-ppc64le.patch
|
||||
Patch5: 0005-fix-sysfs-name-comparisons.patch
|
||||
Patch6: 0006-limit-cdev-name-length-comparsion.patch
|
||||
# upstreamed version of sysfsutils-2.1.0-get_link.patch
|
||||
Patch7: 0007-fix-sysfs_get_link.patch
|
||||
# upstreamed version of formatting/typo/license-related fedora patches
|
||||
Patch8: 0008-clarify-license-fix-typos.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
|
||||
@ -43,7 +46,7 @@ libsysfs-devel provides the header files and static libraries required
|
||||
to build programs using the libsysfs API.
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
%autosetup -p1 -n %{name}-%{name}-%(echo %{version} | tr '.' '_')
|
||||
|
||||
%build
|
||||
%configure --disable-static --libdir=/%{_lib}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user