On Tue, Jul 11, 2017 at 11:05:54PM +0100, Ondřej Kuzník wrote:
> Yes, it removes the sprintfs, but I would have expected it to produce
> this patch (note the if()s have been removed) as it manages in other
> files:
> 
> --- servers/slapd/back-sql/add.c
> +++ /tmp/cocci-output-22443-aee224-add.c
> @@ -858,12 +858,10 @@ backsql_add_attr(
>  
>  #ifdef LDAP_DEBUG
> -               if ( LogTest( LDAP_DEBUG_TRACE ) ) {
> -                       snprintf( logbuf, sizeof( logbuf ), "val[%lu], id=" 
> BACKSQL_IDNUMFMT,
> -                                       i, new_keyval );
> -                       Debug( LDAP_DEBUG_TRACE, "   
> backsql_add_attr(\"%s\"): "
> -                               "executing \"%s\" %s\n", 
> -                               op->ora_e->e_name.bv_val,
> -                               at_rec->bam_add_proc, logbuf );
> -               }
> +               Debug(LDAP_DEBUG_TRACE,
> +                     "   backsql_add_attr(\"%s\"): " "executing \"%s\" 
> val[%lu], id=" BACKSQL_IDNUMFMT\n",

Oh, somehow the end of the format string gets mangled, presumably in the
Python code, which doesn't expect this at all, so I guess this would be
the reason the last part of the patch never applies. Sorry.

> +                     op->ora_e->e_name.bv_val, at_rec->bam_add_proc,
> +                     i, new_keyval);
>  #endif
>                 rc = SQLExecute( sth );
> @@ -1387,14 +1385,11 @@ backsql_add( Operation *op, SlapReply *r
>         }
>  
> -       if ( LogTest( LDAP_DEBUG_TRACE ) ) {
> -               char buf[ SLAP_TEXT_BUFLEN ];
> -
> -               snprintf( buf, sizeof(buf),
> -                       "executing \"%s\" for dn=\"%s\"  oc_map_id=" 
> BACKSQL_IDNUMFMT " p_id=" BACKSQL_IDFMT " keyval=" BACKSQL_IDNUMFMT,
> -                       bi->sql_insentry_stmt, op->ora_e->e_name.bv_val,
> -                       oc->bom_id, BACKSQL_IDARG(bsi.bsi_base_id.eid_id),
> -                       new_keyval );
> -               Debug( LDAP_DEBUG_TRACE, "   backsql_add(): %s\n", buf);
> -       }
> +       Debug(LDAP_DEBUG_TRACE,
> +             "   backsql_add(): executing \"%s\" for dn=\"%s\"  oc_map_id=" 
> BACKSQL_IDNUMFMT " p_id=" BACKSQL_IDFMT " keyval=" BACKSQL_IDNUMFMT\n",
> +             bi->sql_insentry_stmt, op->ora_e->e_name.bv_val,
> +             oc->bom_id, BACKSQL_IDARG(bsi.bsi_base_id.eid_id),
> +             new_keyval);
>  
>         rc = SQLExecute( sth );
> 

-- 
Ondřej Kuzník
Senior Software Engineer
Symas Corporation                       http://www.symas.com
Packaged, certified, and supported LDAP solutions powered by OpenLDAP
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to