Could not find local borg version #502

Closed
opened 2022-02-22 03:13:41 +00:00 by chenrui Β· 4 comments

What I'm trying to do and why

πŸ‘‹ trying to upgrade the homebrew formula to use the latest release (1.5.23), but ran into some test regression issue.

==> /opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic -v 2 --config /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml --init --encryption repokey
Last 15 lines from /Users/rui/Library/Logs/Homebrew/borgmatic/test.02.borgmatic:
--encryption
repokey

Ensuring legacy configuration is upgraded
/private/tmp/borgmatic-test-20220221-29656-1tu4y2n/borg --version --debug --show-rc
/private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error getting local Borg version
Could not parse Borg version string
/private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error running configuration file

summary:
/private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error running configuration file
/private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error getting local Borg version
Could not parse Borg version string

Steps to reproduce (if a bug)

Checkout this PR, https://github.com/Homebrew/homebrew-core/pull/94886, and ran brew install -s borgmatic, and then manually execute the commands in the test block.

Here is the test log in my local.

$ brew test borgmatic
==> Testing borgmatic
==> /opt/homebrew/Cellar/borgmatic/1.5.23/bin/generate-borgmatic-config --destination /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml
==> /opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic -v 2 --config /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml --init --encryption repokey
Last 15 lines from /Users/rui/Library/Logs/Homebrew/borgmatic/test.02.borgmatic:
--encryption
repokey

Ensuring legacy configuration is upgraded
/private/tmp/borgmatic-test-20220221-29656-1tu4y2n/borg --version --debug --show-rc
/private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error getting local Borg version
Could not parse Borg version string
/private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error running configuration file

summary:
/private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error running configuration file
/private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error getting local Borg version
Could not parse Borg version string

Actual behavior (if a bug)

$ /opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic -v 2 --config config.yml --init --encryption repokey --verbosity 2
Ensuring legacy configuration is upgraded
/opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic --version --debug --show-rc
usage: borgmatic [-h] [-c [CONFIG_PATHS ...]] [--excludes EXCLUDES_FILENAME]
                 [-n] [-nc] [-v {-1,0,1,2}] [--syslog-verbosity {-1,0,1,2}]
                 [--log-file-verbosity {-1,0,1,2}]
                 [--monitoring-verbosity {-1,0,1,2}] [--log-file LOG_FILE]
                 [--override SECTION.OPTION=VALUE [SECTION.OPTION=VALUE ...]]
                 [--version]
                 ...
borgmatic: error: unrecognized arguments: --debug --show-rc
Error parsing arguments: /opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic --version --debug --show-rc

Need some help? https://torsion.org/borgmatic/#issues
config.yml: Error getting local Borg version
Command '('/opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic', '--version', '--debug', '--show-rc')' returned non-zero exit status 1.
config.yml: Error running configuration file

summary:
config.yml: Error running configuration file
config.yml: Error getting local Borg version
Command '('/opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic', '--version', '--debug', '--show-rc')' returned non-zero exit status 1.

Need some help? https://torsion.org/borgmatic/#issues

Expected behavior (if a bug)

Other notes / implementation ideas

Environment

borgmatic version: [version here]

Use sudo borgmatic --version or sudo pip show borgmatic | grep ^Version

borgmatic installation method: [e.g., Debian package, Docker container, etc.]

Borg version: [version here]

1.5.23

Python version: [version here]

3.10.x

Database version (if applicable): [version here]

N/A

operating system and version: [OS here]

macOS 12-arm

#### What I'm trying to do and why πŸ‘‹ trying to upgrade the homebrew formula to use the latest release (1.5.23), but ran into some test regression issue. ``` ==> /opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic -v 2 --config /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml --init --encryption repokey Last 15 lines from /Users/rui/Library/Logs/Homebrew/borgmatic/test.02.borgmatic: --encryption repokey Ensuring legacy configuration is upgraded /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/borg --version --debug --show-rc /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error getting local Borg version Could not parse Borg version string /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error running configuration file summary: /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error running configuration file /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error getting local Borg version Could not parse Borg version string ``` #### Steps to reproduce (if a bug) Checkout this PR, https://github.com/Homebrew/homebrew-core/pull/94886, and ran `brew install -s borgmatic`, and then manually execute the commands in the `test` block. Here is the test log in my local. ``` $ brew test borgmatic ==> Testing borgmatic ==> /opt/homebrew/Cellar/borgmatic/1.5.23/bin/generate-borgmatic-config --destination /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml ==> /opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic -v 2 --config /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml --init --encryption repokey Last 15 lines from /Users/rui/Library/Logs/Homebrew/borgmatic/test.02.borgmatic: --encryption repokey Ensuring legacy configuration is upgraded /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/borg --version --debug --show-rc /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error getting local Borg version Could not parse Borg version string /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error running configuration file summary: /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error running configuration file /private/tmp/borgmatic-test-20220221-29656-1tu4y2n/config.yml: Error getting local Borg version Could not parse Borg version string ``` #### Actual behavior (if a bug) ``` $ /opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic -v 2 --config config.yml --init --encryption repokey --verbosity 2 Ensuring legacy configuration is upgraded /opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic --version --debug --show-rc usage: borgmatic [-h] [-c [CONFIG_PATHS ...]] [--excludes EXCLUDES_FILENAME] [-n] [-nc] [-v {-1,0,1,2}] [--syslog-verbosity {-1,0,1,2}] [--log-file-verbosity {-1,0,1,2}] [--monitoring-verbosity {-1,0,1,2}] [--log-file LOG_FILE] [--override SECTION.OPTION=VALUE [SECTION.OPTION=VALUE ...]] [--version] ... borgmatic: error: unrecognized arguments: --debug --show-rc Error parsing arguments: /opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic --version --debug --show-rc Need some help? https://torsion.org/borgmatic/#issues config.yml: Error getting local Borg version Command '('/opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic', '--version', '--debug', '--show-rc')' returned non-zero exit status 1. config.yml: Error running configuration file summary: config.yml: Error running configuration file config.yml: Error getting local Borg version Command '('/opt/homebrew/Cellar/borgmatic/1.5.23/bin/borgmatic', '--version', '--debug', '--show-rc')' returned non-zero exit status 1. Need some help? https://torsion.org/borgmatic/#issues ``` #### Expected behavior (if a bug) #### Other notes / implementation ideas #### Environment **borgmatic version:** [version here] Use `sudo borgmatic --version` or `sudo pip show borgmatic | grep ^Version` **borgmatic installation method:** [e.g., Debian package, Docker container, etc.] **Borg version:** [version here] 1.5.23 **Python version:** [version here] 3.10.x **Database version (if applicable):** [version here] N/A **operating system and version:** [OS here] macOS 12-arm
Owner

