Bug #38624 Two si_objects.cc functions return 'success' error code when error occurs
Submitted: 7 Aug 2008 10:16 Modified: 10 Sep 2008 21:56
Reporter: Jorgen Loland
Status: Closed
Category:Server: Backup Severity:S3 (Non-critical)
Version:6.0-backup OS:Any
Assigned to: Jorgen Loland Target Version:6.0-beta
Triage: D3 (Medium)

[7 Aug 2008 10:16] Jorgen Loland
Description:
Code inspection of si_objects.cc revealed that si_objects.cc returns with error code
'success' (FALSE) in two cases where a code 'error' (TRUE) should have been returned:

@ 1610:
-------
  if (check_db_dir_existence(m_db_name.c_ptr()))
  {
    my_error(ER_BAD_DB_ERROR, MYF(0), m_db_name.c_ptr());
    DBUG_RETURN(FALSE);
  }
-------
Here, DatabaseObj::do_serialize returns 'success' if the database is not found.

@ 1942:
-------
  if (open_tables(thd, &lst, &num_tables, 0))
    DBUG_RETURN(FALSE);
-------
Here, TriggerObj::do_serialize returns 'success' if the table the trigger is associated
with cannot be opened.

How to repeat:
This is a pure code-inspection finding. I cannot provoke a backup error or server crash
for any of these because:

@1610: backup will not reach this code if the database is not found
@1942: if a table is dropped, associated triggers are also removed. Hence I cannot think
of any way to make a trigger rely on a table that cannot be opened.

Suggested fix:
Return correct error codes, i.e return TRUE instead of FALSE in both cases.
[7 Aug 2008 11:05] 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/51079

2676 Jorgen Loland	2008-08-07
      Bug#38624 - Two si_objects.cc functions return 'success' 
      error code when error occurs.
      
      Pre-fix:
      1. DatabaseObj::do_serialize returns 'success' if 
      check_db_dir_existence returns 'error'
      2. TriggerObj::do_serialize returns 'success' if the table the trigger is associated
      with cannot be opened.
      
      Fix:
      1. Return TRUE ('error') if check_db_dir_existence fails
      2. Return TRUE ('error') if open_table fails
[8 Aug 2008 14:50] 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/51187

2676 Jorgen Loland	2008-08-08
      Bug#38624 - Two si_objects.cc functions return 'success' 
      error code when error occurs.
            
      Pre-fix:
      1. DatabaseObj::do_serialize returns 'success' if 
      check_db_dir_existence returns 'error'
      2. TriggerObj::do_serialize returns 'success' if the table the trigger is associated
      with cannot be opened.
            
      Fix:
      1. Return TRUE ('error') if check_db_dir_existence fails
      2. Return TRUE ('error') if open_table fails
[11 Aug 2008 16:00] Chuck Bell
Patch approved.
[21 Aug 2008 10:42] Oystein Grovlen
Patch approved.
[21 Aug 2008 13:33] 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/52199

2679 Jorgen Loland	2008-08-21
      Bug#38624 - Two si_objects.cc functions return 'success' 
      error code when error occurs.
            
      Pre-fix:
      1. DatabaseObj::do_serialize returns 'success' if 
      check_db_dir_existence returns 'error'
      2. TriggerObj::do_serialize returns 'success' if the table the
      trigger is associated with cannot be opened.
            
      Fix:
      1. Return TRUE ('error') if check_db_dir_existence fails
      2. Return TRUE ('error') if open_table fails
[21 Aug 2008 13:33] 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/52200

2679 Jorgen Loland	2008-08-21
      Bug#38624 - Two si_objects.cc functions return 'success' 
      error code when error occurs.
            
      Pre-fix:
      1. DatabaseObj::do_serialize returns 'success' if 
      check_db_dir_existence returns 'error'
      2. TriggerObj::do_serialize returns 'success' if the table the
      trigger is associated with cannot be opened.
            
      Fix:
      1. Return TRUE ('error') if check_db_dir_existence fails
      2. Return TRUE ('error') if open_table fails
[10 Sep 2008 15:20] Oystein Grovlen
Pushed to 6.0.7
[10 Sep 2008 17:32] Bugs System
Pushed into 6.0.7-alpha  (revid:jorgen.loland@sun.com-20080821113609-2qrojmjtup9ekk7l)
(version source revid:oystein.grovlen@sun.com-20080904134604-nhao14jzxng85wsr) (pib:3)
[10 Sep 2008 21:56] Paul DuBois
No user-visible effects. No changelog entry needed.
[12 Sep 2008 0:38] 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/53891

2693 He Zhenxing	2008-09-12 [merge]
      Merge 6.0 main -> 6.0-rpl
[13 Sep 2008 21:51] Bugs System
Pushed into 6.0.6-alpha  (revid:jorgen.loland@sun.com-20080821113609-2qrojmjtup9ekk7l)
(version source revid:sergefp@mysql.com-20080611231653-nmuqmw6dedjra79i) (pib:3)
[23 Sep 2008 13:13] 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/54481

2694 He Zhenxing	2008-09-22 [merge]
      Auto Merge