Recent pgloader v3 builds fail on Ubuntu when /etc/mysql/my.cnf contains the standard MySQL !includedir directives.
The error is:
KABOOM!
MISSING-SECTION-HEADER-ERROR: Missing section header; found ! instead. at line 32
An unhandled error condition has been signalled:
Missing section header; found ! instead. at line 32
This happens before the actual migration starts.
Environment
- Ubuntu 24.04
- MySQL 8.4
- PostgreSQL 16
- pgloader built from source:
pgloader version "3.6.ea152ef"
compiled with SBCL 2.2.9.debian
/etc/mysql/my.cnf
The standard Ubuntu MySQL configuration contains:
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
In my case:
32 #
33 !includedir /etc/mysql/conf.d/
34 !includedir /etc/mysql/mysql.conf.d/
The reported line number corresponds to this area of /etc/mysql/my.cnf, not to the pgloader command file.
Reproduction
With a normal pgloader command file:
/usr/src/pgloader/build/bin/pgloader /root/migration.load
pgloader immediately exits with:
MISSING-SECTION-HEADER-ERROR: Missing section header; found ! instead. at line 32
There is no ! character anywhere in migration.load:
grep -n '!' /root/migration.load
returns no results.
Changing HOME does not help:
HOME=/root/pgloader-home \
/usr/src/pgloader/build/bin/pgloader /root/migration.load
produces the same error.
Expected behavior
pgloader should either:
- support MySQL's
!include / !includedir syntax when parsing /etc/mysql/my.cnf, or
- ignore those directives, or
- avoid parsing system-wide MySQL configuration files when all connection parameters are already supplied explicitly in the pgloader connection URI.
Why this is important
!includedir is part of the standard /etc/mysql/my.cnf shipped on Ubuntu/Debian installations, so automatically parsing this file with a generic INI parser makes current pgloader builds fail on a very common MySQL setup.
Older pgloader builds / the Mattermost pgloader Docker image do not exhibit this particular parsing error.
This appears to be related to the recently added automatic .my.cnf / /etc/mysql/my.cnf parsing in the v3 code path.
A simple fix may be to skip lines starting with !, similarly to how MySQL-specific include directives are handled elsewhere, or to implement support for !include and !includedir.
Recent pgloader v3 builds fail on Ubuntu when
/etc/mysql/my.cnfcontains the standard MySQL!includedirdirectives.The error is:
This happens before the actual migration starts.
Environment
/etc/mysql/my.cnfThe standard Ubuntu MySQL configuration contains:
In my case:
The reported line number corresponds to this area of
/etc/mysql/my.cnf, not to the pgloader command file.Reproduction
With a normal pgloader command file:
pgloader immediately exits with:
There is no
!character anywhere inmigration.load:grep -n '!' /root/migration.loadreturns no results.
Changing
HOMEdoes not help:produces the same error.
Expected behavior
pgloader should either:
!include/!includedirsyntax when parsing/etc/mysql/my.cnf, orWhy this is important
!includediris part of the standard/etc/mysql/my.cnfshipped on Ubuntu/Debian installations, so automatically parsing this file with a generic INI parser makes current pgloader builds fail on a very common MySQL setup.Older pgloader builds / the Mattermost pgloader Docker image do not exhibit this particular parsing error.
This appears to be related to the recently added automatic
.my.cnf//etc/mysql/my.cnfparsing in the v3 code path.A simple fix may be to skip lines starting with
!, similarly to how MySQL-specific include directives are handled elsewhere, or to implement support for!includeand!includedir.