Skip to content

ltfs_ordered_copy: accept str values from xattr.get() (#522) - #660

Closed
MitchelTighe wants to merge 1 commit into
LinearTapeFileSystem:mainfrom
MitchelTighe:fix/ordered-copy-launch-522
Closed

MitchelTighe wants to merge 1 commit into
LinearTapeFileSystem:mainfrom
MitchelTighe:fix/ordered-copy-launch-522

Conversation

@MitchelTighe

@MitchelTighe MitchelTighe commented Oct 15, 2026 •

Copy link
Copy Markdown

Related to #522

The destination check calls sig.startswith(b"LTFS") on the value returned by xattr.get(). Depending on the xattr module in use, that value can be str rather than bytes, and the check then fails with:

Check destination:startswith first arg must be str, not bytes

That's the mirror image of the error reported in #522. This PR encodes a str value before the comparison. It's a 2-line change.

Why "related" rather than "fixes": the exact error in #522 (must be bytes ... not str) no longer reproduces on current main, because the check already compares against b"LTFS". This PR covers the remaining str case.

Update: an earlier version of this PR also changed the shebang to python3. I dropped that after reading #424/#425, which explain why the generic python shebang is kept and that packagers adjust it per distro.

Testing (local harness with an xattr shim that returns str, no real tape):

  • before: aborts at the destination check;
  • after: the copy proceeds.

Written with help from an AI assistant (Claude).

The destination check calls sig.startswith(b"LTFS") on the value returned
by xattr.get().  Depending on the xattr module in use, that value can be
str rather than bytes, and the check then fails with

    Check destination:startswith first arg must be str, not bytes

before anything is copied.  This is the mirror image of the error
reported in LinearTapeFileSystem#522.  Encode a str value before comparing.

Related to LinearTapeFileSystem#522
@MitchelTighe
MitchelTighe force-pushed the fix/ordered-copy-launch-522 branch from 4de3dfb to 591f90a Compare October 16, 2026 00:35
@MitchelTighe MitchelTighe changed the title ltfs_ordered_copy: run with python3 and accept str xattr values ltfs_ordered_copy: accept str values from xattr.get() (#522) Oct 16, 2026
@MitchelTighe

Copy link
Copy Markdown
Author

Closing this one myself. The error reported in #522 no longer reproduces on current main, and pyxattr's xattr.get() returns bytes, so the str case this guarded against is hypothetical. Sorry for the noise.

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.

1 participant