From bd35d1596e781d7a7d014edd5593ea5bf718de8d Mon Sep 17 00:00:00 2001 From: Pepijn Van Eeckhoudt Date: Sat, 22 Feb 2014 07:47:05 +0100 Subject: [PATCH] jruby: fix stack overflow in jgem command. In jruby 1.7.10 (possibly earlier) the script in bin/gem simply calls bin/jgem. The jruby formula overwrites jgem with gem in the 'prefix with j' paragraph. This way the jgem script end up calling itself infinitely causing a stack overflow crash. Closes Homebrew/homebrew#26910. Signed-off-by: Mike McQuaid --- Formula/jruby.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Formula/jruby.rb b/Formula/jruby.rb index 625f6d17a33d5..95b033e3588de 100644 --- a/Formula/jruby.rb +++ b/Formula/jruby.rb @@ -9,11 +9,13 @@ def install # Remove Windows files rm Dir['bin/*.{bat,dll,exe}'] - # Prefix a 'j' on some commands cd 'bin' do - Dir['*'].each do |file| - mv file, "j#{file}" unless file.match /^[j]/ - end + # Prefix a 'j' on some commands to avoid clashing with other ruby installations + ['ast', 'rake', 'rdoc', 'ri', 'testrb'].each { |f| mv f, "j#{f}" } + # Delete some unnecessary command + # gem is a wrapper script for jgem + # irb is an identical copy of jirb + ['gem', 'irb'].each { |f| rm f } end # Only keep the OS X native libraries