It is common to use the name "DEBUG" for debug macros/functions in c/c++ projects. With the recent changes in samba 4.2, macro "DEBUG" is defined if public header file "ndr.h" is included in c/c++ module Here is a part of build log from sssd: In file included from /usr/include/samba-4.0/util/fault.h:27:0, from /usr/include/samba-4.0/samba_util.h:62, from /usr/include/samba-4.0/ndr.h:30, from src/providers/ad/ad_gpo.c:52: /usr/include/samba-4.0/util/debug.h:182:0: warning: "DEBUG" redefined #define DEBUG( level, body ) \ ^ In file included from src/providers/ad/ad_gpo.c:38:0: ./src/util/util.h:126:0: note: this is the location of the previous definition #define DEBUG(level, format, ...) do { \ ^ src/providers/ad/ad_gpo.c: In function 'ad_gpo_parse_map_option_helper': src/providers/ad/ad_gpo.c:265:38: error: macro "DEBUG" passed 3 arguments, but takes just 2 hash_error_string(hret)); Full log file: https://kojipkgs.fedoraproject.org//work/tasks/9191/8539191/build.log
The change can be caused by commit 8dac190ee1bc0e7f6d17eeca097f027fcaf584ed Author: Martin Schwenke <martin@meltin.net> Date: Mon Sep 22 19:43:27 2014 +1000 lib/util: Clean up includes for fault.c The commit added public header file "lib/util/fault.h", which includes '#include "debug.h"' There isn't such problem with samba-devel-4.1.14
Note, this is rather badly breaking Fedora Rawhide at present; it's stopping sssd from building, but sssd needs rebuilding against an updated library. This means you can't currently do a network install of most Fedora package sets, and nightly image composes are building. So, Samba devs who care about Fedora, please help :)
fault.c already includes debug.h Does the build still work if #include "debug.h" is removed from fault.h ?
Created attachment 10586 [details] Test patch Can you check if this works for Fedora ?
Jeremy, If you look at the lines below where you removed debug.h you will notice that the SMB_ASSERT macro is defined at this position using the DEBUG macro. I guess it will not compile ...
I think the right approach would be to protect the macros ... #ifndef DEBUG #define DEBUG(level, body) ... #endif and prefix the function with samba_ and the enums etc. too.
(In reply to Andreas Schneider from comment #5) Oh that's strange, 'cos I just recompiled it successfully :-). Must have missed something.
(In reply to Andreas Schneider from comment #6) Why are the DEBUG macros public at all? Are they considered public Samba API? Wouldn't it be better to prefix anything that's exported in public headers with a samba-specific prefix?
Patch for master has been pushed to autobuild. Will cherry-pick into 4.2 when it lands in master.
Created attachment 10603 [details] v4-2-test patch
To avoid confusion, Jeremy's patch should be dropped, right? Also, is just one review in addition to Andreas' sign-off sufficient to reassign to Karolin?
Karolin, please add the patch to 4.2.0. Thanks
(In reply to Andreas Schneider from comment #12) Pushed to autobuild-v4-2-test.
Pushed to v4-2-test. Closing out bug report. Thanks!
The additional patch for this ticket was pushed to master few weeks ago. Would it be possible to back port it to samba v4-2? commit 9643a4b1ef2ada764f454ecc82aa6936217967fc Author: Lukas Slebodnik <lslebodn@redhat.com> AuthorDate: Thu Mar 5 11:26:46 2015 +0100 Commit: Jeremy Allison <jra@samba.org> CommitDate: Wed Mar 11 18:47:22 2015 +0100 lib/util: Include DEBUG macro in internal header files before samba_util.h
Re-assigning to Jeremy.
Created attachment 10959 [details] Extra patch for 4.2.next. If asn +1's it we'll get this into 4.2.2.
Comment on attachment 10959 [details] Extra patch for 4.2.next. LGTM
Karolin, please add the extra patch to the 4.2 branch. Thanks.
(In reply to Andreas Schneider from comment #19) Pushed extra patch to autobuild-v4-2-test.
Thank you very much
(In reply to Karolin Seeger from comment #20) Pushed to v4-2-test. Closing out bug report. Thanks!