shebang line containing numbers garbles command line arguments --------------------------------------------------------------
Key: JRUBY-3522 URL: http://jira.codehaus.org/browse/JRUBY-3522 Project: JRuby Issue Type: Bug Affects Versions: JRuby 1.2 Environment: Linux devel-o8 2.6.26-1-686 #1 SMP Sat Jan 10 18:29:31 UTC 2009 i686 GNU/Linux jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-03-16 rev 9419) [i386-java] Reporter: Matthijs Bomhoff Assignee: Thomas E Enebo A shebang line containing a number is misinterpreted and causes everything after the number to be parsed as command line arguments and used instead of any real arguments passed to jruby. In practice, this means existing scripts that contain a shebang with an explicit version of the ruby interpreter (such as "ruby1.8") and are executed directly from the command line without explicitly invoking the interpreter cannot be run unmodified using jruby if they require command line arguments. Removing the shebang line causes everything to work correctly again. The following shebang lines work correctly: #!/usr/bin/ruby #!/usr/bin/env ruby The following do not: #!/usr/bin/ruby1 #!/usr/bin/ruby1.8 #!/usr/bin/env ruby1 #!/usr/bin/env ruby1.8 How to reproduce: 1. Create a very simple ruby script shebang.rb containing just the following two lines: #!/usr/bin/env ruby1.8 puts ARGV.inspect 2. Run the script using jruby $ jruby shebang.rb foobar [".8"] 3. Compare the output with the same script using ruby 1.8 or 1.9 $ ruby1.8 shebang.rb foobar ["foobar"] $ ruby1.9 shebang.rb foobar ["foobar"] -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email