Hello,
Possibly a little bug in mysys/my_init.c:
MYSQL_FILE *mysql_stdin= NULL;
MYSQL_FILE *mysql_stdout= NULL;
MYSQL_FILE *mysql_stderr= NULL;
#ifdef HAVE_PSI_INTERFACE
static MYSQL_FILE instrumented_stdin;
static MYSQL_FILE instrumented_stdout;
static MYSQL_FILE instrumented_stderr;
#endif
...
#ifdef HAVE_PSI_INTERFACE
instrumented_stdin.m_file= stdin;
instrumented_stdin.m_psi= NULL; /* not yet instrumented */
instrumented_stdout.m_file= stdout;
instrumented_stdout.m_psi= NULL; /* not yet instrumented */
instrumented_stderr.m_file= stderr;
instrumented_stderr.m_psi= NULL; /* not yet instrumented */
mysql_stdin= & instrumented_stdin;
mysql_stdout= & instrumented_stdout;
mysql_stderr= & instrumented_stderr;
#else
mysql_stdin= stdin;
mysql_stdout= stdout;
mysql_stderr= stderr;
#endif
Assume HAVE_PSI_INTERFACE is not defined, then we have put in strin (a
FILE*) into mysql_stdin (a MYSQL_FILE*). This will cause mismatches
(maybe at compile time, surely at run time): for example, in
ma_recovery_util.c::eprint() which has this:
void eprint(MYSQL_FILE *trace_file __attribute__ ((unused)),
const char *format __attribute__ ((unused)), ...)
{
va_list args;
va_start(args, format);
DBUG_PRINT("error", ("%s", format));
if (!trace_file)
trace_file= mysql_stderr;
if (procent_printed)
{
/* In silent mode, print on another line than the 0% 10% 20% line */
procent_printed= 0;
mysql_file_fputc('\n', trace_file);
}
assume for example the "trace_file" argument is NULL, then it becomes
stderr, so we call mysql_file_fputc() on stderr, which calls
inline_mysql_file_fputc() on stderr, which does:
result= fputc(c, file->m_file);
so it will try to access stderr->m_file.
--
Mr. Guilhem Bichot <guilhem@stripped>
Sun Microsystems / MySQL, Lead Software Engineer
Bordeaux, France
www.sun.com / www.mysql.com