Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6820

prototype for SHOW_FUNC handler declared as return int but return value ignored?

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.0.14
    • Fix Version/s: 10.0
    • Component/s: None
    • Labels:

      Description

      Description:
      The mysql_show_var_func typedef for SHOW_FUNC callback handlers is
      declared as returning "int", but at the two places where it gets called
      in SHOW STATUS handling its return value is completely ignored.

      Also the documentation mentions that it should return int (by showing
      the typedef prototype) but doesn't mention what to return at all.

      How to repeat:
      Check ./include/mysql/plugin.h:

        typedef int (*mysql_show_var_func)(MYSQL_THD, struct
      st_mysql_show_var*, char *);
      
      vs. sql/sql_show.cc
      
        /*
        if var->type is SHOW_FUNC, call the function.
        Repeat as necessary, if new var is again SHOW_FUNC
        */
        SHOW_VAR tmp;
        for (; list->type == SHOW_FUNC; list= &tmp)
          ((mysql_show_var_func)(list->value))(thd, &tmp, value);
      

      and

        /*
          if var->type is SHOW_FUNC or SHOW_SIMPLE_FUNC, call the function.  
           
          Repeat as necessary, if new var is again one of the above
        */                                                                   
           
        for (var=variables; var->type == SHOW_FUNC ||                        
           
               var->type == SHOW_SIMPLE_FUNC; var= &tmp)                     
           
          ((mysql_show_var_func)(var->value))(thd, &tmp, buff);              
      

      Suggested fix:
      The return value was probably meant to signal errors?

      So implement actual error checking where mysql_show_var_func is called?

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              hholzgra Hartmut Holzgraefe added a comment -
              Show
              hholzgra Hartmut Holzgraefe added a comment - Also filed as http://bugs.mysql.com/74159

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  hholzgra Hartmut Holzgraefe
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated: