The header files fcntl.h and linux/fcntl.h are incompatible

Bug #1739300 reported by Mike Jonkmans
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
Confirmed
Undecided
Unassigned
linux (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

The program try.c, below, does not compile.
Though with HAVE_ARCH_STRUCT_FLOCK and HAVE_ARCH_STRUCT_FLOCK64 defined, it compiles.
But then fails again to compile, when _GNU_SOURCE is also defined.
I expect this to compile in all three cases.

$ cat try.c
//#define _GNU_SOURCE
//#define HAVE_ARCH_STRUCT_FLOCK
//#define HAVE_ARCH_STRUCT_FLOCK64
#include <fcntl.h>
#include <linux/fcntl.h>
int main(int argc, char *argv[]){}

$ gcc try.c
In file included from /usr/include/x86_64-linux-gnu/asm/fcntl.h:1:0,
                 from /usr/include/linux/fcntl.h:4,
                 from try.c:5:
/usr/include/asm-generic/fcntl.h:195:8: error: redefinition of ‘struct flock’
 struct flock {
        ^~~~~
In file included from /usr/include/fcntl.h:35:0,
                 from try.c:4:
/usr/include/x86_64-linux-gnu/bits/fcntl.h:35:8: note: originally defined here
 struct flock
        ^~~~~
$ gcc -DHAVE_ARCH_STRUCT_FLOCK -DHAVE_ARCH_STRUCT_FLOCK64 try.c ## this is ok

$ gcc -D_GNU_SOURCE -DHAVE_ARCH_STRUCT_FLOCK -DHAVE_ARCH_STRUCT_FLOCK64 try.c
In file included from /usr/include/x86_64-linux-gnu/asm/fcntl.h:1:0,
                 from /usr/include/linux/fcntl.h:4,
                 from try.c:5:
/usr/include/asm-generic/fcntl.h:155:8: error: redefinition of ‘struct f_owner_ex’
 struct f_owner_ex {
        ^~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/fcntl.h:61:0,
                 from /usr/include/fcntl.h:35,
                 from try.c:4:
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:267:8: note: originally defined here
 struct f_owner_ex
        ^~~~~~~~~~

$ gcc --version | head -1
gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0

$ lsb_release -rd
Description: Ubuntu 17.10
Release: 17.10

$ dpkg -S /usr/include/x86_64-linux-gnu/bits/fcntl.h
libc6-dev:amd64: /usr/include/x86_64-linux-gnu/bits/fcntl.h
# Package: libc6-dev
# Version: 2.26-0ubuntu2

$ dpkg -S /usr/include/x86_64-linux-gnu/asm/fcntl.h
linux-libc-dev:amd64: /usr/include/x86_64-linux-gnu/asm/fcntl.h
# Package: linux-libc-dev
# Version: 4.13.0-19.22

Regards, Mike

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1739300/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
Revision history for this message
Mike Jonkmans (mjo) wrote :

packages linux-libc-dev and libc6-dev rather than build-essential; but these are not packages in ubuntu?!

affects: ubuntu → build-essential (Ubuntu)
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

>packages linux-libc-dev and libc6-dev (..) these are not packages in ubuntu?!

They are, but they are part of the linux and glibc source packages, respectively. Marked both these as affected now. :)

When reporting bugs in the future please use apport by using 'ubuntu-bug' and the name of the package affected. That will add the report in the right place and also include additional information like version numbers automatically. You can learn more about this functionality at https://wiki.ubuntu.com/ReportingBugs.

affects: build-essential (Ubuntu) → linux (Ubuntu)
tags: added: artful
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1739300

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Mike Jonkmans (mjo) wrote :

Thx, Hans Joachim.
Problem with ubuntu-bug was, that i did not know the package to put this on.

apport-collect 1739300 freezes on my system.

But there are no logs needed in this case, i presume.
So status => Confirmed

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Mike Jonkmans (mjo)
Changed in linux (Ubuntu):
status: Confirmed → New
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1739300

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Mike Jonkmans (mjo) wrote :

due to the nature of the issue i have encountered, i am unable to run
apport-collect 1739300
and have changed the bug status to 'Confirmed' (for the second time).

Changed in glibc (Ubuntu):
status: New → Confirmed
Changed in linux (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Mike Jonkmans (mjo) wrote :

Setting the status to Confirmed, though i am the reporter.
This is slightly inconsistent. Brain hurts.

Revision history for this message
Mike Jonkmans (mjo) wrote :

please take this further or close it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.