Commit graph

9516 commits

Author SHA1 Message Date
TW
42e645e6a2
Merge pull request #9229 from ThomasWaldmann/haiku-fixes
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Haiku fixes
2025-12-17 22:16:57 +01:00
Thomas Waldmann
dcdc91c1cc
improve fs_test 2025-12-17 18:59:36 +01:00
Thomas Waldmann
6be6b1d942
test_with_lock: skip on Haiku OS 2025-12-17 18:55:43 +01:00
Thomas Waldmann
4df1a534de
tests: refactor expected item_count 2025-12-17 18:44:42 +01:00
Thomas Waldmann
4a701b65ea
add debug prints for sys.path and PATH 2025-12-17 17:59:05 +01:00
Thomas Waldmann
87ff42ee27
add debug print to display archive contents 2025-12-17 17:32:01 +01:00
Thomas Waldmann
1721d1b080
fs_test: exclude Haiku OS from "~root" expansion check 2025-12-17 17:26:14 +01:00
TW
841ed3afad
Merge pull request #9227 from ThomasWaldmann/fix-macos-ci-platforms
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
CI: use macos-15-intel to build the x86_64 binary
2025-12-16 21:17:24 +01:00
TW
7a1c1b41c0
Merge pull request #9226 from ThomasWaldmann/update-changes-master
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
update CHANGES
2025-12-16 20:28:02 +01:00
Thomas Waldmann
d27cb58faf
CI: use macos-15-intel to build the x86_64 binary 2025-12-16 20:15:52 +01:00
Thomas Waldmann
28de075535
update CHANGES 2025-12-16 13:51:27 +01:00
TW
2c15eda7ac
Merge pull request #9225 from ThomasWaldmann/archive-cwd-master
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
info: show cwd at the time of backup creation, fixes #6191
2025-12-16 03:24:57 +01:00
Thomas Waldmann
3c2afeb943
info: show cwd at the time of backup creation, fixes #6191
Useful if one archives relative paths. Together with the cwd
one can know the full path of the files.
2025-12-15 21:28:34 +01:00
TW
d819cd3ba8
Merge pull request #9224 from ThomasWaldmann/fix-binary-build-gh-master
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
CI: FUSE related fixes/improvements (master)
2025-12-15 19:07:08 +01:00
Thomas Waldmann
ac73be4b09
CI: use macOS 15 for binary builds
Github EOLed all other macOS Intel action runners.

As Apple Silicon users tend to have more
recent OSes, we bump that to macOS 15 also.
2025-12-15 17:40:51 +01:00
Thomas Waldmann
4db56e3f71
update binary readme 2025-12-15 17:37:14 +01:00
Thomas Waldmann
ddcf61b5db
CI: increase timeout 2025-12-15 17:35:12 +01:00
Thomas Waldmann
fefb4dfd8e
freebsd: fix upload name for artifact zip 2025-12-15 17:33:19 +01:00
Thomas Waldmann
c8f5d6219d
CI: FUSE related fixes/improvements (master)
fixes #9182

- install OS fuse support packages as indicated by the tox env.
  on the macOS runners, we do not have any fuse support.
  on the linux runners, we may have fuse2 or fuse3.
  on FreeBSD, we have fuse2.
- install fuse python library for binary build
- first build/upload binaries, then run tests (including binary tests).
  early uploading makes inspection of a malfunctioning binary possible.
- for now, use llfuse, as there is an issue with pyinstaller and pyfuse3.

