Skip to content

Let create_header pick up OS_CODE - #147

Merged
hsbt merged 2 commits into
masterfrom
claude/pensive-borg-7b5e2a
Sep 24, 2026
Merged

hsbt merged 2 commits into
masterfrom
claude/pensive-borg-7b5e2a

Conversation

@hsbt

@hsbt hsbt commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Zlib::OS_CODE is OS_UNIX (3) in the bundled zlib of ruby/ruby on Windows, even though extconf.rb detects Win32. The OS_CODE entry in $defs starts with a space, and mkmf's create_header only reads entries that start with -D, so extconf.h lacks it and zlib.c falls back to OS_UNIX. The standalone gem build is not affected because it passes $defs on the command line.

I confirmed on x64-mswin64_140 that extconf.h now has #define OS_CODE OS_WIN32 and Zlib::OS_CODE is 11. On Linux the value stays 3. test_os_code now checks the value on Windows, but it can fail only in the ruby/ruby build because the CI here builds the gem standalone.

As a result, gzip files that GzipWriter writes by default on Windows get OS byte 11 instead of 3. This includes .gem files built with gem build.

Generated with Claude Code

hsbt and others added 2 commits September 25, 2026 07:08
mkmf's create_header ignores $defs entries that do not start with -D, so the leading space dropped OS_CODE from extconf.h. The in-tree build of ruby/ruby then fell back to OS_UNIX in zlib.c, and Zlib::OS_CODE was 3 on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_os_code only compared the written os_code with Zlib::OS_CODE itself, so it could not catch OS_CODE falling back to OS_UNIX.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hsbt
hsbt merged commit bdd152a into master Sep 24, 2026
60 checks passed
@hsbt
hsbt deleted the claude/pensive-borg-7b5e2a branch September 24, 2026 23:45
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