Skip to content

Conversation

@indirect
Copy link

@indirect indirect commented Oct 30, 2025

Without this patch, IO.console triggers a segfault in statically compiled Ruby on linux. I tested using Docker images ubuntu:latest and homebrew/brew:latest.

Reproduction steps:
0. (optional) Install rv by running curl --proto '=https' --tlsv1.2 -LsSf https://github.com/spinel-coop/rv/releases/download/v0.2.0/rv-installer.sh | sh.

  1. Install Ruby from rv-ruby releases. With rv installed, you can do this by running rv ruby install 3.4.7; eval "$(rv shell init bash)".
  2. Check out io-console repository.
  3. Run bundle install; bundle exec rake compile; bundle exec rake test.

Expected output:

31 tests, 117 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Actual output (without patch):

/src/test/io/console/test_io_console.rb:441: [BUG] Segmentation fault at 0x0000000000000008
ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [aarch64-linux]

-- Control frame information -----------------------------------------------
c:0010 p:---- s:0042 e:000041 CFUNC  :console
c:0009 p:0072 s:0038 e:000037 BLOCK  /src/test/io/console/test_io_console.rb:441 [FINISH]
c:0008 p:---- s:0035 e:000034 CFUNC  :class_eval
c:0007 p:0063 s:0031 e:000030 TOP    /src/test/io/console/test_io_console.rb:65 [FINISH]
c:0006 p:---- s:0028 e:000027 CFUNC  :require
c:0005 p:0054 s:0023 e:000022 BLOCK  /home/linuxbrew/.data/rv/rubies/ruby-3.4.7/lib/ruby/3.4.0/bundled_gems.rb:82
c:0004 p:0063 s:0016 e:000015 BLOCK  /home/linuxbrew/.gem/ruby/3.4.7/gems/rake-13.3.0/lib/rake/rake_test_loader.rb:21 [FINISH]
c:0003 p:---- s:0011 e:000010 CFUNC  :select
c:0002 p:0012 s:0007 E:001018 EVAL   /home/linuxbrew/.gem/ruby/3.4.7/gems/rake-13.3.0/lib/rake/rake_test_loader.rb:6 [FINISH]
c:0001 p:0000 s:0003 E:001600 DUMMY  [FINISH]

Actual output (with patch):

Loaded suite /home/linuxbrew/.gem/ruby/3.4.7/gems/rake-13.3.0/lib/rake/rake_test_loader
Started
Finished in 4.224777833 seconds.
-----------------------------------------------------------------------------------------
31 tests, 117 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
-----------------------------------------------------------------------------------------
7.34 tests/s, 27.69 assertions/s

@indirect
Copy link
Author

indirect commented Nov 7, 2025

I was able to work around this issue by removing --with-static-linked-ext from my builds of Ruby: spinel-coop/rv-ruby#16. While that resolves the segfault, I still believe it should be possible to load the io-console gem even if Ruby has statically linked the default gem version of io-console.

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