Skip to content

pgloader fails parsing standard Ubuntu /etc/mysql/my.cnf containing !includedir #1770

Description

@kgkg

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:

  1. support MySQL's !include / !includedir syntax when parsing /etc/mysql/my.cnf, or
  2. ignore those directives, or
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions