Bug #13717 sql_print_warning dumps unsilenceable warnings to STDERR under libmysqld
Submitted: 3 Oct 2005 17:17 Modified: 15 Dec 2006 17:33
Reporter: Philip Stoev
Status: Closed
Category:libmysqld Severity:S3 (Non-critical)
Version:4.14 OS:Linux (Linux)
Assigned to: Alexey Botchkov Target Version:
Tags: logging, stderr, libmysqld

[3 Oct 2005 17:17] Philip Stoev
Description:
Hello,

looking at the source (log.cc), sql_print_warning() calls vprint_msg_to_log() which calls
print_buffer_to_file() which uses fprintf() to print directly to stderr.

When using libmysqld, this results in unsilenceable warnings being printed over the output
of the program using libmysqld, which would be weird to the end user.

How to repeat:
run a libmysqld application without a mysql table and you will get a "[Warning] Can't open
and lock time zone table: Table 'mysql.time_zone_leap_second' doesn't exist trying to live
without them" message on stderr which can not be suppressed.

Suggested fix:
Provide an option to silence warnings when used under libmysqld.

In the long term, maybe provide those warnings in a stack from which the application can
pop and process them at will, the way SHOW WARNINGS sql command works.
[3 Oct 2005 21:44] Jorge del Conde
Thanks for your bug report
[6 Oct 2005 15:43] Philip Stoev
Moving this bug to the libmysqld category, where it belongs.
[1 Aug 2006 11:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/9881

ChangeSet@1.2532, 2006-08-01 15:18:21+05:00, holyfoot@mysql.com +1 -0
  bug #13717 embedded library dumps warnings on STDERR directly
  
  Here i just disabled STDERR warnings in embedded server
  Later we should get more defined about logs in the embedded server
[7 Aug 2006 9:32] Alexander Barkov
The patch looks ok.

Please consider adding a worklog item to make
embedded server honor --log-error.
[19 Aug 2006 0:49] Jim Winstead
Patch looks okay to push to me.
[30 Aug 2006 15:08] Reggie Burnett
pushed to 5.0.25 main this morning.  not  yet in 5.1 tree
[12 Sep 2006 16:27] Reggie Burnett
now pushed to 5.1.12
[13 Sep 2006 4:41] Paul DuBois
Noted in 4.1.22, 5.0.25, 5.1.12 changelogs.

libmysqld produced some warnings to stderr which could not be
silenced. These warnings now are suppressed.
[15 Dec 2006 17:33] Philip Stoev
Unfortunately it appears that the patch blocks legitimate error messages, not just
warnings. Please see:

http://bugs.mysql.com/bug.php?id=25097