Fixing the many DEBUG statements that have confusing info ...

Richard Sharpe realrichardsharpe at gmail.com
Sun Oct 11 15:05:39 UTC 2015


On Sun, Oct 11, 2015 at 1:27 AM, Volker Lendecke
<Volker.Lendecke at sernet.de> wrote:
> On Sat, Oct 10, 2015 at 09:09:03PM -0700, Richard Sharpe wrote:
>> Hi folks,
>>
>> I thought I would spend some time fixing DEBUG statements using this idiom:
>>
>> @@ -705,8 +705,8 @@ static bool smbd_open_one_socket(struct smbd_parent_context
>> *parent,
>>         ifss,
>>         true);
>>   if (s->fd == -1) {
>> - DEBUG(0,("smbd_open_one_socket: open_socket_in: "
>> - "%s\n", strerror(errno)));
>> + DEBUG(0,("%s: open_socket_in: %s\n",
>> + __func__, strerror(errno)));
>>   TALLOC_FREE(s);
>>   /*
>>   * We ignore an error here, as we've done before
>>
>> where we use %s and __func__.
>>
>> However, then I looked at a log file, and saw the following:
>>
>> [2015/09/27 03:37:05.961482, 10, pid=13547, effective(0, 0), real(0,
>> 0)] ../source3/lib/messages_dgm.c:403(messaging_dgm_wipe)
>>   messaging_dgm_cleanup(12521) returned Resource temporarily unavailable
>>
>> That is, we already print the source file name, line number and the
>> function name. (And the debug message the produced that has gotten out
>> of sync with the actual location.)
>>
>> Why should we duplicate that info. Surely it is better to simply
>> eliminate the function names from DEBUG messages.
>
> Try smbd -d10 -i or any commandline tool.

Well, then we should fix the DEBUG macros so that they add __func__ in
all cases.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)



More information about the samba-technical mailing list