Skip to contentSkip to conversation

fix compiling errors on fedora-rawhide

PATCH In review Li Wang 2 participants 8 messages Aug 5, 2022

lore
Share & tools
lore

Li Wang

author
#0 lore raw

cover fix compiling errors on fedora-rawhide

CI job: https://github.com/wangli5665/ltp/runs/7686209513

Li Wang (2):
lapi/pidfd: adding pidfd header file lapi/fsmount: resolve conflict in different header files

 configure.ac                                              | 2 ++
 include/lapi/fs.h                                         | 6 ++++--
 include/lapi/fsmount.h                                    | 6 ++++--
 include/lapi/pidfd.h                                      | 3 +++
 testcases/kernel/syscalls/fsconfig/fsconfig01.c           | 1 +
 testcases/kernel/syscalls/fsconfig/fsconfig02.c           | 1 +
 testcases/kernel/syscalls/fsmount/fsmount01.c             | 1 +
 testcases/kernel/syscalls/fsmount/fsmount02.c             | 1 +
 testcases/kernel/syscalls/fsopen/fsopen01.c               | 1 +
 testcases/kernel/syscalls/fsopen/fsopen02.c               | 1 +
 testcases/kernel/syscalls/fspick/fspick01.c               | 1 +
 testcases/kernel/syscalls/fspick/fspick02.c               | 1 +
 testcases/kernel/syscalls/mount_setattr/mount_setattr01.c | 1 +
 testcases/kernel/syscalls/move_mount/move_mount01.c       | 1 +
 testcases/kernel/syscalls/move_mount/move_mount02.c       | 1 +
 testcases/kernel/syscalls/open_tree/open_tree01.c         | 1 +
 testcases/kernel/syscalls/open_tree/open_tree02.c         | 1 +
 17 files changed, 26 insertions(+), 4 deletions(-)
Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#1 lore raw

PATCH 1/2 lapi/pidfd: adding pidfd header file

The newer Glibc already provided wrapper for the series pidfd syscall, so let's include the header file conditionally.

  # rpm -q glibc-devel
  glibc-devel-2.35.9000-31.fc37.ppc64le
  # rpm -ql glibc-devel | grep pidfd
  /usr/include/sys/pidfd.h

To get rid of compiling error from fedora-rawhide:

tst_safe_macros.c: In function ‘safe_pidfd_open’:
tst_safe_macros.c:135:16: error: implicit declaration of function ‘pidfd_open’ [-Werror=implicit-function-declaration]

  135 |         rval = pidfd_open(pid, flags);
      |                ^~~~~~~~~~
---
 configure.ac         | 1 +
 include/lapi/pidfd.h | 3 +++
 2 files changed, 4 insertions(+)
