Bug #65629 DBD::mysql compilation error due to mismatched braces
Submitted: 15 Jun 2012 17:09 Modified: 15 Feb 2013 16:35
Reporter: Richard Smith Email Updates:
Status: Unsupported Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S3 (Non-critical)
Version:4.021 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution
Triage: Needs Triage: D2 (Serious)

[15 Jun 2012 17:09] Richard Smith
Description:
If the #ifdef on dbdimp.c:3448 doesn't evaluate to true, then the else statement and open brace on line 3461 is compiled out, but the close brace on line 3479 remains compiled in.

How to repeat:
See above

Suggested fix:
[root@sphinx DBD-mysql-4.021]# tar xfz ../DBD-mysql-4.021.tar.gz -O DBD-mysql-4.021/dbdimp.c | diff -u - dbdimp.c
--- -	2012-06-15 17:58:32.100389000 +0100
+++ dbdimp.c	2012-06-15 17:56:22.000000000 +0100
@@ -3458,8 +3458,9 @@
                                                   &imp_sth->has_been_bound
                                                  );
   }
-  else {
+  else 
 #endif
+  {
     imp_sth->row_num= mysql_st_internal_execute(
                                                 sth,
                                                 *statement,
[15 Jun 2012 17:51] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior with sources, downloaded from CPAN. Also I checked code and the curly brace is in place. Where did you download sources you have issues with?
[15 Jun 2012 18:01] Richard Smith
I downloaded it with:

richard@hourn:~$ wget -q http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.021.tar.gz
richard@hourn:~$ md5sum DBD-mysql-4.021.tar.gz 35653efca4bbe6e49ef31d237b4a50b7  DBD-mysql-4.021.tar.gz
richard@hourn:~$ tar xfz DBD-mysql-4.021.tar.gz DBD-mysql-4.021/dbdimp.c -O > dbdimp.c
richard@hourn:~$ md5sum dbdimp.c 
8d31acdaec04ea868ba7f9af8619e2fc  dbdimp.c

The offending lines are these two:

richard@hourn:~$ sed '3461{n;p};d' dbdimp.c 
  else {
#endif

The open brace needs to be *after* the #endif so that it can be closed on line 3479:

richard@hourn:~$ sed '3479p;d' dbdimp.c 
  }

The patch I gave previously fixes this.
[15 Jun 2012 18:44] Sveta Smirnova
Thank you for the feedback and additional explanation.

Verified as described.
[15 Feb 2013 16:35] Sveta Smirnova
Thank you for the report.

We don't work on DBD::mysql bugs anymore. All its bugs should go to CPAN: https://rt.cpan.org/Public/Dist/Display.html?Name=DBD-mysql

I re-submitted your report to https://rt.cpan.org/Public/Bug/Display.html?id=83347
Please subscribe to the new report on CPAN and work with DBD::mysql developers in case if they need additional details.