Hello,

On Wed, 31 May 2017 23:41:26 +0000, Anthony G. Basile wrote:
> From: "Anthony G. Basile" <bluen...@gentoo.org>
> 
> man feature_test_macros(7) specifies that _BSD_SOURCE and _SVID_SOURCE have
> been deprecated in favor of _DEFAULT_SOURCE since libc 2.20.  Specifying
> either of the former is now equivalent to specifying just the latter.  We add
> this macro to conform to this standard, but do not add the compiler warning
> to maintain full backwards compatibility with earlier version of glibc and
> uclibc.
> 
> Signed-off-by: Anthony G. Basile <bluen...@gentoo.org>

This patch breaks the build of the "knock" package in Buildroot:

  
http://autobuild.buildroot.net/results/908/90863b5adb769a346acd3dc4bbe8d5fa497a0581/build-end.log

src/knockd.c:1296:37: error: 'struct tcphdr' has no member named 'th_flags'

The tcphdr structure is defined in uClibc in two different ways,
depending on whether _FAVOR_BSD is defined or not. If _FAVOR_BSD is
defined, then the structure does have this th_flags member, otherwise
not.

_FAVOR_BSD is defined as follows:

#if defined _BSD_SOURCE && \
    !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
      defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
      defined _GNU_SOURCE || defined _SVID_SOURCE)
# define __FAVOR_BSD    1
#endif

When being built, the program passes both -D_BSD_SOURCE and
-D_DEFAULT_SOURCE. However, this patch has the effect that defining
_DEFAULT_SOURCE defines _SVID_SOURCE, which has the side effect of no
longer defining _FAVOR_BSD.

The definition of _DEFAULT_SOURCE is that it is equivalent to defining
_BSD_SOURCE and _SVID_SOURCE. However, it turns out that in the context
of uClibc, defining _SVID_SOURCE prevents __FAVOR_BSD from being
defined.

Where is the bug? In what the knock build system is doing, or in uClibc?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
_______________________________________________
devel mailing list
devel@uclibc-ng.org
https://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel

Reply via email to