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?

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.0.14
    • None
    • None

    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?

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.