Bug #39598 Valgrind warnings in backup_functions and backup_procedures
Submitted: 23 Sep 2008 11:09 Modified: 30 Oct 2008 19:36
Reporter: Sven Sandberg Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S2 (Serious)
Version:6.0-rpl OS:Any
Assigned to: Chuck Bell CPU Architecture:Any
Tags: Backup, pushbuild, test failure, valgrind

[23 Sep 2008 11:09] Sven Sandberg
Description:
pushbuild failure:

backup.backup_functions 'falcon'         [ fail ]  Found warnings in server log file!
@log_error
/dev/shm/var-n_mix-120/4/mysqld.1/mysqld.err
log_error
==13227==    at 0xCA98BB: backup::Output_stream::open() (sql_string.h:98)
==13227==    at 0xCA96AC: backup::Stream::open() (sql_string.h:98)
^ Found warnings!!

 - saving '/dev/shm/var-n_mix-120/4/log/backup.backup_functions-falcon/' to '/dev/shm/var-n_mix-120/log/backup.backup_functions-falcon/'

Retrying test, attempt(2/3)...

How to repeat:
https://intranet.mysql.com/secure/pushbuild/showpush.pl?dir=bzr_mysql-6.0-rpl&order=76 'pb-valgrind-*' Valgrind/n_mix
[24 Sep 2008 14:06] Chuck Bell
http://lists.mysql.com/commits/54491
[24 Sep 2008 14:15] 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/54491

2696 Chuck Bell	2008-09-24
      BUG#39598 Valgrind warnings in backup_functions and backup_procedures 
      
      Valgrind warning caused by incorrect setting of str_length for m_path.
[29 Sep 2008 18:30] Sven Sandberg
There are several bugs in Stream::prepare_path in sql/backup/stream.cc:
 - fn_format will expand ~ to $HOME in case 2, around line 328, but no space is
allocated for that expansion.
 - path_len is set to one too much, which is harmless when allocating the string but will make the string look too long after calling m_path.length(path_len), which will result in subsequent calls to c_str() reading outside allocated memory.

In any case, I think we can get rid of Stream::prepare_path and Steam::make_relative_path, since fn_format has all the functionality (and some more). Just call:

  char buf[FN_REFLEN];
  fn_format(buf, orig_loc.c_ptr(), backupdir, "",
            MY_UNPACK_FILENAME | MY_RELATIVE_PATH);
[30 Sep 2008 15:30] 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/54790

2697 Chuck Bell	2008-09-30
      BUG#39598 Valgrind warnings in backup_functions and backup_procedures 
      
      Patch refactors prepare_path() method in stream class to use 
      standard server methods instead of processing paths manually.
[1 Oct 2008 19:02] 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/54985

2697 Chuck Bell	2008-10-01
      BUG#39598 Valgrind warnings in backup_functions and backup_procedures 
      
      Patch refactors prepare_path() method in stream class to use 
      standard server methods instead of processing paths manually.
[2 Oct 2008 8:30] Jørgen Løland
Good to push.
[2 Oct 2008 13:22] 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/55076

2697 Chuck Bell	2008-10-01
      BUG#39598 Valgrind warnings in backup_functions and backup_procedures 
      
      Patch refactors prepare_path() method in stream class to use 
      standard server methods instead of processing paths manually.
[2 Oct 2008 15:24] 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/55106

2700 Chuck Bell	2008-10-02
      BUG#39598 Valgrind warnings in backup_functions and backup_procedures 
      
      Patch refactors prepare_path() method in stream class to use 
      standard server methods instead of processing paths manually.
[14 Oct 2008 20:46] 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/56214

2710 Chuck Bell	2008-10-14
      BUG#39598 Valgrind warnings in backup_functions and backup_procedures 
      
      Patch refactors prepare_path() method in stream class to use 
      standard server methods instead of processing paths manually.
[15 Oct 2008 18:07] 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/56288

2710 Chuck Bell	2008-10-15
      BUG#39598 Valgrind warnings in backup_functions and backup_procedures 
      
      Patch refactors prepare_path() method in stream class to use 
      standard server methods instead of processing paths manually.
[30 Oct 2008 12:45] Bugs System
Pushed into 6.0.8-alpha  (revid:cbell@mysql.com-20081015180714-6sgpn41mkmkvccch) (version source revid:cbell@mysql.com-20081015180714-6sgpn41mkmkvccch) (pib:5)
[30 Oct 2008 19:36] Paul DuBois
Noted in 6.0.8 changelog.

Some MySQL Backup-related memory-use warnings detected by Valgrind
were corrected.
[30 Jan 2009 13:32] Bugs System
Pushed into 6.0.10-alpha (revid:luis.soares@sun.com-20090129165607-wiskabxm948yx463) (version source revid:luis.soares@sun.com-20090129163120-e2ntks4wgpqde6zt) (merge vers: 6.0.10-alpha) (pib:6)