Bug #117391 Contribution: protocol_classic: clarify param type and flag
Submitted: 5 Feb 15:21 Modified: 5 Feb 15:43
Reporter: OCA Admin (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:9.2.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[5 Feb 15:21] OCA Admin
Description:
This bug tracks a contribution by Daniël van Eeden (Github user: dveeden), as described in http://github.com/mysql/mysql-server/pull/595

How to repeat:
See description

Suggested fix:
See contribution code attached
[5 Feb 15:21] OCA Admin
Contribution submitted via Github - protocol_classic: clarify param type and flag 
(*) Contribution by Daniël van Eeden (Github dveeden, mysql-server/pull/595#issuecomment-2634237916): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_2314840524.txt (text/plain), 2.09 KiB.

[5 Feb 15:43] MySQL Verification Team
Hello Daniël,

Thank you for the report and contribution.

regards,
Umesh
[7 Feb 13:02] Georgi Kodinov
That's not how we treat field type in the code. 
It's read as 2 bytes and the MSB is filtered off. The rest is used as a type.
So, when it overflows to two bytes, we'd still support it in the protocol. 

I'd keep the current 2 bytes field, but mention the flag.
[7 Feb 13:57] Daniël van Eeden
I assume you meant to say "...when the type overflows one byte..."? This is when the type spills over into the second byte (where the unsigned flag is using 1 bit).

Would the following be correct?

----------------------------------------------------------
#!/bin/python
type_and_flag = 0xfe80

print(f"Type and Flag (bits) = {type_and_flag:16b}")

print("\nType mask            = 1111111100000000")
print(f"Type                 = {type_and_flag & 0b1111111100000000:016b}")

print("\nFlag mask            = 0000000011111111")
print(f"Flag                 = {type_and_flag & 0b0000000011111111:016b}")

print("\nType mask            = 1111111101111111")
print(f"Type (Corrected)     = {type_and_flag & 0b1111111101111111:016b}")

print("\nFlag mask            = 0000000010000000")
print(f"Flag (Corrected)     = {type_and_flag & 0b0000000010000000:016b}")
----------------------------------------------------------

----------------------------------------------------------
Type and Flag (bits) = 1111111010000000

Type mask            = 1111111100000000
Type                 = 1111111000000000

Flag mask            = 0000000011111111
Flag                 = 0000000010000000

Type mask            = 1111111101111111
Type (Corrected)     = 1111111000000000

Flag mask            = 0000000010000000
Flag (Corrected)     = 0000000010000000
----------------------------------------------------------