Bug#630907: <bsd/stdio.h> header protection breaks <stdio.h> when using libbsd overlay
Package: libbsd-dev
Version: 0.3.0-1
Severity: important
Tags: patch
See attached test case. Header protection in <bsd/stdio.h> may prevent
glibc <stdio.h> from being included in normal mode.
I recommend moving all header inclussions in libbsd out of the header
protected scope. Example attached for stdio.h but similar problems
may exist in other headers.
rmh@dimoni:/tmp$ gcc test.c -o test && ./test
hi
rmh@dimoni:/tmp$ gcc test.c -o test $(pkg-config --cflags libbsd-overlay) && ./test
In file included from /usr/include/grp.h:55:0,
from test.c:1:
test.c: In function �ain�
test.c:7:3: warning: incompatible implicit declaration of built-in function �printf�[enabled by default]
test.c:7:12: error: �tdout�undeclared (first use in this function)
test.c:7:12: note: each undeclared identifier is reported only once for each function it appears in
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: kfreebsd-amd64 (x86_64)
Kernel: kFreeBSD 8.2-1-amd64
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libbsd-dev depends on:
ii libbsd0 0.3.0-1 utility functions from BSD systems
libbsd-dev recommends no packages.
libbsd-dev suggests no packages.
-- no debconf information
#include <grp.h> /* this drags in <bsd/stdio.h> in __need_FILE mode */
#include <stdio.h> /* we're including <bsd/stdio.h>, but nothing happens due to header protection */
main ()
{
fprintf (stdout, "hi\n");
}
--- /usr/include/bsd/stdio.h~ 2011-06-18 18:35:26.310898171 +0200
+++ /usr/include/bsd/stdio.h 2011-06-18 18:35:05.635106136 +0200
@@ -24,18 +24,18 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef LIBBSD_STDIO_H
-#define LIBBSD_STDIO_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
#ifdef LIBBSD_OVERLAY
#include_next <stdio.h>
#else
#include <stdio.h>
#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#ifndef LIBBSD_STDIO_H
+#define LIBBSD_STDIO_H
+
__BEGIN_DECLS
const char *fmtcheck(const char *, const char *);
Reply to: