Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #61028 > unrolled thread

Bug#898743: <sys/mount.h> breaks when #included after <linux/fs.h>

Started byHelmut Grohne <helmut@subdivi.de>
First post2018-05-15 17:10 +0200
Last post2018-05-15 17:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.debian.kernel


Contents

  Bug#898743: <sys/mount.h> breaks when #included after <linux/fs.h> Helmut Grohne <helmut@subdivi.de> - 2018-05-15 17:10 +0200

#61028 — Bug#898743: <sys/mount.h> breaks when #included after <linux/fs.h>

FromHelmut Grohne <helmut@subdivi.de>
Date2018-05-15 17:10 +0200
SubjectBug#898743: <sys/mount.h> breaks when #included after <linux/fs.h>
Message-ID<vPJKp-66m-3@gated-at.bofh.it>
Package: linux-libc-dev,libc6-dev
Severity: serious
Justification: makes systemd ftbfs
User: helmutg@debian.org
Usertags: rebootstrap
Control: affects -1 + src:systemd libmount-dev

systemd FTBFS here, because compiling load-fragment.c fails. I spent a while
minimizing that file and it boils down to:

$ cat test.c
#include <linux/fs.h>
#include <sys/mount.h>
$ gcc -c test.c
In file included from test.c:1:0:
/usr/include/x86_64-linux-gnu/sys/mount.h:35:3: error: expected identifier before numeric constant
   MS_RDONLY = 1,  /* Mount read-only.  */
   ^
$

linux/fs.h #defines MS_RDONLY and then sys/mount.h tries to create an
enum containing MS_RDONLY. That's a problem.

This is also known in fedora:
https://bugzilla.redhat.com/show_bug.cgi?id=1497501

That bug hints that sometimes headers need to #included in a certain
order. If that is the case, this bug should be reassigned to src:systemd
asking that <libmount.h> or <sys/mount.h> must be #included before
<linux/fs.h>. It also means that <libmount.h> should #include
<sys/mount.h> before defining its own copies of these macros.

Helmut

PS: Let me briefly curse systemd for their use of cyclic #includes
    (unit.h <-> cgroup.h) and #pragma once as that works pretty badly
    with creduce. Thank you.

[toc] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web