Fixes #9495 preserve cwd archive metadata#9501
Fixes #9495 preserve cwd archive metadata#9501ebuzerdrmz44 wants to merge 1 commit intoborgbackup:masterfrom
Conversation
| for attr in ("hostname", "username", "comment", "chunker_params"): | ||
| for attr in ("hostname", "username", "comment", "chunker_params", "cwd"): | ||
| if hasattr(metadata, attr): | ||
| new_metadata[attr] = getattr(metadata, attr) |
There was a problem hiding this comment.
ok, guess that solves it for borg 1.4 archives that do have the cwd metadata (borg 1.4.4+).
but what happens if an older archive gets transferred that does not have the cwd metadata, what will be and what should be in the resulting archive?
There was a problem hiding this comment.
thanks for the review. I guess we shouldn't check cwd inside the for loop. After the loop, could we check it specifically, like getattr(metadata, "cwd", "")?
There was a problem hiding this comment.
But I'm not sure if "" is the best choice here . would you prefer leaving cwd unset or is that fine
There was a problem hiding this comment.
if we can't know, having it unset might be the best choice. check if the code can cope with that.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9501 +/- ##
==========================================
+ Coverage 83.36% 83.37% +0.01%
==========================================
Files 87 87
Lines 15439 15444 +5
Branches 2309 2310 +1
==========================================
+ Hits 12870 12877 +7
Misses 1818 1818
+ Partials 751 749 -2 ☔ View full report in Codecov by Sentry. |
Description
borg transferwas not preserving thecwdarchive metadata from the source archive. Instead, the transferred archive would end up with the cwd of the machine running the transfer command.This adds
cwdto the kept attributes in bothUpgraderNoOpandUpgraderFrom12To20, so the original value is carried over. Also added a check for ittest_transfer_archive_metadata.Fixes #9495
Checklist
master(or maintenance branch if only applicable there)toxor the relevant test subset)