Bug 483548 - <sys/capability.h> is a complete disaster of a header
<sys/capability.h> is a complete disaster of a header
Product: Fedora
Classification: Fedora
Component: libcap (Show other bugs)
i386 Linux
high Severity medium
: ---
: ---
Assigned To: Karsten Hopp
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-02-02 06:48 EST by Kamil Dudka
Modified: 2009-04-11 22:48 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-03-22 13:15:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Kamil Dudka 2009-02-02 06:48:50 EST
Description of problem:
In file included from /usr/include/bits/sigcontext.h:28,
                 from /usr/include/signal.h:333,
                 from ../lib/signal.h:32,
                 from ls.c:66:
/usr/include/asm/sigcontext.h:28: error: expected specifier-qualifier-list before '__u64'
/usr/include/asm/sigcontext.h:191: error: expected specifier-qualifier-list before '__u64'

Version-Release number of selected component (if applicable):

Actual results:

Expected results:

Additional info:
works with kernel-headers-2.6.29-0.53.rc2.git1.fc11
Comment 1 Quentin Armitage 2009-02-04 09:58:09 EST
The problem is introduced at rc3.git3 (i.e. rc3.git2 does not exhibit the problem).

The problem is caused by the following change:
--- 73/usr/include/asm/sigcontext.h	2009-01-31 02:40:27.000000000 +0000
+++ 74/usr/include/asm/sigcontext.h	2009-02-01 01:56:00.000000000 +0000
@@ -2,7 +2,7 @@
 #define _ASM_X86_SIGCONTEXT_H
-#include <asm/types.h>
+#include <linux/types.h>
 #define FP_XSTATE_MAGIC1	0x46505853U
 #define FP_XSTATE_MAGIC2	0x46505845U

which is referenced in the changelog as:
commit e59afe6a21dce7bb3c63ba4f894a3195ae3d5529
Author: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Date:   Fri Jan 30 22:53:49 2009 +0530

    headers_check fix: x86, sigcontext.h
    fix the following 'make headers_check' warnings:
      usr/include/asm/sigcontext.h:5: include of <linux/types.h> is preferred over <asm/types.h>
      usr/include/asm/sigcontext.h:24: found __[us]{8,16,32,64} type without #include <linux/types.h>
    Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Comment 2 Ondrej Vasik 2009-02-24 12:00:22 EST
Raising priority to high - this bug/regression still blocks coreutils builds in rawhide.
Comment 3 Kyle McMartin 2009-02-24 18:43:00 EST
This is almost certainly a bug in the games coreutils is playing with signal.h, I'm looking at the preprocessed source (gcc -E) now, and __u64 isn't getting included. Why? I'm guessing because a header guard is duplicated.
Comment 4 Kyle McMartin 2009-02-24 19:08:15 EST
Nope, bug in libcap-devel, which is just stupendously horrendously broken. It's defining header guards when it shouldn't be, which prevents the correct _LINUX_TYPES_H_ from being included.

In the meantime, coreutils can likely be fixed by moving the <sys/capability.h> include further down, or explicitly including <linux/types.h> early.

Comment 5 Kyle McMartin 2009-02-24 19:23:00 EST
Sorry, meant http://kyle.fedorapeople.org/libcap-sanitized-for-userspace.diff
Comment 6 Miroslav Lichvar 2009-02-27 05:41:24 EST
This bug prevents also chrony package to build. Reversing the order of the signal.h and capability.h includes helps, but still would be nice to have this fixed properly.
Comment 7 Karsten Hopp 2009-03-22 13:15:34 EDT
please try again with libcap-2.16-2.fc11 and reopen if the problem still exists.
I was able to build the latest chrony vom cvs without the -cap patch.
Comment 8 Ralph Loader 2009-04-11 22:36:51 EDT
Still breaks for me trying to compile VirtualBox, or a small test program.  [I don't seem to have perms to re-open the bug, could someone else do it?]

$ cat temp.c
#include <sys/capability.h>

$ gcc -c temp.c
In file included from /usr/include/sys/capability.h:23,
                 from temp.c:1:
/usr/include/stdint.h:41: error: conflicting types for ‘int64_t’
/usr/include/linux/types.h:98: note: previous declaration of ‘int64_t’ was here
/usr/include/stdint.h:56: error: conflicting types for ‘uint64_t’
/usr/include/linux/types.h:96: note: previous declaration of ‘uint64_t’ was here
Comment 9 Ralph Loader 2009-04-11 22:48:34 EDT
Looks like: (a) including linux/types.h then stdint.h is broken (kernel-headers / glibc problem).
(b) unistd.h or similar is needed for ssize_t

Note You need to log in before you can comment on or make changes to this bug.