Skip to content

diff: fix --numeric-ids having no effect (1.4-maint) - #10598

Merged
ThomasWaldmann merged 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:diff-numeric-ids-1.4
Nov 5, 2026
Merged

ThomasWaldmann merged 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:diff-numeric-ids-1.4

Conversation

@ThomasWaldmann

@ThomasWaldmann ThomasWaldmann commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Backport of #10243 to 1.4-maint.

Problem

borg diff --numeric-ids had no effect: the option was parsed (dest='numeric_ids'), but do_diff never used args.numeric_ids. Archive.compare_archives_iter() built each ItemDiff without passing numeric_ids, so ItemDiff always used its default (False) and always compared and reported user/group names, never uid/gid.

Fix

Thread numeric_ids from the CLI through compare_archives_iter() into ItemDiff. ItemDiff already implemented both behaviors; the flag just never reached it. Hand-ported because 1.4 has the monolithic archiver.py, kept textually close to master. No .pyx changes.

Tests

New DiffArchiverTestCase.test_numeric_ids in testsuite/archiver.py. A non-root test can't produce owner differences via borg create, so it injects raw Items with crafted owner metadata directly into two archives (same technique as _create_malicious_archive). It covers both directions:

  • same uid/gid, different user/group names: reported (with names) without the flag, treated as equal with --numeric-ids
  • different uid/gid, same names: not reported without the flag; with --numeric-ids the owner JSON entry carries the integer ids

The test fails on 1.4-maint without the fix and passes with it.

🤖 Generated with Claude Code

The option was parsed but never used: compare_archives_iter() built
each ItemDiff without passing numeric_ids, so ItemDiff always compared
and reported the user/group names, never uid/gid.

Thread numeric_ids from the CLI through compare_archives_iter() into
ItemDiff, and add a test asserting that with --numeric-ids the owner
changes compare and report numeric uid/gid instead of names.

Backport of borgbackup#10243 (master commit ace8174).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ThomasWaldmann
ThomasWaldmann merged commit 2750b80 into borgbackup:1.4-maint Nov 5, 2026
21 of 22 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the diff-numeric-ids-1.4 branch November 5, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant