From 2c0adee1c11381b7e8b77d8f2dbd590ae0422437a78324eb32ba5951278f9a3e Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 17 Aug 2022 08:26:19 +0000 Subject: [PATCH] Accepting request 997479 from home:jirislaby:branches:devel:libraries:c_c++ - add test-xattr-don-t-rely-on-NUL-termination.patch (bsc#1202413) OBS-URL: https://build.opensuse.org/request/show/997479 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/liburing?expand=0&rev=20 --- liburing.changes | 5 ++ liburing.spec | 2 + ...-xattr-don-t-rely-on-NUL-termination.patch | 46 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 test-xattr-don-t-rely-on-NUL-termination.patch diff --git a/liburing.changes b/liburing.changes index 7ca7af8..1337f6f 100644 --- a/liburing.changes +++ b/liburing.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Aug 16 10:53:40 UTC 2022 - Jiri Slaby + +- add test-xattr-don-t-rely-on-NUL-termination.patch (bsc#1202413) + ------------------------------------------------------------------- Fri Jul 8 12:40:13 UTC 2022 - Dirk Müller diff --git a/liburing.spec b/liburing.spec index 7cc0405..fa7c24d 100644 --- a/liburing.spec +++ b/liburing.spec @@ -26,6 +26,8 @@ Group: Development/Libraries/C and C++ URL: https://git.kernel.dk/cgit/liburing Source: https://git.kernel.dk/cgit/liburing/snapshot/%{name}-%{version}.tar.bz2 # PATCH-FIX-UPSTREAM: has been accepted upstream +Patch0: test-xattr-don-t-rely-on-NUL-termination.patch +# PATCH-FIX-UPSTREAM: has been accepted upstream # [1/1] Handle EINTR in tests # commit: fa67f6aedcfdaffc14cbf0b631253477b2565ef0 Patch2: handle-eintr.patch diff --git a/test-xattr-don-t-rely-on-NUL-termination.patch b/test-xattr-don-t-rely-on-NUL-termination.patch new file mode 100644 index 0000000..fb4849e --- /dev/null +++ b/test-xattr-don-t-rely-on-NUL-termination.patch @@ -0,0 +1,46 @@ +From: Jiri Slaby +Date: Tue, 16 Aug 2022 12:44:14 +0200 +Subject: test/xattr: don't rely on NUL-termination +Patch-mainline: yes +Git-commit: bf3fedba890e66d644692910964fe1d8cbf4fb1b +References: bsc#1202413 + +The returned value from io_uring_fgetxattr() needs not be NUL-terminated, +as we stored non-NUL-terminated string by io_uring_fsetxattr() +previously. + +So don't use strlen() on value, but on VALUE1, and VALUE2 respectively. + +This fixes random test failures. + +Cc: Stefan Roesch +Fixes: d6515e06f73c ("liburing: Add new test program to verify xattr support") +Signed-off-by: Jiri Slaby +--- + test/xattr.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/xattr.c b/test/xattr.c +index d88059cb..101d82b3 100644 +--- a/test/xattr.c ++++ b/test/xattr.c +@@ -210,14 +210,14 @@ static int test_fxattr(void) + + /* Test reading attributes. */ + value_len = io_uring_fgetxattr(&ring, fd, KEY1, value, XATTR_SIZE); +- if (value_len != strlen(value) || strncmp(value, VALUE1, value_len)) { ++ if (value_len != strlen(VALUE1) || strncmp(value, VALUE1, value_len)) { + fprintf(stderr, "Error: fgetxattr expected value: %s, returned value: %s\n", VALUE1, value); + rc = -1; + goto Exit; + } + + value_len = io_uring_fgetxattr(&ring, fd, KEY2, value, XATTR_SIZE); +- if (value_len != strlen(value)|| strncmp(value, VALUE2, value_len)) { ++ if (value_len != strlen(VALUE2) || strncmp(value, VALUE2, value_len)) { + fprintf(stderr, "Error: fgetxattr expected value: %s, returned value: %s\n", VALUE2, value); + rc = -1; + goto Exit; +-- +2.35.3 +