diff --git a/0000-attr-2.4.48-test-suite-perl.patch b/0001-test-escape-left-brace-in-a-regex-in-test-run.patch similarity index 73% rename from 0000-attr-2.4.48-test-suite-perl.patch rename to 0001-test-escape-left-brace-in-a-regex-in-test-run.patch index f91562f82b4ef42aa2158d18a3fc5031c1582df3..f73ae7ec11dcab1340f0d287072ce37061bf8378 100644 --- a/0000-attr-2.4.48-test-suite-perl.patch +++ b/0001-test-escape-left-brace-in-a-regex-in-test-run.patch @@ -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 -Date: Fri, 21 Jul 2017 14:05:47 -0700 -Subject: [PATCH] attr: escape left brace in a regex in test/run +Date: Mon, 24 Jul 2017 14:42:06 +0200 +Subject: [PATCH 1/7] test: escape left brace in a regex in test/run ... to fix test-suite failure with perl-5.26.0 Bug: https://bugzilla.redhat.com/1473853 -Signed-off-by: Kamil Dudka --- test/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) @@ -25,5 +24,5 @@ index 4b1f8d0..07e916c 100755 if (defined $line) { if ($line =~ s/^\s*< ?//) { -- -2.13.0 +1.8.3.1 diff --git a/0002-attr_multi-attr_multif-Don-t-set-errno-to-EINVAL.patch b/0002-attr_multi-attr_multif-Don-t-set-errno-to-EINVAL.patch new file mode 100644 index 0000000000000000000000000000000000000000..7685244775294a2a58e5d7017ad687f5e602f2f5 --- /dev/null +++ b/0002-attr_multi-attr_multif-Don-t-set-errno-to-EINVAL.patch @@ -0,0 +1,37 @@ +From c6b3d77b1c52af927ddf34230505e4b7d4df0960 Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher +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 + diff --git a/0003-attr_list-attr_listf-Guard-against-unterminated-buff.patch b/0003-attr_list-attr_listf-Guard-against-unterminated-buff.patch new file mode 100644 index 0000000000000000000000000000000000000000..500f9b50bd9a5a0c7b0e3459aca44737b8c99c54 --- /dev/null +++ b/0003-attr_list-attr_listf-Guard-against-unterminated-buff.patch @@ -0,0 +1,64 @@ +From 03d0e1ef54dc21e60ead4ec3161c217f3d53a5a7 Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher +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 + diff --git a/0004-getfattr-don-t-count-terminating-NULL-in-well_enough.patch b/0004-getfattr-don-t-count-terminating-NULL-in-well_enough.patch new file mode 100644 index 0000000000000000000000000000000000000000..777b621a406e5aa83fe114183f9dc3ef705da17c --- /dev/null +++ b/0004-getfattr-don-t-count-terminating-NULL-in-well_enough.patch @@ -0,0 +1,35 @@ +From e4c006f07f050e0af08602d0064c3420080b7313 Mon Sep 17 00:00:00 2001 +From: Jeff Layton +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 +--- + 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 + diff --git a/0005-attr-Replace-bzero-with-memset.patch b/0005-attr-Replace-bzero-with-memset.patch new file mode 100644 index 0000000000000000000000000000000000000000..089c5f9a0f2b18d7a99c2d1a28e10a1bd76dd2a2 --- /dev/null +++ b/0005-attr-Replace-bzero-with-memset.patch @@ -0,0 +1,69 @@ +From fbf5b460f20273c6bbdebeab0ca7bb75d4ab33a2 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +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 +--- + 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 + diff --git a/0002-Switch-back-to-syscall.patch b/0006-Switch-back-to-syscall.patch similarity index 93% rename from 0002-Switch-back-to-syscall.patch rename to 0006-Switch-back-to-syscall.patch index de879e23ab54d438f79a5e2a494932cb8d86ad9f..5d3eed8cc80e2341426e83f52b1dcd84d98bdbe5 100644 --- a/0002-Switch-back-to-syscall.patch +++ b/0006-Switch-back-to-syscall.patch @@ -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 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 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 performance of syscall() won't affect any of the "normal" users of libattr. - -[nicolas.cavallari: with uclibc-ng, the recursion always happen] -Signed-off-by: Nicolas Cavallari --- libattr/syscalls.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) @@ -122,5 +119,5 @@ index 3013aa0..721ad7f 100644 #ifdef HAVE_VISIBILITY_ATTRIBUTE -- -cgit v1.0-41-gc330 +1.8.3.1 diff --git a/0001-bypass-wrong-output-when-enabled-selinux.patch b/0007-bypass-wrong-output-when-enabled-selinux.patch similarity index 90% rename from 0001-bypass-wrong-output-when-enabled-selinux.patch rename to 0007-bypass-wrong-output-when-enabled-selinux.patch index b897931962139ce1b9cbcad8ce74345fcb0d8148..a9ce9d339891bbce40afcab794b14edc3e0bc794 100644 --- a/0001-bypass-wrong-output-when-enabled-selinux.patch +++ b/0007-bypass-wrong-output-when-enabled-selinux.patch @@ -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 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 about selinux. Bypass these messages to make testcases go success. @@ -12,7 +12,7 @@ Signed-off-by: Shijie Luo 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/test/run b/test/run -index 4b1f8d0..5c017cc 100755 +index 07e916c..7e46a70 100755 --- a/test/run +++ b/test/run @@ -160,21 +160,27 @@ sub process_test($$$$) { @@ -51,5 +51,5 @@ index 4b1f8d0..5c017cc 100755 } my $good = !(grep /!/, @good); -- -2.23.0 +1.8.3.1 diff --git a/attr.spec b/attr.spec index 206b55635f971f79c88c888769c00238489eb918..b500d69df7ae52c8647f47774d4db40171b0ba10 100644 --- a/attr.spec +++ b/attr.spec @@ -1,17 +1,20 @@ %{!?_licensedir:%global license %%doc} Name: attr Version: 2.4.48 -Release: 10 +Release: 11 Summary: Commands for Manipulating Filesystem Extended Attributes License: GPLv2+ AND LGPLv2+ URL: https://savannah.nongnu.org/projects/attr Source0: https://download-mirror.savannah.gnu.org/releases/attr/attr-%{version}.tar.gz # fix test-suite failure with perl-5.26.0 (#1473853) -Patch0: 0000-attr-2.4.48-test-suite-perl.patch -Patch1: 0001-bypass-wrong-output-when-enabled-selinux.patch -Patch2: 0002-Switch-back-to-syscall.patch - +Patch1: 0001-test-escape-left-brace-in-a-regex-in-test-run.patch +Patch2: 0002-attr_multi-attr_multif-Don-t-set-errno-to-EINVAL.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 Provides: libattr @@ -98,7 +101,10 @@ fi %{_mandir}/man3/* %changelog -* Wed Jul 29 2020 Markeryang - 2.4.48-10 +* Sun Jul 12 2020 Zhiqiang Liu - 2.4.48-11 +- backport upstream bugfix patches + +* Wed Jun 29 2020 Markeryang - 2.4.48-10 - Type:bugfix - ID:NA - SUG:NA