Skip to content

Fix swapped XFL and OS bytes in igzip_threaded gzip headers - #322

Merged
rhpvorderman merged 2 commits into
pycompression:developfrom
ptweezy:threaded-header-xfl-os
Nov 6, 2026
Merged

rhpvorderman merged 2 commits into
pycompression:developfrom
ptweezy:threaded-header-xfl-os

Conversation

@ptweezy

@ptweezy ptweezy commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

When threads is not 0 (the default is 1), igzip_threaded.open() writes the XFL and OS bytes of the gzip header in the wrong order. Bytes 8 and 9 are ff 04 at level 0 and ff 00 at levels 1 to 3, where IGzipFile writes 04 ff and 00 ff. The output still decompresses, but the file command reports it as coming from VM/CMS or a FAT file system. This change passes xfl before os to struct.pack() in _write_gzip_header(), the order RFC 1952 gives. The new test test_threaded_write_header_xfl_os fails on develop.

Checklist

  • Pull request details were added to CHANGELOG.rst
  • Documentation was updated (if needed)

ptweezy and others added 2 commits November 5, 2026 17:19
RFC 1952 puts XFL before OS. The threaded writer packed OS first, so
file(1) reported its output as from VM/CMS or a FAT file system.
@rhpvorderman

Copy link
Copy Markdown
Collaborator

Good spot. Yes the OS byte should be last!

@rhpvorderman
rhpvorderman merged commit 599958d into pycompression:develop Nov 6, 2026
21 checks passed
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.

2 participants