Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jruby -X gives warning #5202

Closed
chrisseaton opened this issue May 29, 2018 · 6 comments
Closed

jruby -X gives warning #5202

chrisseaton opened this issue May 29, 2018 · 6 comments

Comments

@chrisseaton
Copy link
Contributor

Environment

jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 25.161-b12 on 1.8.0_161-b12 +jit [darwin-x86_64]

Expected Behavior

ruby -X to not print any warnings.

Actual Behavior

(See above 'Extended options')

$ ruby -X
JRuby Launcher usage: jruby {options} arguments

To see general JRuby options, type 'jruby -h' or 'jruby --help'.

Options:
  -Xversion             print launcher's version

Jvm Management:
  -Xjdkhome <path>      set path to JDK
  -J<jvm_option>        pass <jvm_option> to JVM

Classpath Management:
  -Xcp   <classpath>    set the classpath
  -Xcp:p <classpath>    prepend <classpath> to classpath
  -Xcp:a <classpath>    append <classpath> to classpath
  -Xnobootclasspath     don't put jruby jars on the bootclasspath

Misc:
  -Xtrace <path>        path for launcher log (for troubleshooting)
  -Xcommand             just print the equivalent java command and exit

  -Xprop.erty[=value]   equivalent to -J-Djruby.<prop.erty>[=value]
  -Xproperties          list supported properties (omit "jruby." with -X)

jruby: warning: unknown property jruby.launcher.nopreamble
Extended options:
  -X-O          run with ObjectSpace disabled (default; improves performance)
  -X+O          run with ObjectSpace enabled (reduces performance)
  -X-C          disable all compilation
  -X-CIR        disable all compilation and use IR runtime
  -X+C          force compilation of all scripts before they are run (except eval)
  -X+CIR        force compilation and use IR runtime
  -X+JIR        JIT compilation and use IR runtime
  -Xsubstring?  list options that contain substring in their name
  -Xprefix...   list options that are prefixed with prefix
@headius
Copy link
Member

headius commented Jun 12, 2018

First of all...

ruby -X to not print any warnings.

Why?

Getting past that...this only appears to be broken in the native launcher. The bash script produces the following output:

$ bin/jruby.bash -X
jruby: missing argument
Extended options:
  -X-O          run with ObjectSpace disabled (default; improves performance)
  -X+O          run with ObjectSpace enabled (reduces performance)
  -X-C          disable all compilation
  -X-CIR        disable all compilation and use IR runtime
  -X+C          force compilation of all scripts before they are run (except eval)
  -X+CIR        force compilation and use IR runtime
  -X+JIR        JIT compilation and use IR runtime
  -Xsubstring?  list options that contain substring in their name
  -Xprefix...   list options that are prefixed with prefix

@chrisseaton
Copy link
Contributor Author

In MRI, -X is an alias of -C - maybe they're referring to that? I might try to move TruffleRuby away from using -X for options because of this.

@headius
Copy link
Member

headius commented Jun 12, 2018

Yeah I know -X is like -C in MRI. I guess I just can't remember when anyone complained that we're using -X. I occasionally forget when switching to MRI but I've never had it accidentally work and do something unexpected.

Funny thing...as far as I can see, -X isn't even documented in ruby --help. Only -C. And -X still takes an argument, so passing a bare -X to CRuby also produces an error.

I think we should make the error/warning consistent, make sure it explains this flag is for JRuby options, and leave it at that.

@chrisseaton
Copy link
Contributor Author

Yes -X is undocumented. I found some others:

https://github.com/oracle/truffleruby/blob/master/doc/user/options.md#unlisted-ruby-switches

For TruffleRuby I've added this warning if it looks like someone is trying to use -X instead of -C:

[ruby] WARNING the -X option supplied also appears to be a directory name - did you intend to use -X like -C?

@headius
Copy link
Member

headius commented Jun 12, 2018

I found some others

I believe we implement all of these except -X and the CRuby-specific instruction dumping.

I've added this warning

Yeah seems prudent.

@chrisseaton
Copy link
Contributor Author

Closing due to inactivity.

@enebo enebo added this to the Invalid or Duplicate milestone Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants