[SSSD] Imperfection of new debug levels macros

Pavel Březina pbrezina at redhat.com
Wed Nov 2 15:56:02 UTC 2011


Hi all,
while working on the sudo I've noticed some semantic issues with debug 
level names.

The debug levels are defined as:

#define SSSDBG_FATAL_FAILURE  0x0010   /* level 0 */
#define SSSDBG_CRIT_FAILURE   0x0020   /* level 1 */
#define SSSDBG_OP_FAILURE     0x0040   /* level 2 */
#define SSSDBG_MINOR_FAILURE  0x0080   /* level 3 */
#define SSSDBG_CONF_SETTINGS  0x0100   /* level 4 */
#define SSSDBG_FUNC_DATA      0x0200   /* level 5 */
#define SSSDBG_TRACE_FUNC     0x0400   /* level 6 */
#define SSSDBG_TRACE_LIBS     0x1000   /* level 7 */
#define SSSDBG_TRACE_INTERNAL 0x2000   /* level 8 */
#define SSSDBG_TRACE_ALL      0x4000   /* level 9 */

Unfortunately there are some old DEBUG call that does not correspond 
with these names. Look at this snippet from responder initialization:

     if (ret != EOK) {
         DEBUG(0, ("Failed to set up automatic
                    reconnection\n"));
         return ret;
     }

     for (iter = sctx->rctx->be_conns; iter; iter = iter->next) {
         sbus_reconnect_init(iter->conn, max_retries,
                             sudo_dp_reconnect_init, iter);
     }

     DEBUG(1, ("SUDO Initialization complete\n"));

It is ok to replace the 0 with SSSDBG_FATAL_FAILURE (however I would 
prefer SSSDBG_CRIT_FAILURE as it does not prevent reponder from starting).
But more important is - I can't use SSSDBG_CRIT_FAILURE, because it is 
semantically nonsense. There should be SSSDBG_TRACE_FUNC. But if I use 
it, it will differ from other responders and that would be just confusing.

Another problem is that debug levels that are described in the man page 
(master) does not correspond the way it is used in the code.



More information about the sssd-devel mailing list