Repository navigation
legacy client: work with a borg 1.x "borg serve" - #10420
Merged
ThomasWaldmann merged 1 commit intoSep 24, 2026
Merged
Conversation
--from-borg1 via ssh:// (e.g. borg transfer from a borg 1.x repository)
failed with a borg 1.x "borg serve" on the remote host:
- the client called info() after open, which borg 1.x servers do not
have ("Borg server is too old for info"),
- then close() sent the close RPC, which borg 1.x servers do not have
either ("RPC method close is not valid"), masking the first error,
- get_manifest is also missing on borg 1.x servers,
- borg 1.x servers pack bytes into the msgpack "raw" type, which the
client unpacks to str, so e.g. the repository id and object data
arrived as str.
For borg 1.x servers, the client now uses repository version 1 (the only
version borg 1.x serves), does not send the close RPC (borg 1.x closes
the repository when stdin gets closed), gets the manifest object via get
and converts the bytes results back to bytes.
Tested with a real borg 1.4.5 "borg serve": repo-list, version,
repo-create --other-repo and transfer with --from-borg1, repokey and
keyfile mode. The testsuite emulates a borg 1.x server.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #10420 +/- ##
==========================================
+ Coverage 88.38% 88.41% +0.02%
==========================================
Files 103 103
Lines 19029 19051 +22
Branches 2961 2967 +6
==========================================
+ Hits 16819 16844 +25
+ Misses 1538 1535 -3
Partials 672 672 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--from-borg1viassh://(e.g.borg transfer --from-borg1 --other-repo ssh://...) did not work with a real borg 1.xborg serveon the remote host. Every command failed with rc 82RPC method close is not valid.The testsuite only ever ran the legacy client against borg 2's own legacyborg serve, so this went unnoticed.Causes
open, the client calledinfo(), which borg 1.x servers do not have (Borg server is too old for info).close(), which always sent thecloseRPC. borg 1.x servers do not have that either, and the resulting error masked the first one.get_manifestis also missing on borg 1.x servers.str(surrogateescape). So e.g. the repository id and object data arrived asstr, and loading the key failed withUnsupported payload type.Fix
In
LegacyRemoteRepository, for a borg 1.x server (negotiated server version < 2.0.0a1):info()(borg 1.x only serves v1 repositories);closeRPC (borg 1.x closes the repository when stdin gets closed);get, likeLegacyRepository.get_manifest()does;open,get,list,scanandload_keyback to bytes (surrogateescaperound-trips exactly).Borg 2 servers are handled as before.
Testing
borg serveon NetBSD 11 (remote side run via a fakesshthat executes the command locally):repo-list,version,repo-create --other-repoandtransfer, all with--from-borg1, for repokey and keyfile repositories. Extracting from the transferred borg 2 repository gives the original data, and the borg 1.x repository lock is released.test_remote_borg1_server: it emulates a borg 1.x server (the legacy server with borg 1.x msgpack packing, version 1.4.5, noinfo/close/get_manifest, closing the repository at EOF). Without the fix it fails exactly like the real borg 1.4 case. Also new:test_bytes_from_borg1.test_migrate_lock_alive(known local macFUSE issue, fails on master too).🤖 Generated with Claude Code