Bug #57843 Longer version string is truncated when parsed from configure.in by cmake
Submitted: 29 Oct 2010 12:06 Modified: 24 Nov 2010 10:51
Reporter: Magnus Blåudd Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.5.7-rc OS:Any
Assigned to: Magnus Blåudd CPU Architecture:Any
Tags: SEAGULL

[29 Oct 2010 12:06] Magnus Blåudd
Description:
The original location for MySQL's version string is currently stored in configure.in and is extracted from there and used throughout the build system as VERSION_STRING or VERSION.

The parsing mechanism works fine when the version string is short and follows a simple pattern "X.X.X-<status>" for example 5.5.7-rc, in this case VERSION=5.5.7-rc

But when modifying configure.in to give the package a different version string that for example include the version of bundled components the string is truncated. For example changing configure.in to "5.5.5-ndb-7.0.20-alpha" will lead to VERSION set to "5.5.5-ndb" whild it shoul have been VERSION=5.5.5-ndb-7.0.20-alpha

How to repeat:
Modify the AC_INIT(..., [5.5.7-rc], ..) to AC_INIT(..., [5.5.7-longer-string-with-dots.and.dashes]

Then add a printout of VERSION_STRING after the VERSION_STRING has been parsed int cmake/mysql_version-cmake
+  MESSAGE(STATUS "VERSION_STRING=${VERSION_STRING}") 

Notice how the version string now says 5.5.7-longer while it should contain the full string given up until the ending ]

Suggested fix:
For example:
=== modified file 'cmake/mysql_version.cmake'
--- cmake/mysql_version.cmake	2010-06-18 15:04:15 +0000
+++ cmake/mysql_version.cmake	2010-10-29 09:26:18 +0000
@@ -41,12 +41,12 @@ MACRO(GET_MYSQL_VERSION)
         STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
         IF(NOT VERSION_STRING)
           FILE(STRINGS  configure.in  str REGEX "AC_INIT\\(")
-          STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][a-zAZ0-9]+" VERSION_STRING "${str}")
+          STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][-.a-zAZ0-9]+" VERSION_STRING "${str}")
         ENDIF()
       ENDIF()
     ENDIF()
   ENDIF()
-
+  MESSAGE(STATUS "VERSION_STRING=${VERSION_STRING}") 
   
   IF(NOT VERSION_STRING)
     MESSAGE(FATAL_ERROR
[29 Oct 2010 12:16] Magnus Blåudd
To clarify, the cmake variable VERSION should include the full string from AC_INIT in configure.in after macro GET_MYSQL_VERSION has been called.
[5 Nov 2010 13:00] Bernd Ocklin
Configure.in will also be deprecated following David's mail to packagers@lists.mysql.com.

I have no idea how it will be replaced though.
[5 Nov 2010 13:17] Davi Arnaut
It's explained in the worklog. In a nutshell, a file with the specific components of the version number.
[10 Nov 2010 11:13] Gustaf Thorslund
Verified as described, even if this might not be right road anyway.
[24 Nov 2010 10:51] Magnus Blåudd
Fixed by WL#5665 which removed configure.in and subsequently also the code that extract the version from that file.