Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Fix stack overflow in jgem command #26910

Closed
wants to merge 2 commits into from
Closed

Conversation

pepijnve
Copy link
Contributor

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.

This patch only overwrites if the target file does not yet exist; otherwise it removes the non-prefixed file.

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.

This patch only overwrites if the target file does not yet exist; otherwise it removes the non-prefixed file.
else
mv file, "j#{file}"
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this less generic and just do what you need to do on the specific files with problems. It's quite hard to follow as-is. Also: needs a comment.

@pepijnve
Copy link
Contributor Author

Better?
The comment on the 'j prefix' bit is an assumption on my part. There was no comment in the original formula explaining why this is done, so I made an educated guess.

@MikeMcQuaid
Copy link
Member

@pepijnve Looks great, thanks.

spkane pushed a commit to spkane/homebrew that referenced this pull request Mar 3, 2014
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#26910.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
ehershey pushed a commit to ehershey/homebrew that referenced this pull request Apr 4, 2014
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#26910.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
@Homebrew Homebrew locked and limited conversation to collaborators Feb 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants