Bash process substitution for --defaults-file and --defaults-extra-file args doesn't work anymore

Description

Hello,

With xtrabackup 2.4, bash process substitution was working. It doesn't work anymore with the versions 8.0 and 8.4.

To reproduce the problem:

function mysql_config { cat <<EOT [client] user=${DB_USER} password=${DB_PASSWORD} host=localhost socket=$(grep socket /etc/my.cnf | head -n 1 | cut -d'=' -f2) EOT } xtrabackup --defaults-file=<(mysql_config) --backup --target-dir /tmp/mysql_backup

Results:

With mysql 5.7 / xtrabackup 2.4.4:

$ xtrabackup --defaults-file=<(mysql_config) --backup --target-dir /tmp/mysql_backup 250306 09:22:18 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;host=localhost;mysql_socket=/var/lib/mysql/mysql.sock' as 'backupuser' (using password: YES). 250306 09:22:18 version_check Connected to MySQL server 250306 09:22:18 version_check Executing a version check against the server... 250306 09:22:18 version_check Done. 250306 09:22:18 Connecting to MySQL server host: localhost, user: backupuser, password: set, port: 0, socket: /var/lib/mysql/mysql.sock Using server version 5.7.42-log xtrabackup version 2.4.4 based on MySQL server 5.7.13 Linux (x86_64) (revision id: df58cf2) (...) 250306 09:22:20 completed OK!

With mysql 8.0 / xtrabackup 8.0.35-32:

$ xtrabackup --defaults-file=<(mysql_config) --backup --target-dir /tmp/mysql_backup 2025-03-06T09:43:15.112688-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --backup=1 --target-dir=/tmp/mysql_backup xtrabackup version 8.0.35-32 based on MySQL server 8.0.35 Linux (x86_64) (revision id: c339924a) 250306 09:43:15 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' (using password: NO). Failed to connect to MySQL server: DBI connect(';mysql_read_default_group=xtrabackup','',...) failed: Access denied for user 'xxxxx'@'localhost' (using password: NO) at - line 1536. 2025-03-06T09:43:15.242242-00:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: not set, password: not set, port: not set, socket: not set 2025-03-06T09:43:15.242874-00:00 0 [ERROR] [MY-011825] [Xtrabackup] Failed to connect to MySQL server: Access denied for user 'xxxxx'@'localhost' (using password: NO)

With mysql 8.4 / xtrabackup 8.4.0-2:

$ xtrabackup --defaults-file=<(mysql_config) --backup --target-dir /tmp/mysql_backup 2025-03-06T09:53:44.234748-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --backup=1 --target-dir=/tmp/mysql_backup xtrabackup version 8.4.0-2 based on MySQL server 8.4.0 Linux (x86_64) (revision id: d4373834) 250306 09:53:44 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' (using password: NO). Failed to connect to MySQL server: DBI connect(';mysql_read_default_group=xtrabackup','',...) failed: Access denied for user 'xxxxx'@'localhost' (using password: NO) at - line 1536. 2025-03-06T09:53:44.364475-00:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: not set, password: not set, port: not set, socket: not set 2025-03-06T09:53:44.369554-00:00 0 [ERROR] [MY-011825] [Xtrabackup] Failed to connect to MySQL server: Access denied for user 'xxxxx'@'localhost' (using password: NO)

Environment

Tested on Ubuntu 22.04.

Activity

Show:

Jean-Luc Derrien March 10, 2025 at 2:20 PM

Hello ,

Sure, in fact I already use this workaround.

Thank you for the explaination. 👍

Satya Bodapati March 10, 2025 at 10:31 AM

Hello, this is because of the extra validation of parameters. In 8.0, the defaults file passed is opened and closed twice.
So after the first opening and close, incase of the file descriptor, the first close() makes the descriptor unavailable for the second read.

Can you please workaround the issue by redirecting to a temporary file and pass it to xtrabackup?

Details

Assignee

Reporter

Regression Issue

Yes

Needs QA

Yes

Priority

Smart Checklist

Created March 6, 2025 at 10:57 AM
Updated March 10, 2025 at 2:20 PM

Flag notifications