borg
borg copied to clipboard
netbsd test failure in test_hard_link_deletion_and_replacement
Same test failing on BSD as #9147, but not the same failure:
2025-11-07T16:29:20.6382339Z ______________ test_hard_link_deletion_and_replacement[archiver] _______________
2025-11-07T16:29:20.6382757Z [gw2] netbsd10 -- Python 3.11.13 /home/runner/work/borg/borg/.venv/bin/python
2025-11-07T16:29:20.6383009Z
2025-11-07T16:29:20.6383079Z archivers = 'archiver'
2025-11-07T16:29:20.6383422Z request = <FixtureRequest for <Function test_hard_link_deletion_and_replacement[archiver]>>
2025-11-07T16:29:20.6383739Z
2025-11-07T16:29:20.6384160Z @pytest.mark.skipif(not are_hardlinks_supported(), reason="hardlinks not supported")
2025-11-07T16:29:20.6384613Z def test_hard_link_deletion_and_replacement(archivers, request):
2025-11-07T16:29:20.6384950Z archiver = request.getfixturevalue(archivers)
2025-11-07T16:29:20.6385195Z
2025-11-07T16:29:20.6385433Z # repo-create changes umask, so create the repo first to avoid any
2025-11-07T16:29:20.6385888Z # unexpected permission changes.
2025-11-07T16:29:20.6386148Z cmd(archiver, "repo-create", RK_ENCRYPTION)
2025-11-07T16:29:20.6386440Z path_a = os.path.join(archiver.input_path, "a")
2025-11-07T16:29:20.6386736Z path_b = os.path.join(archiver.input_path, "b")
2025-11-07T16:29:20.6386985Z os.mkdir(path_a)
2025-11-07T16:29:20.6387177Z os.mkdir(path_b)
2025-11-07T16:29:20.6387384Z hl_a = os.path.join(path_a, "hardlink")
2025-11-07T16:29:20.6387634Z hl_b = os.path.join(path_b, "hardlink")
2025-11-07T16:29:20.6387954Z create_regular_file(archiver.input_path, hl_a, contents=b"123456")
2025-11-07T16:29:20.6388270Z os.link(hl_a, hl_b)
2025-11-07T16:29:20.6388452Z
2025-11-07T16:29:20.6388619Z cmd(archiver, "create", "test0", "input")
2025-11-07T16:29:20.6388938Z os.unlink(hl_a) # Don't duplicate warning message - one is enough.
2025-11-07T16:29:20.6389258Z cmd(archiver, "create", "test1", "input")
2025-11-07T16:29:20.6389482Z
2025-11-07T16:29:20.6389742Z # Moral equivalent of test_multiple_link_exclusion in borg v1.x... see #8344
2025-11-07T16:29:20.6390308Z # Borg v2 doesn't have this issue comparing hard-links, so we'll defer to
2025-11-07T16:29:20.6390634Z # POSIX behavior:
2025-11-07T16:29:20.6390945Z # https://pubs.opengroup.org/onlinepubs/9799919799/functions/unlink.html
2025-11-07T16:29:20.6391425Z # Upon successful completion, unlink() shall mark for update the last data modification
2025-11-07T16:29:20.6391913Z # and last file status change timestamps of the parent directory. Also, if the
2025-11-07T16:29:20.6392347Z # file's link count is not 0, the last file status change timestamp of the
2025-11-07T16:29:20.6392676Z # file shall be marked for update.
2025-11-07T16:29:20.6392899Z output = cmd(
2025-11-07T16:29:20.6393244Z archiver, "diff", "--pattern=+ fm:input/b", "--pattern=! **/", "test0", "test1", exit_code=EXIT_SUCCESS
2025-11-07T16:29:20.6393622Z )
2025-11-07T16:29:20.6393793Z lines = output.splitlines()
2025-11-07T16:29:20.6394240Z # Directory was excluded.
2025-11-07T16:29:20.6394480Z assert_line_not_exists(lines, "input/a$")
2025-11-07T16:29:20.6394720Z # Remaining hardlink
2025-11-07T16:29:20.6394968Z > assert_line_exists(lines, "ctime:.*input/b/hardlink")
2025-11-07T16:29:20.6395171Z
2025-11-07T16:29:20.6395385Z /home/runner/work/borg/borg/src/borg/testsuite/archiver/diff_cmd_test.py:464:
2025-11-07T16:29:20.6395779Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2025-11-07T16:29:20.6395972Z
2025-11-07T16:29:20.6396092Z lines = [], expected_regexpr = 'ctime:.*input/b/hardlink'
2025-11-07T16:29:20.6396291Z
2025-11-07T16:29:20.6396402Z def assert_line_exists(lines, expected_regexpr):
2025-11-07T16:29:20.6396858Z > assert any(re.search(expected_regexpr, line) for line in lines), f"no match for {expected_regexpr} in {lines}"
2025-11-07T16:29:20.6397360Z E AssertionError: no match for ctime:.*input/b/hardlink in []
2025-11-07T16:29:20.6397648Z E assert False
2025-11-07T16:29:20.6397992Z E + where False = any(<generator object assert_line_exists.<locals>.<genexpr> at 0x7b42669a3010>)
2025-11-07T16:29:20.6398307Z
2025-11-07T16:29:20.6398547Z /home/runner/work/borg/borg/src/borg/testsuite/archiver/__init__.py:359: AssertionError
2025-11-07T16:29:20.6399040Z ___________ test_hard_link_deletion_and_replacement[remote_archiver] ___________
Looks like the ctime was not updated by the unlink operation on netbsd.