6071220fcb1 libcli: Make debug_unix_user_token() use just one DEBUG statement 09c787c34a9 libcli: Make security_token_debug() use just one DEBUG statement 1ad84c70fe2 libcli: Convert security_token_debug_privileges() to talloc_asprintf In these commits, original DEBUG/DEBUGADDC considers the debug level. Once changed to talloc_asprintf/talloc_asprintf_addbuf, it is done for any debug level. Original: - DEBUGADDC(dbg_class, dbg_lev, - (" Right[%3lu]: %s\n", (unsigned long)i++, - rights[idx].name)); New: + talloc_asprintf_addbuf(&s, + " Right[%3zu]: %s\n", + i++, + rights[idx].name); I have observed specfs performance degradation, and removal of these commits got back the numbers. In case, these changes are printing it to log for any debug level, that can be the reason, and need a fix. Even otherwise, need to check if we are issuing talloc* without considering the debug level and fix.
Thanks for finding this. I would like to keep the "just one DBG" statement for enhanced debugging, so the callers need to be adapted to not call the string generators at all. For example in debug_unix_user_token you could use an early return, likewise for the other ones. If you need to keep this private to your product, please note this here so that we can fix it upstream in parallel as well at some point in the future.
Created attachment 18475 [details] Patch Does that help?
Thanks a lot! I have checked logs go off and on fine with and without debug level 10. Have seen some lesser performance numbers though. We will also need "TALLOC_FREE(frame);" I think. I am checking and testing.
Created attachment 18477 [details] Patch v1
With the TALLOC_FREE added as in attached patch, able to get similar performance numbers as deleting the commits. Also, works well in terms of debug on and off. Thanks a lot for the help!