Bug #87676 mysql_tzinfo_to_sql cannot handle symlink loop
Submitted: 6 Sep 2017 7:58 Modified: 11 Sep 2017 7:26
Reporter: Roger Qiu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:mysql Ver 14.14 Distrib 5.7.19 OS:Any
Assigned to: CPU Architecture:Any
Tags: loop, mysql_tzinfo_to_sql, symlink

[6 Sep 2017 7:58] Roger Qiu
Description:
When running `mysql_tzinfo_to_sql` on the latest tzdatabase hosted on Linux distributions, it will fail to work and give warnings like: 

```
Warning: Unable to load '/etc/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/etc/zoneinfo/posix/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/etc/zoneinfo/posix/posix/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/etc/zoneinfo/posix/posix/posix/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/etc/zoneinfo/posix/posix/posix/posix/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/etc/zoneinfo/posix/posix/posix/posix/posix/iso3166.tab' as time zone. Skipping it.
ERROR 1406 (22001) at line 286226: Data too long for column 'Name' at row 1
```

This is because of the `posix` symlink that is now recursive.

This bug was reported on the mariadb database and was fixed in 2013. https://github.com/MariaDB/server/commit/f2cfcd91f56d81d40b1f5e2dbb5b643dc207bf53

Can we get this fixed, since this prevents the usage of `mysql_tzinfo_to_sql` on modern Linux distros.

How to repeat:
Just run a Mysql DB and try this:

mysql_tzinfo_to_sql "$TZDIR" | mysql --socket='./.mysql/mysql.sock' mysql

Suggested fix:
Same fix as was done on MariaDB: https://github.com/MariaDB/server/commit/f2cfcd91f56d81d40b1f5e2dbb5b643dc207bf53
[11 Sep 2017 7:26] Umesh Shastry
Hello Roger Qiu,

Thank you for the report and feedback!

Thanks,
Umesh