Bug #68393 "version" field used in Handshake packet definition not defined.
Submitted: 15 Feb 2013 17:14 Modified: 19 Dec 2013 11:48
Reporter: Roland Bouman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Jan Kneschke CPU Architecture:Any

[15 Feb 2013 17:14] Roland Bouman
Description:
Documentation for the "Initial Handshake Packet - protocol version 10" (see: http://dev.mysql.com/doc/internals/en/connection-phase.html#packet-Protocol::Handshake)

reads:

"
Payload
1              [0a] protocol version
string[NUL]    server version
4              connection id
string[8]      auth-plugin-data-part-1
1              [00] filler
2              capability flags (lower 2 bytes)
  if more data in the packet:
1              character set
2              status flags
2              capability flags (upper 2 bytes)
  if capabilities & CLIENT_PLUGIN_AUTH {
1              length of auth-plugin-data
  } else {
1              [00]
  }
string[10]     reserved (all [00])
  if capabilities & CLIENT_SECURE_CONNECTION {
string[$len]   auth-plugin-data-part-2 ($len=MAX(13, length of auth-plugin-data - 8))
  if capabilities & CLIENT_PLUGIN_AUTH {
    if version >= (5.5.7 and < 5.5.10) or (>= 5.6.0 and < 5.6.2) {
string[EOF]    auth-plugin name
    } elseif version >= 5.5.10 or >= 5.6.2 {
string[NUL]    auth-plugin name
    }
  }
"

Clearly defined are "protocol version" and "server version". But the "version" used in the conditional block "if capabilities & CLIENT_PLUGIN_AUTH" is never defined. 

From the pseudo code it appears to be the version number part which I assume is part of the previously defined "server version" field. However, there are 2 problems:

- it is never explained how to parse the version number from the "server version" string
- the "version" is used in a number of comparisons with version literals. But there is never a rule given that explains exactly how this comparison should be implemented. I can guess, but it really should be described.

How to repeat:
see doc

Suggested fix:
please document omissions mentioned above.
[15 Feb 2013 17:34] Sveta Smirnova
Thank you for the report.

Verified as described.
[15 Feb 2013 18:35] Roland Bouman
from what I can tell now, the "version" is actually the same as the "server version". So at least there is no definition lacking, it's just that the wrong name is used.
[19 Dec 2013 11:48] Jan Kneschke
http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::Hands... has been simplified by removing the (server)-version specific
"if".

The missing \0 is still noted in the "note" as a server-version specific bug.