Escaping logic in pg_dump_command option breaks on spaces #822

Closed
opened 2024-01-30 19:03:05 +00:00 by witten · 2 comments
Owner

What I'm trying to do and why

Broken off from #810 discussion:

When using a command in the pg_dump_command option that contains spaces, the new escaping logic added as part of #810 causes an invalid command to be executed.

Steps to reproduce

Configure an option value for pg_dump_command similar to the example:

pg_dump_command: podman exec postgresql pg_dumpall

Then run a create action.

Actual behavior

Jan 29 20:57:12 compendium borgmatic[98093]: INFO borgbase-databases: Creating archive
Jan 29 20:57:12 compendium borgmatic[98093]: INFO ssh://<snip>.repo.borgbase.com/./repo: Dumping PostgreSQL databases
Jan 29 20:57:14 compendium borgmatic[98093]: INFO Creating archive at "ssh://<snip>.repo.borgbase.com/./repo::compendium-2024-01-29T20:57:12.842636"
Jan 29 20:57:14 compendium borgmatic[98093]: INFO Remote: Storage quota: 87.63 MB out of 10.00 GB used.
Jan 29 20:57:14 compendium borgmatic[98093]: INFO Remote: Storage quota: 87.63 MB out of 10.00 GB used.
Jan 29 20:57:15 compendium borgmatic[98093]: ERROR /bin/sh: line 1: podman exec postgresql pg_dumpall: command not found
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL borgbase-databases: Error running actions for repository
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL Command ''podman exec postgresql pg_dumpall' --no-password --clean --if-exists --username postgres > /root/.borgmatic/postgresql_databases/localhost/all' returned non-zero exit status 127.
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL /etc/borgmatic.d/databases.yaml: An error occurred
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL summary:
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL /etc/borgmatic.d/databases.yaml: An error occurred
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL borgbase-databases: Error running actions for repository
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL /bin/sh: line 1: podman exec postgresql pg_dumpall: command not found
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL Command ''podman exec postgresql pg_dumpall' --no-password --clean --if-exists --username postgres > /root/.borgmatic/postgresql_databases/localhost/all' returned non-zero exit status 127.
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL
Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL Need some help? https://torsion.org/borgmatic/#issues

Expected behavior

The pg_dump_command runs without error.

Other notes / implementation ideas

Probably a good idea to audit other database command options for similar breakage.

borgmatic version

1.8.7

borgmatic installation method

No response

Borg version

No response

Python version

No response

Database version (if applicable)

No response

Operating system and version

No response

### What I'm trying to do and why Broken off from #810 discussion: When using a command in the `pg_dump_command` option that contains spaces, the new escaping logic added as part of #810 causes an invalid command to be executed. ### Steps to reproduce Configure an option value for `pg_dump_command` similar to the example: ```yaml pg_dump_command: podman exec postgresql pg_dumpall ``` Then run a `create` action. ### Actual behavior ``` Jan 29 20:57:12 compendium borgmatic[98093]: INFO borgbase-databases: Creating archive Jan 29 20:57:12 compendium borgmatic[98093]: INFO ssh://<snip>.repo.borgbase.com/./repo: Dumping PostgreSQL databases Jan 29 20:57:14 compendium borgmatic[98093]: INFO Creating archive at "ssh://<snip>.repo.borgbase.com/./repo::compendium-2024-01-29T20:57:12.842636" Jan 29 20:57:14 compendium borgmatic[98093]: INFO Remote: Storage quota: 87.63 MB out of 10.00 GB used. Jan 29 20:57:14 compendium borgmatic[98093]: INFO Remote: Storage quota: 87.63 MB out of 10.00 GB used. Jan 29 20:57:15 compendium borgmatic[98093]: ERROR /bin/sh: line 1: podman exec postgresql pg_dumpall: command not found Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL borgbase-databases: Error running actions for repository Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL Command ''podman exec postgresql pg_dumpall' --no-password --clean --if-exists --username postgres > /root/.borgmatic/postgresql_databases/localhost/all' returned non-zero exit status 127. Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL /etc/borgmatic.d/databases.yaml: An error occurred Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL summary: Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL /etc/borgmatic.d/databases.yaml: An error occurred Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL borgbase-databases: Error running actions for repository Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL /bin/sh: line 1: podman exec postgresql pg_dumpall: command not found Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL Command ''podman exec postgresql pg_dumpall' --no-password --clean --if-exists --username postgres > /root/.borgmatic/postgresql_databases/localhost/all' returned non-zero exit status 127. Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL Jan 29 20:57:15 compendium borgmatic[98093]: CRITICAL Need some help? https://torsion.org/borgmatic/#issues ``` ### Expected behavior The `pg_dump_command` runs without error. ### Other notes / implementation ideas Probably a good idea to audit other database command options for similar breakage. ### borgmatic version 1.8.7 ### borgmatic installation method _No response_ ### Borg version _No response_ ### Python version _No response_ ### Database version (if applicable) _No response_ ### Operating system and version _No response_
witten added the
bug
label 2024-01-30 19:51:21 +00:00
Author
Owner

Fixed in main!

Fixed in main!
Author
Owner

Released in borgmatic 1.8.8!

Released in borgmatic 1.8.8!
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#822
No description provided.