Bug #34901 Compiler warning for backup stream library
Submitted: 27 Feb 2008 19:28 Modified: 17 Mar 2008 19:02
Reporter: Chuck Bell Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S4 (Feature request)
Version:6.0.5 OS:Any
Assigned to: Chuck Bell CPU Architecture:Any

[27 Feb 2008 19:28] Chuck Bell
Description:
The gcc compile identifies line 931 in stream_v1.c as having a variable that may be uninitialized.

sql/backup/stream_v1.c: 931
	'ret' may be used uninitialized in this function

An investigation shows that this is true and furthermore the variable is returned from the function without any value assigned. This may lead to problems.

How to repeat:
Compile with gcc like sapsrv2 community -- see mysql-6.0-falcon tree (it does not show in the backup tree).

Suggested fix:
A cursory, minimal patch could be:

===== stream_v1.c 1.6 vs edited =====
--- 1.6/sql/backup/stream_v1.c  2008-02-13 06:40:24 -05:00
+++ edited/stream_v1.c  2008-02-27 14:15:14 -05:00
@@ -928,7 +928,7 @@
 {
   void *iter;
   struct st_bstream_dbitem_info *item;
-  int ret;
+  int ret= 0;
   bool catalogue_empty= TRUE;

   iter= bcat_db_iterator_get(cat, db_info);

...but this should be investigated further to ensure the proper default value is assigned to the variable.
[27 Feb 2008 20:18] Chuck Bell
Talked with Rafal. We have a solution that is correct.
[27 Feb 2008 21:11] 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/43112

ChangeSet@1.2581, 2008-02-27 22:10:43+01:00, hakank@lu0011.(none) +1 -0
  Fix of cbell
  
      BUG#34901 : Compiler warning for backup stream library 
      
      Set the default return code for the bstream_wr_db_catalog() method
      to return BSTREAM_OK.
[12 Mar 2008 23:02] Bugs System
Pushed into 6.0.4-alpha
[17 Mar 2008 19:02] Paul DuBois
No changelog entry needed. Bug did not appear in any released version.
[15 Apr 2008 17:58] Bugs System
Pushed into 6.0.5-alpha