Bug #115152 [Server] SQL_MODE 'PAD_CHAR_TO_FULL_LENGTH' DISABLED RUNTIME LOADABLE FUNCTIONS
Submitted: 29 May 2024 2:55 Modified: 7 Jun 2024 12:17
Reporter: Bob Zhang Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any (not relevant)
Tags: shared libraries, sql mode, User-Defined Functions

[29 May 2024 2:55] Bob Zhang
Description:
MySQL version:
Any version since sql_mode 'PAD_CHAR_TO_FULL_LENGTH' has been introduced, my test version is 5.7.44, but lower version 's still okay.

Function is not usable if sql_mode 'PAD_CHAR_TO_FULL_LENGTH' is set, 
and some corresponding error message indicate that the sql_mode which pads space to runtime library path string make the paths can't be opened.

How to repeat:
1. CREATE FUNCTION lookup RETURNS string SONAME 'udf_example.so';

2. mysql> select * from mysql.func;
+--------+-----+----------------+----------+
| name   | ret | dl             | type     |
+--------+-----+----------------+----------+
| lookup |   0 | udf_example.so | function |
+--------+-----+----------------+----------+

mysql> select @@sql_mode;
+------------+
| @@sql_mode |
+------------+
|            |
+------------+

3. SHUTDOWN server and SET sql_mode = 'PAD_CHAR_TO_FULL_LENGTH' in my.cnf;

4. RESTART server and CHECK error log, 
`2024-05-29T02:32:44.792190Z 0 [ERROR] Can't open shared library 'udf_example.so                                                                                                                  ' (errno: 2 ${mysql_basedir}lib/plugin/udf_example.so                                                                     )`

FUNCTION is not usable since then, until you have got it reloaded.

Suggested fix:
This sql_mode shouldn't apply to columns that store real path, 
cause it changes the file paths.
[7 Jun 2024 12:17] MySQL Verification Team
Hello Bob Zhang,

Thank you for the bug report.
Please note that as per Oracle's Lifetime Support policy, MySQL 5.7 is covered under Oracle Sustaining Support.
For more info, please see https://www.mysql.com/support/eol-notice.html

Regards,
Ashwini Patil