Also:
- remove || true - this just hides errors, not what we want.
2025-12-15 17:29:11 +01:00
TW
9aa66a0f75
Merge pull request #9223 from ThomasWaldmann/cockpit
borg --cockpit: show TUI based on Textual
2025-12-15 17:24:26 +01:00
Thomas Waldmann
2af8de5800
borg --cockpit: show TUI based on Textual 2025-12-15 16:10:21 +01:00
TW
2152e1e3a9
Merge pull request #9209 from ThomasWaldmann/fix-9208
Some checks failed
Lint / lint (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / security (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
CI / windows_tests (push) Has been cancelled
Fix misc. borg transfer issues
2025-12-08 01:33:38 +01:00
Thomas Waldmann
b43c3adabb
transfer: create a chunks list entry for missing chunks, see #9208 2025-12-06 17:21:41 +01:00
Thomas Waldmann
3bda2f10d9
HardLinkManager: allow NoneType for contentless hardlinks, see #9208
Some hardlinks have content and thus a chunks list,
but e.g. block or char device hardlinks do not have a chunks list.
2025-12-06 17:21:38 +01:00
Thomas Waldmann
352f982393
old archives might not have a comment in metadata, see #9208
guess the default is only needed when transferring
very old archives from borg1 repos.
2025-12-06 16:04:46 +01:00
TW
425fa1c77a
fix pynacl/libsodium build on freebsd (#9214)
Some checks failed
Lint / lint (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / security (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
CI / windows_tests (push) Has been cancelled
2025-12-06 15:30:26 +01:00
TW
70f6c0122a
Merge pull request #9212 from ThomasWaldmann/filter-xattrs-master
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
no_selinux -> filter_xattrs
2025-12-05 19:18:47 +01:00
Thomas Waldmann
fefb27e732
no_selinux -> filter_xattrs
Originally, we only wanted to get rid of selinux xattrs,
but macOS also uses some xattr keys that disturb our test results,
so we filter them also.
2025-12-05 18:37:11 +01:00
TW
231bf26552
Merge pull request #9200 from ThomasWaldmann/fix-9199-legacyremote-raise-missing
Some checks failed
Lint / lint (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / security (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
CI / windows_tests (push) Has been cancelled
transfer and legacyremote fixes
2025-12-04 01:59:31 +01:00
Thomas Waldmann
7d4c05d2a3
transfer: fix AttributeError with --dry-run, see #9199 2025-12-02 03:00:32 +01:00
Thomas Waldmann
017dfec4ff
transfer: add --dry-run test 2025-12-02 03:00:30 +01:00
Thomas Waldmann
11ad58d3ca
legacyremote: accept raise_missing in get/get_many to avoid TypeError with callers that pass it; no behavior change on legacy protocol (fixes #9199) 2025-12-02 02:33:01 +01:00
TW
a38d87b21f
Merge pull request #9205 from ThomasWaldmann/fix-compact-master
Some checks failed
Lint / lint (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / security (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
CI / windows_tests (push) Has been cancelled
compact: fix dealing with mismatching hints (master)
2025-12-02 02:31:14 +01:00
Thomas Waldmann
d676ef7b3f
compact: also fix segments hints data for lost segment files
The code used to remove the missing segment only from "compact" hints,
but we need to also remove it from "segments" hints.
2025-12-02 01:37:35 +01:00
Thomas Waldmann
b1bb3830fb
compact_segments: replace AssertionError by warning, fixes #8535
emit only a warning, but let compaction complete.
after that, borg check --repair can fix the hints successfully.

likely this code won't be used in master branch as we only read from
legacy repos, but I ported this fix from 1.4-maint nevertheless.

This is the result of a longer discussion with Antigravity AI and me:

Detailed Explanation: Why Converting AssertionError to Warning is Correct
=========================================================================

PROBLEM OVERVIEW
----------------
The assertion `assert segments[segment] == 0` in compact_segments() was causing
borg compact to crash when segment reference counts in the hints file didn't
match the actual repository state. This typically occurred after index corruption
or repository recovery scenarios.

ROOT CAUSE ANALYSIS
-------------------
The crash happens due to a fundamental mismatch between two data structures:

1. self.segments (loaded from hints file)
   - Contains reference counts for each segment
   - Persisted to disk in the hints file
   - Represents the "last known state"

2. self.index (loaded from index file)
   - Contains mappings of object IDs to (segment, offset) pairs
   - Can be corrupted or lost
   - When corrupted, triggers auto-recovery

The Problem Scenario:
1. Repository has valid data with consistent hints.N and index.N
2. Index file gets corrupted (crash, disk error, etc.)
3. Borg detects corruption and auto-recovers:
   - Loads hints.N (with old reference counts)
   - Rebuilds index by replaying segments
   - Commits the rebuilt index
4. State is now inconsistent IF segments were deleted/lost:
   - self.segments[X] = 10 (from old hints, assumes segment X exists)
   - Segment X was actually deleted/lost
   - self.index has 0 entries for segment X (rebuilt from remaining segments)
5. During compact_segments():
   - Tries to iterate objects in segment X
   - Segment X doesn't exist (was deleted/lost)
   - OR: segment X exists but objects aren't in index (superseded)
   - segments[X] is never decremented
   - segments[X] remains 10 instead of becoming 0
   - Assertion fails!

WHY THE FIX IS CORRECT
----------------------

1. Hints are Advisory, Not Authoritative
   The hints file is an optimization to avoid scanning all segments. It's
   explicitly designed to be rebuildable from scratch by scanning segments.
   Therefore, incorrect hints should not cause a fatal error.

2. Self-Healing Behavior
   By converting the assertion to a warning and allowing compaction to proceed:
   - Compaction completes successfully
   - New hints are written with correct reference counts
   - Repository is automatically healed
   - No manual intervention required

3. Data Safety is Preserved
   The fix does NOT compromise data integrity because:
   - Compaction first copies all live data from segments to new segments
   - Only after all live data is safely copied are segments marked for deletion
   - The index determines what's "live" (authoritative source of truth)
   - Segments are deleted only when they contain no live data (per index)
   - The refcount warning indicates stale hints, not actual data loss risk
   - After compaction, new hints are written with correct counts

4. Consistent with Design Philosophy
   Borg already handles many corruption scenarios gracefully:
   - Missing hints → regenerated from segments
   - Corrupted index → rebuilt from segments
   - Missing segments → detected and handled
   This fix extends that philosophy to hint/index mismatches.

5. Alternative Solutions are Worse
   Other approaches considered:
   a) Crash and require manual intervention
      - Current behavior, user-hostile
      - Requires expert knowledge to fix
   b) Automatically run check --repair
      - Too aggressive, may hide real problems
      - User should decide when to repair
   c) Refuse to compact
      - Leaves repository in degraded state
      - Prevents normal operations

VERIFICATION
------------
The fix has been verified with test cases that reproduce both scenarios:

1. test_missing_segment_in_hints
   - Simulates missing segment files
   - Verifies compact succeeds and updates hints correctly

2. test_index_corruption_with_old_hints
   - Simulates the root cause: corrupted index with old hints
   - Verifies compact succeeds despite reference count mismatch

3. test_subtly_corrupted_hints_without_integrity
   - Existing test updated to expect warning instead of crash
   - Verifies repository remains consistent after compaction

OPERATIONAL IMPACT
------------------
After this fix:
1. Users experiencing this crash can now run `borg compact` successfully
2. The warning message alerts them to the inconsistency
3. They can optionally run `borg check --repair` for peace of mind
4. Repository continues to function normally

The warning message provides enough information for debugging while not
blocking normal operations.

CONCLUSION
----------
Converting the assertion to a warning is the correct fix because:
- It aligns with Borg's design philosophy of graceful degradation
- It enables self-healing behavior
- It preserves data safety
- It improves user experience
- It's consistent with how other corruption scenarios are handled

The assertion was overly strict for a data structure (hints) that is
explicitly designed to be advisory and rebuildable.
2025-12-02 01:35:38 +01:00
TW
f6ac5c4715
Merge pull request #9188 from ThomasWaldmann/update-faq-master
Some checks failed
Lint / lint (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / security (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
CI / asan_ubsan (push) Has been cancelled
CI / native_tests (push) Has been cancelled
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Has been cancelled
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Has been cancelled
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Has been cancelled
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Has been cancelled
CI / windows_tests (push) Has been cancelled
docs: some fixes/update to the FAQ
2025-11-21 17:29:06 +01:00
Thomas Waldmann
3642c7903b
docs: some fixes/update to the FAQ 2025-11-21 17:16:35 +01:00
TW
1ede79bdec
Merge pull request #9143 from ThomasWaldmann/feature/8753-linux-acl-any-text
linux ACL: use acl_to_any_text to avoid libacl name lookups, fixes #8753
2025-11-21 17:05:19 +01:00
Thomas Waldmann
3419d93a17
how to speed up the freebsd ACL code 2025-11-21 13:42:30 +01:00
Thomas Waldmann
e385103a1b
cosmetic: move new acl helper functions closer to other acl code 2025-11-21 13:42:29 +01:00
Thomas Waldmann
964aa8998d
better names 2025-11-21 13:42:27 +01:00
Thomas Waldmann
7e7ea5b289
remove unused acl code (linux) 2025-11-21 13:42:25 +01:00
Thomas Waldmann
798bd9ed0d
refactor id <-> name lookup for monkeypatching
we can't monkeypatch stuff in Cython/C code, so we
go over python module attribute lookup.

that way, we can more easily test some functions that
internally do id<->name lookups.
2025-11-21 13:42:11 +01:00
Thomas Waldmann
6808809818
linux ACL: use acl_to_any_text to avoid libacl name lookups, fixes #8753
Use LRU caches in borg to avoid gazillions of id -> name lookups
(they can be slow, especially for network filesystems).
2025-11-21 13:38:31 +01:00
TW
753ac7088b
Merge pull request #9169 from ThomasWaldmann/netbsd-xattr-support
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
netbsd: xattr support
2025-11-21 13:35:38 +01:00
Thomas Waldmann
bcf3316308
NetBSD: xattr.get_all: catch also errno.EOPNOTSUPP 2025-11-21 12:42:06 +01:00
Thomas Waldmann
0286fb6dc4
NetBSD: copy xattr implementation of FreeBSD, fixes #1332 2025-11-21 12:42:05 +01:00
Thomas Waldmann
9a0122995c
CI: netbsd: enable xattrs on TMPDIR 2025-11-21 12:41:59 +01:00
TW
2c2b0343b2
Merge pull request #9185 from ThomasWaldmann/tests-fs-cleanup-master
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Tests fs cleanup (master)
2025-11-21 03:17:59 +01:00
TW
ce9a4826b0
Merge pull request #9186 from ThomasWaldmann/fixes-master
misc small fixes (master)
2025-11-21 03:02:46 +01:00