[LTP] [PATCH] fanotify22: Make 'dev' the last debugfs argument for musl compat

Florian Schmaus florian.schmaus@codasip.com
Fri Jul 11 18:55:58 CEST 2025


The debugfs(8) man page specifies that the device to operate on should
be the last argument. So instead of

debugfs -w /dev/loop2 -R "sif internal_dir/bad_dir mode 0xff"

the correct command line invocation would be

debugfs -w -R "sif internal_dir/bad_dir mode 0xff" /dev/loop2

The former works on glibc-based systems, due to glibc's optind
handling. However, it breaks on musl-based systems, where the
fanotify22 test will hang because debugfs is awaiting user input.

Signed-off-by: Florian Schmaus <florian.schmaus@codasip.com>
---
  testcases/kernel/syscalls/fanotify/fanotify22.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/fanotify/fanotify22.c 
b/testcases/kernel/syscalls/fanotify/fanotify22.c
index 20c7a6aca243..357e74dbc702 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify22.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify22.c
@@ -61,7 +61,7 @@ static void trigger_fs_abort(void)
   static void do_debugfs_request(const char *dev, char *request)
  {
-	const char *const cmd[] = {"debugfs", "-w", dev, "-R", request, NULL};
+	const char *const cmd[] = {"debugfs", "-w", "-R", request, dev, NULL};
   	SAFE_CMD(cmd, NULL, NULL);
  }
-- 
2.49.1



More information about the ltp mailing list