Bug#703540: Inconsistent use of _GNU_SOURCE
tags 703540 + pending patch
thanks
Quoted 8 lines · On Wednesday 20 March 2013 17:51:54 you wrote:
While building the package using our research compiler infrastructure we noticed conflicting types being used in the linked executable. This is due to
_GNU_SOURCEbeing defined inlinux/route.candposix/unix_socket.c, but not in any other file. As a result, system headers expand to conflicting declarations. (This was at least noticed for the sendto function, but may extend to others.)Either all or no file should #define
_GNU_SOURCE.
Please add information how to reproduce this the next time you are adding such such a bug. Now I can just assume what you are writing is true (even when the man page about sendto says otherwise). Not knowing how to reproduce it in the best possible way just makes it harder for everyone to check the impact of the problem.
I've forwarded it to the upstream maintainer and attached the change for Debian.
Kind regards,
Sven
From 5041828ddb165b1c72c7fc4345aa6e0bec7abfa5 Mon Sep 17 00:00:00 2001
From: Sven Eckelmann <[email protected]>
Date: Thu, 21 Mar 2013 09:21:48 +0100
Subject: [PATCH] Define _GNU_SOURCE for all POSIX target source files
Defining _GNU_SOURCE in source files differently can result in conflicting types.
--- debian/changelog | 3 +++ debian/patches/define_gnu_source.patch | 43 ++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 47 insertions(+) create mode 100644 debian/patches/define_gnu_source.patch create mode 100644 debian/patches/series
debian/changelog +3 -0
@@ -2,6 +2,9 @@ batmand (0.3.2+50+g06537ed-2) UNRELEASED; urgency=low * Upgraded to policy 3.9.4, no changes required * Remove obsolete DM-Upload-Allowed in debian/control + * debian/patches: + - Add define_gnu_source.patch, Define _GNU_SOURCE for all POSIX target + source files (Closes: #703540) -- Sven Eckelmann <[email protected]> Wed, 19 Sep 2012 08:53:36 +0200
debian/patches/define_gnu_source.patch new file +43 -0
43 lines not on this page · raw message
debian/patches/series new file +1 -0
@@ -0,0 +1 @@ +define_gnu_source.patch
Signature · 1 line
1.7.10.4
PATCH 1/1 batmand: Either all or no source file should #define _GNU_SOURCE.
Subject: [PATCH] Either all or no source file should #define _GNU_SOURCE.
Thanks to Sven Eckelmann and Michael Tautschnig for reporting and fixes.
--- Makefile | 1 + linux/route.c | 1 - posix/unix_socket.c | 1 - 3 files changed, 1 insertion(+), 2 deletions(-)
Makefile +1 -0
@@ -27,6 +27,7 @@ LINUX_OBJ = linux/route.o linux/tun.o linux/kernel.o ifeq ($(UNAME),Linux) OS_OBJ = $(LINUX_OBJ) $(POSIX_OBJ) +CPPFLAGS += -D_GNU_SOURCE endif OBJ = batman.o originator.o schedule.o list-batman.o allocate.o bitarray.o hash.o profile.o ring_buffer.o hna.o $(OS_OBJ)
linux/route.c +0 -1
@@ -21,7 +21,6 @@ -#define _GNU_SOURCE#include <sys/ioctl.h> #include <arpa/inet.h> /* inet_ntop() */ #include <errno.h>
posix/unix_socket.c +0 -1
@@ -21,7 +21,6 @@ -#define _GNU_SOURCE#include <sys/time.h> #include <stdio.h> #include <fcntl.h>
Signature · 1 line
1.7.9.5
Elektra
AppliedRe: [B.A.T.M.A.N.] [PATCH] batmand: Either all or no source file should #define _GNU_SOURCE.
Applied in commit 1e275d939d45ecc1d96957a353dc639d28aefb52
Author: Elektra Wagenrad <[email protected]> Date: Thu Mar 21 15:57:45 2013 +0100
Either all or no source file should #define _GNU_SOURCE.
Thanks to Sven Eckelmann and Michael Tautschnig for reporting and fixing.
Thanks, everyone!
Cheers,
Elektra
Quoted 48 lines
Subject: [PATCH] Either all or no source file should #define
_GNU_SOURCE.Thanks to Sven Eckelmann and Michael Tautschnig for reporting and fixes.
--- Makefile | 1 + linux/route.c | 1 - posix/unix_socket.c | 1 - 3 files changed, 1 insertion(+), 2 deletions(-)Makefile +1
-0@@ -27,6 +27,7 @@ LINUX_OBJ = linux/route.o linux/tun.o linux/kernel.o ifeq ($(UNAME),Linux) OS_OBJ = $(LINUX_OBJ) $(POSIX_OBJ) +CPPFLAGS += -D_GNU_SOURCE endif OBJ = batman.o originator.o schedule.o list-batman.o allocate.o bitarray.o hash.o profile.o ring_buffer.o hna.o $(OS_OBJ)linux/route.c +0
-1@@ -21,7 +21,6 @@ -#define _GNU_SOURCE#include <sys/ioctl.h> #include <arpa/inet.h> /* inet_ntop() */ #include <errno.h> posix/unix_socket.c +0
-1@@ -21,7 +21,6 @@ -#define _GNU_SOURCE#include <sys/time.h> #include <stdio.h> #include <fcntl.h> Signature · 1 line
1.7.9.5
Signature · 1 line
Elektra <[email protected]>
Hi Sven, hi all,
[...]
Quoted 8 lines
Quoted 1 line
Either all or no file should #define
_GNU_SOURCE.Please add information how to reproduce this the next time you are adding such such a bug. Now I can just assume what you are writing is true (even when the man page about sendto says otherwise). Not knowing how to reproduce it in the best possible way just makes it harder for everyone to check the impact of the problem.
Just one question before I elaborate a bit: what information in the man page are you referring to? I can't quite seem to see anything mentioning _GNU_SOURCE?
I fully understand your concerns and indeed it is a problem that I cannot quite provide a concrete counterexample witnessing the problem. It may even be the cast that, at present, this is only a potential problem and not a real one. It's much like a compiler warning: ok to be ignored if you are doing it intentionally and you are 100% sure you know what you are doing. In all other cases, however, it is likely worth fixing, as the problem can only ever be found by link-time type checking, which usual compilers can't do. Even if done, there is some non-trivial effort required to tracing back the type inconsistency to inconsistent order of #include or a missing #define.
The most I can provide right now is all the scripts that suffice to reproduce the build results and error logs, to be found at
https://github.com/tautschnig/cprover-debian
Quoted 3 lines
I've forwarded it to the upstream maintainer and attached the change for Debian.
[...]
Thanks!
Best,
Michael
Hi Michael,
Quoted 29 lines · Michael Tautschnig
Hi Sven, hi all,
[...]
Quoted 8 lines
Quoted 1 line
Either all or no file should #define
_GNU_SOURCE.Please add information how to reproduce this the next time you are adding such such a bug. Now I can just assume what you are writing is true (even when the man page about sendto says otherwise). Not knowing how to reproduce it in the best possible way just makes it harder for everyone to check the impact of the problem.
Just one question before I elaborate a bit: what information in the man page are you referring to? I can't quite seem to see anything mentioning
_GNU_SOURCE?I fully understand your concerns and indeed it is a problem that I cannot quite provide a concrete counterexample witnessing the problem. It may even be the cast that, at present, this is only a potential problem and not a real one. It's much like a compiler warning: ok to be ignored if you are doing it intentionally and you are 100% sure you know what you are doing. In all other cases, however, it is likely worth fixing, as the problem can only ever be found by link-time type checking, which usual compilers can't do. Even if done, there is some non-trivial effort required to tracing back the type inconsistency to inconsistent order of #include or a missing #define.
The most I can provide right now is all the scripts that suffice to reproduce the build results and error logs, to be found at
https://github.com/tautschnig/cprover-debian
Quoted 7 lines
Quoted 3 lines
I've forwarded it to the upstream maintainer and attached the change for Debian.
[...]
Thanks!
Elektra provided a patch to fix this issue and it has been applied already. The patch and the related "Applied!" message have been posted to the batman ml, maybe you are not subscribed and you did not get them?
Cheers,
Signature · 4 lines
Antonio Quartulli ..each of us alone is worth nothing.. Ernesto "Che" Guevara
Quoted 9 lines · On Friday 29 March 2013 11:48:16 Michael Tautschnig wrote:
Hi Sven, hi all,
[...]
Quoted 5 lines
Quoted 1 line
Either all or no file should #define
_GNU_SOURCE.Please add information how to reproduce this the next time you are adding such such a bug. Now I can just assume what you are writing is true (even when the man page about sendto says otherwise).
[...]
Quoted 3 lines
Just one question before I elaborate a bit: what information in the man page are you referring to? I can't quite seem to see anything mentioning
_GNU_SOURCE?
Yes, this was exactly the thing I was pointing out:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(This was at least noticed for the sendto function, but may extend to others.)
Kind regards,
Sven