configure.ac +1 -0
index 69b145b5f..d50ec1ea7 100644
@@ -71,6 +71,7 @@ AC_CHECK_HEADERS_ONCE([ \
     sys/epoll.h \
     sys/fanotify.h \
     sys/inotify.h \
+    sys/pidfd.h
     sys/prctl.h \
     sys/shm.h \
     sys/timerfd.h \
include/lapi/pidfd.h +3 -0
index 244d3acaf..9ca8e5aa2 100644
@@ -8,6 +8,9 @@
 #define LAPI_PIDFD_H__
 
 #include <fcntl.h>
+#ifdef HAVE_SYS_PIDFD_H
+# include <sys/pidfd.h>
+#endif
 #include "config.h"
 #include "lapi/syscalls.h"
 
Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Re: [LTP] [PATCH 1/2] lapi/pidfd: adding pidfd header file

Hi Li,

obviously correct, thanks!

BTW if you wish to use rawhide in CI, we can give it a try (could be reverted to fedora:latest - i.e. the latest release if got problematic).

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#3 lore raw

Re: [LTP] [PATCH 1/2] lapi/pidfd: adding pidfd header file

Hi Petr,

Quoted 4 lines · Petr Vorel

Hi Li,

obviously correct, thanks!

Patchset merged.

Quoted 4 lines

BTW if you wish to use rawhide in CI, we can give it a try (could be reverted to fedora:latest - i.e. the latest release if got problematic).

Thanks, but I'm not very passionate about enabling it, as we now have ltp quick test on fedora-rawhide internally(RedHat), but obviously that consumed people's energy on debugging *temporally* failure[1]. I'm still thinking if that's worth it.

[1] some of them disappear after code-rebase or package upgrading

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Re: [LTP] [PATCH 1/2] lapi/pidfd: adding pidfd header file

...

Quoted 4 lines

Thanks, but I'm not very passionate about enabling it, as we now have ltp quick test on fedora-rawhide internally(RedHat), but obviously that consumed people's energy on debugging *temporally* failure[1]. I'm still thinking if that's worth it.

Hi Li,

Sure, np.
Petr

Quoted 1 line

[1] some of them disappear after code-rebase or package upgrading

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#5 lore raw

PATCH 2/2 lapi/fsmount: resolve conflict in different header files

In reply to Li Wang

The latest glibc added new wrappers (e.g. mount_setattr, fsopen) support in sys/mount.h, which partly conflicts with linux/mount.h at the same time.

We need to make adjustments to header files to fix compiling error on different platforms.

---
 configure.ac                                              | 1 +
 include/lapi/fs.h                                         | 6 ++++--
 include/lapi/fsmount.h                                    | 6 ++++--
 testcases/kernel/syscalls/fsconfig/fsconfig01.c           | 1 +
 testcases/kernel/syscalls/fsconfig/fsconfig02.c           | 1 +
 testcases/kernel/syscalls/fsmount/fsmount01.c             | 1 +
 testcases/kernel/syscalls/fsmount/fsmount02.c             | 1 +
 testcases/kernel/syscalls/fsopen/fsopen01.c               | 1 +
 testcases/kernel/syscalls/fsopen/fsopen02.c               | 1 +
 testcases/kernel/syscalls/fspick/fspick01.c               | 1 +
 testcases/kernel/syscalls/fspick/fspick02.c               | 1 +
 testcases/kernel/syscalls/mount_setattr/mount_setattr01.c | 1 +
 testcases/kernel/syscalls/move_mount/move_mount01.c       | 1 +
 testcases/kernel/syscalls/move_mount/move_mount02.c       | 1 +
 testcases/kernel/syscalls/open_tree/open_tree01.c         | 1 +
 testcases/kernel/syscalls/open_tree/open_tree02.c         | 1 +
 16 files changed, 22 insertions(+), 4 deletions(-)
configure.ac +1 -0
index d50ec1ea7..dbd53cab6 100644
@@ -113,6 +113,7 @@ AC_CHECK_FUNCS_ONCE([ \
     mkdirat \
     mknodat \
     modify_ldt \
+    mount_setattr \
     move_mount \
     name_to_handle_at \
     open_tree \
include/lapi/fs.h +4 -2
index 27b3a183c..84a168a67 100644
@@ -6,8 +6,10 @@
  * Email: [email protected]
  */
 
-#ifdef HAVE_LINUX_FS_H
-# include <linux/fs.h>
+#ifndef HAVE_MOUNT_SETATTR
+# ifdef HAVE_LINUX_FS_H
+#  include <linux/fs.h>
+# endif
 #endif
 
 #include <sys/user.h>
include/lapi/fsmount.h +4 -2
index b11e7a7bd..9b1993580 100644
@@ -12,8 +12,10 @@
 #include <sys/syscall.h>
 #include <sys/types.h>
 
-#ifdef HAVE_LINUX_MOUNT_H
-# include <linux/mount.h>
+#ifndef HAVE_FSOPEN
+# ifdef HAVE_LINUX_MOUNT_H
+#  include <linux/mount.h>
+# endif
 #endif
 
 #include "lapi/fcntl.h"
testcases/kernel/syscalls/fsconfig/fsconfig01.c +1 -0
index a585daa6d..f1dc7d8da 100644
@@ -5,6 +5,7 @@
  * Basic fsconfig() test which tries to configure and mount the filesystem as
  * well.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/fsconfig/fsconfig02.c +1 -0
index 272e25a6f..bbad6def6 100644
@@ -4,6 +4,7 @@
  *
  * Basic fsconfig() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/fsmount/fsmount01.c +1 -0
index 5f755863f..1232b0914 100644
@@ -6,6 +6,7 @@
  * Basic fsmount() test.
  */
 
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/fsmount/fsmount02.c +1 -0
index a4f42dc18..91512b74a 100644
@@ -4,6 +4,7 @@
  *
  * Basic fsmount() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/fsopen/fsopen01.c +1 -0
index c2c719c96..332821cf0 100644
@@ -5,6 +5,7 @@
  * Basic fsopen() test which tries to configure and mount the filesystem as
  * well.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/fsopen/fsopen02.c +1 -0
index 3f287bf29..8c643b9a8 100644
@@ -4,6 +4,7 @@
  *
  * Basic fsopen() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/fspick/fspick01.c +1 -0
index d3309a912..ae6cad6fb 100644
@@ -4,6 +4,7 @@
  *
  * Basic fspick() test.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/fspick/fspick02.c +1 -0
index f9a3697c1..907b463b6 100644
@@ -4,6 +4,7 @@
  *
  * Basic fspick() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/mount_setattr/mount_setattr01.c +1 -0
index 83746b878..fcf491c33 100644
@@ -30,6 +30,7 @@
 #define _GNU_SOURCE
 
 #include <sys/statvfs.h>
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 #include "lapi/stat.h"
testcases/kernel/syscalls/move_mount/move_mount01.c +1 -0
index 445e6197e..b65141a28 100644
@@ -4,6 +4,7 @@
  *
  * Basic move_mount() test.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/move_mount/move_mount02.c +1 -0
index 45b1db4be..373c8c3ac 100644
@@ -4,6 +4,7 @@
  *
  * Basic move_mount() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/open_tree/open_tree01.c +1 -0
index 808d25665..6d2299449 100644
@@ -4,6 +4,7 @@
  *
  * Basic open_tree() test.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
testcases/kernel/syscalls/open_tree/open_tree02.c +1 -0
index ddaa204f2..59a5a4ca2 100644
@@ -4,6 +4,7 @@
  *
  * Basic open_tree() failure tests.
  */
+#include <sys/mount.h>
 #include "tst_test.h"
 #include "lapi/fsmount.h"
 
Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 2/2
#6 lore raw

Re: [LTP] [PATCH 2/2] lapi/fsmount: resolve conflict in different header files

Hi Li,

Quoted 5 lines

The latest glibc added new wrappers (e.g. mount_setattr, fsopen) support in sys/mount.h, which partly conflicts with linux/mount.h at the same time.

We need to make adjustments to header files to fix compiling error on different platforms.

thanks for fixing this!

LGTM, with suggestion.

Quoted 3 lines

+#include <sys/mount.h>
#include "tst_test.h"
#include "lapi/fsmount.h"

How about instead adding it to the tests to add it to lapi/fsmount.h ?

#include <sys/mount.h>
#ifndef HAVE_FSOPEN

# ifdef HAVE_LINUX_MOUNT_H
#  include <linux/mount.h>
# endif

Works on rawhide
https://github.com/pevik/ltp/actions/runs/2802006779
and on the rest
https://github.com/pevik/ltp/actions/runs/2801968366

and my branch li/fix-compiling-errors.fixes

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#7 lore raw

Re: [LTP] [PATCH 2/2] lapi/fsmount: resolve conflict in different header files

Hi Petr,

Quoted 10 lines · Petr Vorel

Hi Li,

Quoted 1 line

The latest glibc added new wrappers (e.g. mount_setattr, fsopen) support

in

Quoted 4 lines

sys/mount.h, which partly conflicts with linux/mount.h at the same time.

We need to make adjustments to header files to fix compiling error on different platforms.

thanks for fixing this!

Quoted 7 lines

LGTM, with suggestion.

Quoted 3 lines

+#include <sys/mount.h>
#include "tst_test.h"
#include "lapi/fsmount.h"

How about instead adding it to the tests to add it to lapi/fsmount.h ?

It's weird, I was unable to compile successfully like this way yesterday. So finally go by one by one including the header.

But after doing make distclean it works now, I guess there is probably something messes up my source directory.

Anyway, thanks for your quick review, will merge soon.

Signature · 2 lines
Regards,
Li Wang
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp