attr: backport upsteam bugfix patches
attr: backport upsteam bugfix patches Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
This commit is contained in:
parent
69fb75b967
commit
7b25ffbcfb
@ -1,12 +1,11 @@
|
|||||||
From 46baedf88fe22abafa3f2341b2c1bcb4764ce389 Mon Sep 17 00:00:00 2001
|
From 7caefe0a7206bf0da40fcea66c3292345abf24f9 Mon Sep 17 00:00:00 2001
|
||||||
From: Troy Dawson <tdawson@redhat.com>
|
From: Troy Dawson <tdawson@redhat.com>
|
||||||
Date: Fri, 21 Jul 2017 14:05:47 -0700
|
Date: Mon, 24 Jul 2017 14:42:06 +0200
|
||||||
Subject: [PATCH] attr: escape left brace in a regex in test/run
|
Subject: [PATCH 1/7] test: escape left brace in a regex in test/run
|
||||||
|
|
||||||
... to fix test-suite failure with perl-5.26.0
|
... to fix test-suite failure with perl-5.26.0
|
||||||
|
|
||||||
Bug: https://bugzilla.redhat.com/1473853
|
Bug: https://bugzilla.redhat.com/1473853
|
||||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
||||||
---
|
---
|
||||||
test/run | 2 +-
|
test/run | 2 +-
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
@ -25,5 +24,5 @@ index 4b1f8d0..07e916c 100755
|
|||||||
if (defined $line) {
|
if (defined $line) {
|
||||||
if ($line =~ s/^\s*< ?//) {
|
if ($line =~ s/^\s*< ?//) {
|
||||||
--
|
--
|
||||||
2.13.0
|
1.8.3.1
|
||||||
|
|
||||||
37
0002-attr_multi-attr_multif-Don-t-set-errno-to-EINVAL.patch
Normal file
37
0002-attr_multi-attr_multif-Don-t-set-errno-to-EINVAL.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From c6b3d77b1c52af927ddf34230505e4b7d4df0960 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andreas Gruenbacher <agruenba@redhat.com>
|
||||||
|
Date: Mon, 17 Dec 2018 14:33:55 +0100
|
||||||
|
Subject: [PATCH 2/7] attr_multi, attr_multif: Don't set errno to -EINVAL
|
||||||
|
|
||||||
|
When attr_multi or attr_multif are called with an invalid am_opcode,
|
||||||
|
they fail with errno set to -EINVAL. Instead, the errno value should be
|
||||||
|
positive.
|
||||||
|
---
|
||||||
|
libattr/libattr.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libattr/libattr.c b/libattr/libattr.c
|
||||||
|
index d6668af..8180c3f 100644
|
||||||
|
--- a/libattr/libattr.c
|
||||||
|
+++ b/libattr/libattr.c
|
||||||
|
@@ -391,7 +391,7 @@ attr_single(const char *path, attr_multiop_t *op, int flags)
|
||||||
|
{
|
||||||
|
int r = -1;
|
||||||
|
|
||||||
|
- errno = -EINVAL;
|
||||||
|
+ errno = EINVAL;
|
||||||
|
flags |= op->am_flags;
|
||||||
|
if (op->am_opcode == ATTR_OP_GET)
|
||||||
|
r = attr_get(path, op->am_attrname, op->am_attrvalue,
|
||||||
|
@@ -409,7 +409,7 @@ attr_singlef(const int fd, attr_multiop_t *op, int flags)
|
||||||
|
{
|
||||||
|
int r = -1;
|
||||||
|
|
||||||
|
- errno = -EINVAL;
|
||||||
|
+ errno = EINVAL;
|
||||||
|
flags |= op->am_flags;
|
||||||
|
if (op->am_opcode == ATTR_OP_GET)
|
||||||
|
r = attr_getf(fd, op->am_attrname, op->am_attrvalue,
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
From 03d0e1ef54dc21e60ead4ec3161c217f3d53a5a7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andreas Gruenbacher <agruenba@redhat.com>
|
||||||
|
Date: Mon, 17 Dec 2018 14:38:26 +0100
|
||||||
|
Subject: [PATCH 3/7] attr_list, attr_listf: Guard against unterminated buffer
|
||||||
|
|
||||||
|
attr_list and attr_listf can crash when the listxattr, llistxattr, or
|
||||||
|
flistxattr syscalls incorrectly return an unterminated buffer. Guard
|
||||||
|
against that by always appending a null character.
|
||||||
|
---
|
||||||
|
libattr/libattr.c | 12 +++++++-----
|
||||||
|
1 file changed, 7 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libattr/libattr.c b/libattr/libattr.c
|
||||||
|
index 8180c3f..d550e10 100644
|
||||||
|
--- a/libattr/libattr.c
|
||||||
|
+++ b/libattr/libattr.c
|
||||||
|
@@ -290,7 +290,7 @@ attr_list(const char *path, char *buffer, const int buffersize, int flags,
|
||||||
|
{
|
||||||
|
const char *l;
|
||||||
|
int length, vlength, count = 0;
|
||||||
|
- char lbuf[MAXLISTLEN];
|
||||||
|
+ char lbuf[MAXLISTLEN+1];
|
||||||
|
char name[MAXNAMELEN+16];
|
||||||
|
int start_offset, end_offset;
|
||||||
|
|
||||||
|
@@ -301,11 +301,12 @@ attr_list(const char *path, char *buffer, const int buffersize, int flags,
|
||||||
|
bzero(buffer, sizeof(attrlist_t));
|
||||||
|
|
||||||
|
if (flags & ATTR_DONTFOLLOW)
|
||||||
|
- length = llistxattr(path, lbuf, sizeof(lbuf));
|
||||||
|
+ length = llistxattr(path, lbuf, sizeof(lbuf) - 1);
|
||||||
|
else
|
||||||
|
- length = listxattr(path, lbuf, sizeof(lbuf));
|
||||||
|
+ length = listxattr(path, lbuf, sizeof(lbuf) - 1);
|
||||||
|
if (length <= 0)
|
||||||
|
return length;
|
||||||
|
+ lbuf[length] = 0; /* not supposed to be necessary */
|
||||||
|
|
||||||
|
start_offset = sizeof(attrlist_t);
|
||||||
|
end_offset = buffersize & ~(8-1); /* 8 byte align */
|
||||||
|
@@ -340,7 +341,7 @@ attr_listf(int fd, char *buffer, const int buffersize, int flags,
|
||||||
|
{
|
||||||
|
const char *l;
|
||||||
|
int length, vlength, count = 0;
|
||||||
|
- char lbuf[MAXLISTLEN];
|
||||||
|
+ char lbuf[MAXLISTLEN+1];
|
||||||
|
char name[MAXNAMELEN+16];
|
||||||
|
int start_offset, end_offset;
|
||||||
|
|
||||||
|
@@ -350,9 +351,10 @@ attr_listf(int fd, char *buffer, const int buffersize, int flags,
|
||||||
|
}
|
||||||
|
bzero(buffer, sizeof(attrlist_t));
|
||||||
|
|
||||||
|
- length = flistxattr(fd, lbuf, sizeof(lbuf));
|
||||||
|
+ length = flistxattr(fd, lbuf, sizeof(lbuf) - 1);
|
||||||
|
if (length < 0)
|
||||||
|
return length;
|
||||||
|
+ lbuf[length] = 0; /* not supposed to be necessary */
|
||||||
|
|
||||||
|
start_offset = sizeof(attrlist_t);
|
||||||
|
end_offset = buffersize & ~(8-1); /* 8 byte align */
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
From e4c006f07f050e0af08602d0064c3420080b7313 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeff Layton <jlayton@kernel.org>
|
||||||
|
Date: Thu, 13 Jun 2019 10:55:35 -0400
|
||||||
|
Subject: [PATCH 4/7] getfattr: don't count terminating NULL in
|
||||||
|
well_enough_printable
|
||||||
|
|
||||||
|
If the value is a string with the terminating NUL included in the
|
||||||
|
length, then don't count that terminating NUL when determining whether
|
||||||
|
the string is printable. This is consistent with the fact that getfattr
|
||||||
|
doesn't print the terminating NUL character in --encoding=text (commit
|
||||||
|
7fed4441e12d).
|
||||||
|
|
||||||
|
Signed-off-by: Jeff Layton <jlayton@kernel.org>
|
||||||
|
---
|
||||||
|
tools/getfattr.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/tools/getfattr.c b/tools/getfattr.c
|
||||||
|
index 72a8852..0ba5781 100644
|
||||||
|
--- a/tools/getfattr.c
|
||||||
|
+++ b/tools/getfattr.c
|
||||||
|
@@ -110,6 +110,10 @@ int well_enough_printable(const char *value, size_t size)
|
||||||
|
{
|
||||||
|
size_t n, nonpr = 0;
|
||||||
|
|
||||||
|
+ /* Don't count the NULL terminator if there is one */
|
||||||
|
+ if (size && !value[size - 1])
|
||||||
|
+ size--;
|
||||||
|
+
|
||||||
|
for (n=0; n < size; n++)
|
||||||
|
if (!isprint(*value++))
|
||||||
|
nonpr++;
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
69
0005-attr-Replace-bzero-with-memset.patch
Normal file
69
0005-attr-Replace-bzero-with-memset.patch
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
From fbf5b460f20273c6bbdebeab0ca7bb75d4ab33a2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Rosen Penev <rosenp@gmail.com>
|
||||||
|
Date: Sun, 11 Aug 2019 16:17:11 -0700
|
||||||
|
Subject: [PATCH 5/7] attr: Replace bzero with memset
|
||||||
|
|
||||||
|
bzero is a deprecated function that is optionally unavailable with
|
||||||
|
uClibc-ng.
|
||||||
|
|
||||||
|
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
||||||
|
---
|
||||||
|
include/attributes.h | 4 ++--
|
||||||
|
libattr/libattr.c | 4 ++--
|
||||||
|
tools/attr.c | 2 +-
|
||||||
|
3 files changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/attributes.h b/include/attributes.h
|
||||||
|
index 14beb8f..039c817 100644
|
||||||
|
--- a/include/attributes.h
|
||||||
|
+++ b/include/attributes.h
|
||||||
|
@@ -91,9 +91,9 @@ typedef struct attrlist_ent { /* data from attr_list() */
|
||||||
|
* Implement a "cursor" for use in successive attr_list() calls.
|
||||||
|
* It provides a way to find the last attribute that was returned in the
|
||||||
|
* last attr_list() call so that we can get the next one without missing
|
||||||
|
- * any. This should be bzero()ed before use and whenever it is desired to
|
||||||
|
+ * any. This should be zeroed before use and whenever it is desired to
|
||||||
|
* start over from the beginning of the attribute list. The only valid
|
||||||
|
- * operation on a cursor is to bzero() it.
|
||||||
|
+ * operation on a cursor is to zero it.
|
||||||
|
*/
|
||||||
|
typedef struct attrlist_cursor {
|
||||||
|
uint32_t opaque[4]; /* an opaque cookie */
|
||||||
|
diff --git a/libattr/libattr.c b/libattr/libattr.c
|
||||||
|
index d550e10..2ebd1c5 100644
|
||||||
|
--- a/libattr/libattr.c
|
||||||
|
+++ b/libattr/libattr.c
|
||||||
|
@@ -298,7 +298,7 @@ attr_list(const char *path, char *buffer, const int buffersize, int flags,
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- bzero(buffer, sizeof(attrlist_t));
|
||||||
|
+ memset(buffer, 0, sizeof(attrlist_t));
|
||||||
|
|
||||||
|
if (flags & ATTR_DONTFOLLOW)
|
||||||
|
length = llistxattr(path, lbuf, sizeof(lbuf) - 1);
|
||||||
|
@@ -349,7 +349,7 @@ attr_listf(int fd, char *buffer, const int buffersize, int flags,
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- bzero(buffer, sizeof(attrlist_t));
|
||||||
|
+ memset(buffer, 0, sizeof(attrlist_t));
|
||||||
|
|
||||||
|
length = flistxattr(fd, lbuf, sizeof(lbuf) - 1);
|
||||||
|
if (length < 0)
|
||||||
|
diff --git a/tools/attr.c b/tools/attr.c
|
||||||
|
index c8aa0b4..312aef1 100644
|
||||||
|
--- a/tools/attr.c
|
||||||
|
+++ b/tools/attr.c
|
||||||
|
@@ -228,7 +228,7 @@ main(int argc, char **argv)
|
||||||
|
perror("malloc");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
- bzero((char *)&cursor, sizeof(cursor));
|
||||||
|
+ memset(&cursor, 0, sizeof(cursor));
|
||||||
|
do {
|
||||||
|
error = attr_list(filename, buffer, BUFSIZE,
|
||||||
|
attrflags, &cursor);
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
From 14adc898a36948267bfe5c63b399996879e94c98 Mon Sep 17 00:00:00 2001
|
From cb937740fa0dddf9c398618035054c657959c783 Mon Sep 17 00:00:00 2001
|
||||||
From: Andreas Gruenbacher <agruenba@redhat.com>
|
From: Andreas Gruenbacher <agruenba@redhat.com>
|
||||||
Date: Fri, 17 Aug 2018 14:07:31 +0200
|
Date: Fri, 17 Aug 2018 14:07:31 +0200
|
||||||
Subject: Switch back to syscall()
|
Subject: [PATCH 6/7] Switch back to syscall()
|
||||||
|
|
||||||
Switch back to syscall() for the *xattr system calls. The current
|
Switch back to syscall() for the *xattr system calls. The current
|
||||||
mechanism of forwarding those calls to glibc breaks libraries like
|
mechanism of forwarding those calls to glibc breaks libraries like
|
||||||
@ -21,9 +21,6 @@ at runtime (dlopen / dlsym). Programs linking against libattr will
|
|||||||
directly use the glibc provided symbols. Therefore, the slightly worse
|
directly use the glibc provided symbols. Therefore, the slightly worse
|
||||||
performance of syscall() won't affect any of the "normal" users of
|
performance of syscall() won't affect any of the "normal" users of
|
||||||
libattr.
|
libattr.
|
||||||
|
|
||||||
[nicolas.cavallari: with uclibc-ng, the recursion always happen]
|
|
||||||
Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
|
|
||||||
---
|
---
|
||||||
libattr/syscalls.c | 26 ++++++++++++++------------
|
libattr/syscalls.c | 26 ++++++++++++++------------
|
||||||
1 file changed, 14 insertions(+), 12 deletions(-)
|
1 file changed, 14 insertions(+), 12 deletions(-)
|
||||||
@ -122,5 +119,5 @@ index 3013aa0..721ad7f 100644
|
|||||||
|
|
||||||
#ifdef HAVE_VISIBILITY_ATTRIBUTE
|
#ifdef HAVE_VISIBILITY_ATTRIBUTE
|
||||||
--
|
--
|
||||||
cgit v1.0-41-gc330
|
1.8.3.1
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
From 5dfe64a676969aeebae857f5ab8f1301c4f339f8 Mon Sep 17 00:00:00 2001
|
From 20576addae44d7256617806e4504524e0d1c9b13 Mon Sep 17 00:00:00 2001
|
||||||
From: Shijie Luo <luoshijie1@huawei.com>
|
From: Shijie Luo <luoshijie1@huawei.com>
|
||||||
Date: Sun, 15 Mar 2020 14:15:42 -0400
|
Date: Sun, 15 Mar 2020 14:15:42 -0400
|
||||||
Subject: [PATCH] bypass wrong output when enabled selinux
|
Subject: [PATCH 7/7] bypass wrong output when enabled selinux
|
||||||
|
|
||||||
When enforced selinux, excuting command getfattr may output something
|
When enforced selinux, excuting command getfattr may output something
|
||||||
about selinux. Bypass these messages to make testcases go success.
|
about selinux. Bypass these messages to make testcases go success.
|
||||||
@ -12,7 +12,7 @@ Signed-off-by: Shijie Luo <luoshijie1@huawei.com>
|
|||||||
1 file changed, 13 insertions(+), 7 deletions(-)
|
1 file changed, 13 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
diff --git a/test/run b/test/run
|
diff --git a/test/run b/test/run
|
||||||
index 4b1f8d0..5c017cc 100755
|
index 07e916c..7e46a70 100755
|
||||||
--- a/test/run
|
--- a/test/run
|
||||||
+++ b/test/run
|
+++ b/test/run
|
||||||
@@ -160,21 +160,27 @@ sub process_test($$$$) {
|
@@ -160,21 +160,27 @@ sub process_test($$$$) {
|
||||||
@ -51,5 +51,5 @@ index 4b1f8d0..5c017cc 100755
|
|||||||
}
|
}
|
||||||
my $good = !(grep /!/, @good);
|
my $good = !(grep /!/, @good);
|
||||||
--
|
--
|
||||||
2.23.0
|
1.8.3.1
|
||||||
|
|
||||||
18
attr.spec
18
attr.spec
@ -1,17 +1,20 @@
|
|||||||
%{!?_licensedir:%global license %%doc}
|
%{!?_licensedir:%global license %%doc}
|
||||||
Name: attr
|
Name: attr
|
||||||
Version: 2.4.48
|
Version: 2.4.48
|
||||||
Release: 10
|
Release: 11
|
||||||
Summary: Commands for Manipulating Filesystem Extended Attributes
|
Summary: Commands for Manipulating Filesystem Extended Attributes
|
||||||
License: GPLv2+ AND LGPLv2+
|
License: GPLv2+ AND LGPLv2+
|
||||||
URL: https://savannah.nongnu.org/projects/attr
|
URL: https://savannah.nongnu.org/projects/attr
|
||||||
Source0: https://download-mirror.savannah.gnu.org/releases/attr/attr-%{version}.tar.gz
|
Source0: https://download-mirror.savannah.gnu.org/releases/attr/attr-%{version}.tar.gz
|
||||||
|
|
||||||
# fix test-suite failure with perl-5.26.0 (#1473853)
|
# fix test-suite failure with perl-5.26.0 (#1473853)
|
||||||
Patch0: 0000-attr-2.4.48-test-suite-perl.patch
|
Patch1: 0001-test-escape-left-brace-in-a-regex-in-test-run.patch
|
||||||
Patch1: 0001-bypass-wrong-output-when-enabled-selinux.patch
|
Patch2: 0002-attr_multi-attr_multif-Don-t-set-errno-to-EINVAL.patch
|
||||||
Patch2: 0002-Switch-back-to-syscall.patch
|
Patch3: 0003-attr_list-attr_listf-Guard-against-unterminated-buff.patch
|
||||||
|
Patch4: 0004-getfattr-don-t-count-terminating-NULL-in-well_enough.patch
|
||||||
|
Patch5: 0005-attr-Replace-bzero-with-memset.patch
|
||||||
|
Patch6: 0006-Switch-back-to-syscall.patch
|
||||||
|
Patch7: 0007-bypass-wrong-output-when-enabled-selinux.patch
|
||||||
|
|
||||||
BuildRequires: gettext, libtool, chrpath, gcc, git, gdb
|
BuildRequires: gettext, libtool, chrpath, gcc, git, gdb
|
||||||
Provides: libattr
|
Provides: libattr
|
||||||
@ -98,7 +101,10 @@ fi
|
|||||||
%{_mandir}/man3/*
|
%{_mandir}/man3/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Jul 29 2020 Markeryang <yanglongkang@163.com> - 2.4.48-10
|
* Sun Jul 12 2020 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 2.4.48-11
|
||||||
|
- backport upstream bugfix patches
|
||||||
|
|
||||||
|
* Wed Jun 29 2020 Markeryang <yanglongkang@163.com> - 2.4.48-10
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
- SUG:NA
|
- SUG:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user