Skip to content

Fix BTRFS_SEND_C_CLONE #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix BTRFS_SEND_C_CLONE #25

wants to merge 1 commit into from

Conversation

pmorch
Copy link

@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