Skip to content

Fix BTRFS_SEND_C_CLONE#25

Open
pmorch wants to merge 1 commit into
sysnux:masterfrom
pmorch:fix-clone
Open

Fix BTRFS_SEND_C_CLONE#25
pmorch wants to merge 1 commit into
sysnux:masterfrom
pmorch:fix-clone

Conversation

@pmorch
Copy link
Copy Markdown

@pmorch pmorch commented Feb 28, 2025

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.

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

This maybe fixes sysnux#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 sysnux#23.
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.

ValueError: Unexpected attribute BTRFS_SEND_A_FILE_OFFSET

1 participant