Repository navigation
fix: patch shell polyglot executables for RubyGems overwrite detection - #6
Merged
Merged
Conversation
RubyGems' check_executable_overwrite looks for "This file was generated by RubyGems" comment after the Ruby shebang line. However, in shell polyglot format (used for portable/relocatable Ruby), the comment is at the top of the file in the shell section, not after the embedded Ruby shebang. This causes gem upgrades to fail with "conflicts with installed executable" errors when trying to upgrade bundled gems that have executables (like rbs). The fix patches all shell polyglot executables after installation to add the marker comment after the Ruby shebang where RubyGems expects it. Fixes: jdx/mise#7268 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Apply the same fix from jdx-ruby.rb to jdx-ruby-32.rb which is used for Ruby 3.2.x versions. The previous commit only modified the formula for Ruby 3.3+ versions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Apply the same fix to jdx-ruby-33.rb and jdx-ruby-34.rb. The CI tests against Ruby 3.4.1 which uses jdx-ruby-34.rb, so this should now run the patch code and the ruby-lsp test. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
check_executable_overwritedetectiongem install ruby-lspwhich requires upgrading the bundledrbsgemProblem
RubyGems'
check_executable_overwritemethod looks for "This file was generated by RubyGems" comment after the Ruby shebang line. In shell polyglot format (used for portable/relocatable Ruby built with--enable-load-relative), the comment is at the top of the file in the shell section, not after the embedded Ruby shebang at line 13.This causes gem upgrades to fail with "conflicts with installed executable" errors when trying to upgrade bundled gems that have executables (like
rbs).Example error:
Root Cause
The detection code in RubyGems:
LIBRUBY_RELATIVE=yes(portable Ruby), scans for#!/usr/bin/env rubyshebangrequire 'rubygems'- the comment is at line 3!Fix
After
make install, patch all shell polyglot executables to add the marker comment after the Ruby shebang where RubyGems expects it.Fixes: jdx/mise#7268
🤖 Generated with Claude Code
Note
Addresses RubyGems executable overwrite detection for portable Ruby builds and validates via targeted tests.
make install, patches shell polyglotbinexecutables to insert the "This file was generated by RubyGems" marker after the Ruby shebang socheck_executable_overwriteworks (injdx-ruby,jdx-ruby-32,jdx-ruby-33,jdx-ruby-34).opensslandpsychto confirm portable headers are present, and installsruby-lspto validate upgrades of bundled gems with executables (e.g.,rbs).Written by Cursor Bugbot for commit 47779d1. This will update automatically on new commits. Configure here.