This looks to be a problem with the Homebrew package and it's own "end-to-end" tests. (The Homebrew package is not maintained by the borgmatic project.) Specifically, it's creating a fake Borg binary and then actually running borgmatic, which among other things, invokes borg --version and expects a valid version string to come back. (This recent change in borgmatic is necessary to support compatibility differences between Borg 1.1 and the impending Borg 1.2)

One fix would be to alter the fake Borg binary to support --version, although I cannot guarantee that it won't break similiarly in the future.

Ultimately, I do not recommend maintaining end-to-end tests outside borgmatic, since they are prone to breakage when these sorts of changes occur. Instead, I recommend running the supported and maintained end-to-end tests via scripts/run-full-dev-tests within the borgmatic source. However, those tests have a Docker dependency, which may make that a hard sell in a Homebrew environment.

I'll try to file an issue with Homebrew and link it here.

EDIT: It looks like the official Homebrew repo has an older version of borgmatic, so I can't very well file a ticket with them for an issue that doesn't yet exist there. If you happen to be the/a maintainer of the borgmatic Homebrew package, then maybe this issue constitutes passing on that information?

This looks to be a problem with the Homebrew package and it's own "end-to-end" tests. (The Homebrew package is not maintained by the borgmatic project.) Specifically, it's creating a [fake Borg binary](https://github.com/dtrodrigues/homebrew-core/blob/1cf2c458a22edc01d219669d2b736e922a881850/Formula/borgmatic.rb#L87) and then [actually running borgmatic](https://github.com/dtrodrigues/homebrew-core/blob/1cf2c458a22edc01d219669d2b736e922a881850/Formula/borgmatic.rb#L110), which among other things, invokes `borg --version` and expects a valid version string to come back. (This recent change in borgmatic is necessary to support compatibility differences between Borg 1.1 and the impending Borg 1.2) One fix would be to alter the fake Borg binary to support `--version`, although I cannot guarantee that it won't break similiarly in the future. Ultimately, I do not recommend maintaining end-to-end tests outside borgmatic, since they are prone to breakage when these sorts of changes occur. Instead, I recommend running the supported and maintained end-to-end tests via `scripts/run-full-dev-tests` within the borgmatic source. However, those tests have a Docker dependency, which may make that a hard sell in a Homebrew environment. I'll try to file an issue with Homebrew and link it here. EDIT: It looks like the official Homebrew repo has an [older version of borgmatic](https://github.com/Homebrew/homebrew-core/blob/master/Formula/borgmatic.rb), so I can't very well file a ticket with them for an issue that doesn't yet exist there. If _you_ happen to be the/a maintainer of the borgmatic Homebrew package, then maybe _this_ issue constitutes passing on that information?
witten added the
question / support
label 2022-03-06 00:03:11 +00:00
Owner

Closing this ticket for now, since there's not anything I can do in the borgmatic source to fix it. However, please feel free to post any follow-ups on this ticket. And if there's anything I can do to make borgmatic tests easier to run in a Homebrew environment, please let me know. Thank you for filing this!

Closing this ticket for now, since there's not anything I can do in the borgmatic source to fix it. However, please feel free to post any follow-ups on this ticket. And if there's anything I can do to make borgmatic tests easier to run in a Homebrew environment, please let me know. Thank you for filing this!
Contributor

I ran across this exact test failure while trying to update the outdated borgmatic Homebrew formula, after noticing the packaged version was older than what's on PyPI.

I didn't discover this issue until just now, but essentially implemented what you suggested above. The "test" block isn't meant to be comprehensive, so it should be fine now.

For reference: https://github.com/Homebrew/homebrew-core/pull/102656, which will update the version from 1.5.22 -> 1.6.1.

Thanks!

I ran across this *exact* test failure while trying to update the outdated `borgmatic` Homebrew formula, after noticing the packaged version was older than what's on PyPI. I didn't discover this issue until just now, but essentially implemented what you suggested above. The "test" block isn't meant to be comprehensive, so it should be fine now. For reference: https://github.com/Homebrew/homebrew-core/pull/102656, which will update the version from 1.5.22 -> 1.6.1. Thanks!
Contributor

I had to do some more extensive stubbing for 1.6.2 - very open to suggestions!

Hopefully this is a little more resilient to changes

https://github.com/Homebrew/homebrew-core/pull/102739

I had to do some more extensive stubbing for 1.6.2 - very open to suggestions! Hopefully this is a little more resilient to changes https://github.com/Homebrew/homebrew-core/pull/102739
Sign in to join this conversation.
No Milestone
No Assignees
3 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#502
No description provided.