[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



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.


Reply to: