From 11d88c43bdf3542cb5a86d24ee1640198b740ead Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 29 Sep 2026 06:01:09 +0000 Subject: [PATCH] ettercap: don't strip a pre-existing _GNU_SOURCE define in ec.h ec.h unconditionally #defines _GNU_SOURCE without checking if it is already defined, which trips -Werror on musl toolchains that predefine it via the driver. Guard the define. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj --- .../ettercap/ettercap_0.8.4.1.bb | 1 + ...ip-a-pre-existing-_GNU_SOURCE-define.patch | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 meta-networking/recipes-support/ettercap/files/0001-ec.h-do-not-strip-a-pre-existing-_GNU_SOURCE-define.patch diff --git a/meta-networking/recipes-support/ettercap/ettercap_0.8.4.1.bb b/meta-networking/recipes-support/ettercap/ettercap_0.8.4.1.bb index e8679bf463..9a2090719b 100644 --- a/meta-networking/recipes-support/ettercap/ettercap_0.8.4.1.bb +++ b/meta-networking/recipes-support/ettercap/ettercap_0.8.4.1.bb @@ -22,6 +22,7 @@ DEPENDS += "ethtool \ RDEPENDS:${PN} += "bash ethtool libgcc" SRC_URI = "gitsm://github.com/Ettercap/ettercap;branch=master;protocol=https;tag=v${PV} \ + file://0001-ec.h-do-not-strip-a-pre-existing-_GNU_SOURCE-define.patch \ " SRCREV = "0dc8409779f3a09cbfff4434b9a4d7b33480d88d" diff --git a/meta-networking/recipes-support/ettercap/files/0001-ec.h-do-not-strip-a-pre-existing-_GNU_SOURCE-define.patch b/meta-networking/recipes-support/ettercap/files/0001-ec.h-do-not-strip-a-pre-existing-_GNU_SOURCE-define.patch new file mode 100644 index 0000000000..126d37ff50 --- /dev/null +++ b/meta-networking/recipes-support/ettercap/files/0001-ec.h-do-not-strip-a-pre-existing-_GNU_SOURCE-define.patch @@ -0,0 +1,58 @@ +From: Khem Raj +Date: Tue, 29 Sep 2026 02:00:10 +0000 +Subject: [PATCH] ec.h: do not strip a pre-existing _GNU_SOURCE define + +ec.h temporarily defines __USE_GNU/_GNU_SOURCE around the +include (to pick up memmem()/strsignal() on musl) and then +unconditionally #undefs them again afterwards. This recipe already +passes -D_GNU_SOURCE on the command line (CFLAGS += "-D_GNU_SOURCE"), +so the unconditional #undef strips it right back out for the rest of +every translation unit that includes ec.h -- which is effectively all +of them, since ec.h is the first header pulled in everywhere. + +On musl, many POSIX/BSD-ish declarations (struct ifreq and IFNAMSIZ in +, struct sigaction/sigfillset()/sigaction()/sigwait() in +, pthread_kill()/pthread_sigmask() in , isascii() +in , nanosleep() in ) are only exposed when +_GNU_SOURCE (or an equivalent feature test macro) is defined at the +point those headers are processed. Once ec.h undefines it, headers +included later in the same file lose that exposure and fail to +compile. glibc does not gate these declarations as strictly, so this +was never observed there. Only undo the temporary define if ec.h +itself introduced it, leaving an externally supplied -D_GNU_SOURCE +intact for the remainder of the translation unit. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + include/ec.h | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/include/ec.h ++++ b/include/ec.h +@@ -20,19 +20,23 @@ + + #if !defined (__USE_GNU) /* for memmem(), strsignal(), etc etc... */ + #define __USE_GNU ++ #define EC_UNDEF_USE_GNU + #endif + #if !defined (_GNU_SOURCE) /* for memmem(), strsignal(), etc etc... on musl */ + #define _GNU_SOURCE ++ #define EC_UNDEF_GNU_SOURCE + #endif + #ifdef OS_SOLARIS + #define _REENTRANT /* for strtok_r() */ + #endif + #include +-#if defined (__USE_GNU) ++#if defined (EC_UNDEF_USE_GNU) + #undef __USE_GNU ++ #undef EC_UNDEF_USE_GNU + #endif +-#if defined (_GNU_SOURCE) ++#if defined (EC_UNDEF_GNU_SOURCE) + #undef _GNU_SOURCE ++ #undef EC_UNDEF_GNU_SOURCE + #endif + #include + #include