btrfs-snapshots-diff icon indicating copy to clipboard operation
btrfs-snapshots-diff copied to clipboard

Fix BTRFS_SEND_C_CLONE

Open pmorch opened this issue 9 months ago • 0 comments

It now aligns with https://github.com/torvalds/linux/blob/dd83757f6e686a2188997cb58b5975f744bb7786/fs/btrfs/send.c#L5394

This maybe fixes #22.

Without this, I got this error:

Traceback (most recent call last):
  File "/home/peter/work/btrfs-snapshots-diff/./btrfs-snapshots-diff.py", line 653, in <module>
    main()
  File "/home/peter/work/btrfs-snapshots-diff/./btrfs-snapshots-diff.py", line 620, in main
    commands, paths = stream.decode(bogus=args.bogus)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/work/btrfs-snapshots-diff/./btrfs-snapshots-diff.py", line 325, in decode
    offset2, path = self._tlv_get_string('BTRFS_SEND_A_PATH', offset)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/work/btrfs-snapshots-diff/./btrfs-snapshots-diff.py", line 105, in _tlv_get_string
    raise ValueError(f'Unexpected attribute {self.send_attrs[attr]}')
ValueError: Unexpected attribute BTRFS_SEND_A_FILE_OFFSET

And according to btrfs/send.c BTRFS_SEND_A_PATH not supposed to be sent as the first element of a BTRFS_SEND_C_CLONE, but BTRFS_SEND_A_FILE_OFFSET is.

The patch to create-example.sh causes the test to fail, but I cannot fix them because of #23.

Without the fix, but with the patch to create-example.sh, we get the ValueError: Unexpected attribute BTRFS_SEND_A_FILE_OFFSET from above.

pmorch avatar Feb 28 '25 00:02 pmorch