-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Hey,
I ran into a situation where I'm trying to require systemu directly on the command line like so:
RUBYOPT="-rsystemu" ./foo.rbThe following code from systemu.rb causes an infinite loop:
c = begin; ::RbConfig::CONFIG; rescue NameError; ::Config::CONFIG; end
ruby = File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']
@ruby = if system('%s -e 42' % ruby)
ruby
else
system('%s -e 42' % 'ruby') ? 'ruby' : warn('no ruby in PATH/CONFIG')
endI'm not really sure what this is trying to do; make sure the initially detected ruby binary actually exists? Make sure it's actually ruby? Since the output isn't being verified, I'm not sure this is effective. I think a simple File.exists? test should be good enough, or else maybe this could be lazy loaded the first time the @ruby var is accessed?
I've created a simple test repo here to demonstrate the issue:
https://github.com/chetan/systemu_forkbomb
Simply run test.sh or test.rb and watch ps to see what happens. The only way to kill it is killall ruby.
chetan
Metadata
Metadata
Assignees
Labels
No labels