borg icon indicating copy to clipboard operation
borg copied to clipboard

freebsd 14 test failure in test_multiple_link_exclusion

Open ThomasWaldmann opened this issue 8 months ago • 4 comments

    freebsd14: ______________ DiffArchiverTestCase.test_multiple_link_exclusion _______________
    freebsd14: [gw12] freebsd14 -- Python 3.10.16 /vagrant/borg/borg/.tox/py310-fuse2/bin/python
    freebsd14: 
    freebsd14: self = <borg.testsuite.archiver.DiffArchiverTestCase testMethod=test_multiple_link_exclusion>
    freebsd14: 
    freebsd14:     @requires_hardlinks
    freebsd14:     def test_multiple_link_exclusion(self):
    freebsd14:         path_a = os.path.join(self.input_path, 'a')
    freebsd14:         path_b = os.path.join(self.input_path, 'b')
    freebsd14:         os.mkdir(path_a)
    freebsd14:         os.mkdir(path_b)
    freebsd14:         hl_a = os.path.join(path_a, 'hardlink')
    freebsd14:         hl_b = os.path.join(path_b, 'hardlink')
    freebsd14:         self.create_regular_file(hl_a, contents=b'123456')
    freebsd14:         os.link(hl_a, hl_b)
    freebsd14:         self.cmd('init', '--encryption=repokey', self.repository_location)
    freebsd14:         self.cmd('create', self.repository_location + '::test0', 'input')
    freebsd14:         os.unlink(hl_a)  # Don't duplicate warning message- one is enough.
    freebsd14:         self.cmd('create', self.repository_location + '::test1', 'input')
    freebsd14: 
    freebsd14: >       output = self.cmd('diff', '--pattern=+ fm:input/b', '--pattern=! **/', self.repository_location + '::test0', 'test1', exit_code=EXIT_WARNING)
    freebsd14: 
    freebsd14: .tox/py310-fuse2/lib/python3.10/site-packages/borg/testsuite/archiver.py:4858:
    freebsd14: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    freebsd14: .tox/py310-fuse2/lib/python3.10/site-packages/borg/testsuite/archiver.py:295: in cmd
    freebsd14:     self.assert_equal(ret, exit_code)
    freebsd14: E   AssertionError: 0 != 1
    freebsd14: ----------------------------- Captured stdout call -----------------------------
    freebsd14: [ctime: Thu, 2025-04-10 17:04:11 -> Thu, 2025-04-10 17:04:15] input/b/hardlink
    freebsd14: 

ThomasWaldmann avatar Apr 10 '25 17:04 ThomasWaldmann

I do see the same issue at OpenIndiana.

mtelka avatar Apr 19 '25 07:04 mtelka

hi @ThomasWaldmann

Me again!

Help me out here, I'm not much up on the python environment, but looking at this code, it looks to me like you're:

creating a text file. hard linking a new file to it. Create a backup. remove the hard link. Create another backup Compare the two, and you see that the ctime has changed.

If so, that would be expected behaviour - the 2 filenames point to the same inode, and if you modify it by removing one link, the ctime will be updated.

I confirmed this on FreBSD, NetBSD, and Linux, and they all behaved the same way.

What am I missing?

Cheers, Jamie

Jamie-Landeg-Jones avatar Apr 26 '25 00:04 Jamie-Landeg-Jones

Looks like the test code expects a warning rc (rc == 1), but gets success (rc == 0).

Guess the warning was because of how moin 1.x represents hardlinks in an archive: the 2nd+ hardlinks ("b") is implemented via referring back to the 1st one ("a"). The diff command excludes the 1st one, so it should have trouble processing the 2nd one.

Hmm, guess this depends on the order how "a" and "b" get archived, maybe that is the difference between platforms...

ThomasWaldmann avatar Nov 09 '25 19:11 ThomasWaldmann

@cr1901 ^

ThomasWaldmann avatar Nov 09 '25 19:11 ThomasWaldmann