Bug #79594 Small bug in INET6_NTOA() function
Submitted: 10 Dec 2015 14:19 Modified: 10 Dec 2015 18:38
Reporter: Marco Davids Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.6/5.7 OS:Ubuntu
Assigned to: CPU Architecture:Any

[10 Dec 2015 14:19] Marco Davids
Description:
The INET6_NTOA() function violated RFC5952, section 4.2.2:

   The symbol "::" MUST NOT be used to shorten just one 16-bit 0 field.
   For example, the representation 2001:db8:0:1:1:1:1:1 is correct, but
   2001:db8::1:1:1:1:1 is not correct.

https://tools.ietf.org/html/rfc5952

How to repeat:
mysql> select inet6_ntoa(inet6_aton('2001:db8:0:1:1:1:1:1')) as test;
+---------------------+
| test                |
+---------------------+
| 2001:db8::1:1:1:1:1 |
+---------------------+
1 row in set (0.00 sec)

The result should be:

2001:db8:0:1:1:1:1:1, so a ':0:', instead of a '::'.

Suggested fix:
Implement section 4.2.2 of RFC5952 without breaking things elsewhere.
[10 Dec 2015 18:38] Miguel Solorzano
Thank you for the bug report.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.29 Source distribution PULL: 2015-DEC-05

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql 5.6 > select inet6_ntoa(inet6_aton('2001:db8:0:1:1:1:1:1')) as test;
+---------------------+
| test                |
+---------------------+
| 2001:db8::1:1:1:1:1 |
+---------------------+
1 row in set (0.00 sec)

mysql 5.6 > exit
Bye

c:\dbs>57

c:\dbs>c:\dbs\5.7\bin\mysql -uroot -p --port=3570 --prompt="mysql 5.7 > "
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.11 Source distribution PULL: 2015-DEC-05

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql 5.7 > select inet6_ntoa(inet6_aton('2001:db8:0:1:1:1:1:1')) as test;
+---------------------+
| test                |
+---------------------+
| 2001:db8::1:1:1:1:1 |
+---------------------+
1 row in set (0.00 sec)
[11 Dec 2015 10:15] Guilhem Bichot
Looks like we match all other requirements of section 4. Only 4.2.2 is not matched.