Skip to contentSkip to conversation

package/ltp-testsuite: fix build with uclibc

PATCH New Fabrice Fontaine 3 participants 3 messages Sep 7, 2020 – Sep 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/ltp-testsuite: fix build with uclibc

Fix a build failure with ltp-testsuite in version 20200515

Fixes:
- http://autobuild.buildroot.org/results/fb0a67b15482e76b379b4b4d9c43b45bb0fccae1

---
 ...001-fanotify.h-fix-build-with-uclibc.patch | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 package/ltp-testsuite/0001-fanotify.h-fix-build-with-uclibc.patch
package/ltp-testsuite/0001-fanotify.h-fix-build-with-uclibc.patch new file +41 -0
new file mode 100644
index 0000000000..5531756970
@@ -0,0 +1,41 @@
+From cb11e718ce04261cb6ff4c09442b949da33b8797 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Sat, 5 Sep 2020 17:55:45 +0200
+Subject: [PATCH] fanotify.h: fix build with uclibc
+
+MAX_HANDLE_SZ is used since version 20200515 and
+https://github.com/linux-test-project/ltp/commit/d20a3e8f9a794e0659277acfa9fbcf7454ba4631
+
+However, it is not defined by uclibc, so define it if needed to avoid
+the following build failure:
+
+fanotify.h:171:11: error: 'MAX_HANDLE_SZ' undeclared here (not in a function)
+  171 |  char buf[MAX_HANDLE_SZ];
+
+Fixes:
+ - http://autobuild.buildroot.org/results/fb0a67b15482e76b379b4b4d9c43b45bb0fccae1
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+Reviewed-by: Cyril Hrubis <[email protected]>
+[Retrieved from:
+https://github.com/linux-test-project/ltp/commit/cb11e718ce04261cb6ff4c09442b949da33b8797]
+---
+ testcases/kernel/syscalls/fanotify/fanotify.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
+index a9a431ca2f..d271578e97 100644
+--- a/testcases/kernel/syscalls/fanotify/fanotify.h
++++ b/testcases/kernel/syscalls/fanotify/fanotify.h
+@@ -139,6 +139,11 @@ struct fanotify_event_info_fid {
+ #endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL */
+ 
+ #ifdef HAVE_NAME_TO_HANDLE_AT
++
++#ifndef MAX_HANDLE_SZ
++#define MAX_HANDLE_SZ		128
++#endif
++
+ /*
+  * Helper function used to obtain fsid and file_handle for a given path.
+  * Used by test files correlated to FAN_REPORT_FID functionality.
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/1 package/ltp-testsuite: fix build with uclibc

Quoted 10 lines · On Mon, 7 Sep 2020 20:29:22 +0200 Fabrice Fontaine…

Fix a build failure with ltp-testsuite in version 20200515

Fixes:
- http://autobuild.buildroot.org/results/fb0a67b15482e76b379b4b4d9c43b45bb0fccae1

---
 ...001-fanotify.h-fix-build-with-uclibc.patch | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 package/ltp-testsuite/0001-fanotify.h-fix-build-with-uclibc.patch

I have applied as a simple and immediate fix, but the real fix is to add this missing define in uClibc.

Indeed the man page of name_to_handle_at() is pretty clear:

It is the caller's responsibility to allocate the structure with a size large enough to hold the handle returned in f_handle. Before the call, the handle_bytes field should be initialized to contain the allocated size for f_handle. (The constant MAX_HANDLE_SZ, defined in <fcntl.h>, specifies the maximum expected size for a file handle. It is not a guaranteed upper limit as future filesystems may require more space.) Upon successful return, the handle_bytes field is updated to contain the number of bytes actually written to f_handle.

So, this MAX_HANDLE_SZ should be defined by the C library. uClibc-ng defines struct file_handle, but does not define MAX_HANDLE_SZ, which is not good.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/ltp-testsuite: fix build with uclibc

In reply to Fabrice Fontaine
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

Fix a build failure with ltp-testsuite in version 20200515
Fixes:
- http://autobuild.buildroot.org/results/fb0a67b15482e76b379b4b4d9c43b45bb0fccae1

Committed to 2020.08.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard