Skip to content

Cannot pass system properties in comand line #14005

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

Closed
acaproni opened this issue Nov 26, 2021 · 6 comments · Fixed by #14073
Closed

Cannot pass system properties in comand line #14005

acaproni opened this issue Nov 26, 2021 · 6 comments · Fixed by #14073

Comments

@acaproni
Copy link

acaproni commented Nov 26, 2021

With scala 3.1.0 (installed from the tar file), it is not possible to pass system properties in the shell command line:

[ias@centos8 ~]$ which scala
/opt/scala3-3.1.0/bin/scala
[ias@centos8 ~]$ scala -version
Scala code runner version 3.1.0 -- Copyright 2002-2021, LAMP/EPFL
[ias@centos8 ~]$ scala -Dprop.name=propValue
bad option '-Dprop.name=propValue' was ignored
Welcome to Scala 3.1.0 (11.0.9.1, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala>
@michelou
Copy link
Contributor

michelou commented Dec 7, 2021

Temporary workaround :

$ scalac -Dprop.name=propValue -repl
Welcome to Scala 3.1.0 (11.0.11, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> util.Properties.propOrNull("prop.name")
val res0: String = propValue

In Alessandro's example argument -Dprop.name=propValue is passed to object dotty.tools.MainGenericRunner (and not to java.exe) in bash script scala; thus it is the responsability of object MainGenericRunner to deal appropriately with that argument.

I guess method def process(...) in object MainGenericRunner needs to be modified.

@acaproni
Copy link
Author

acaproni commented Dec 8, 2021

Thanks for the workaround michelou. REPL was an example. We have the same problem running a scala executable (.jar). This bug forbids us to deploy the scala suite (ias) in production.

@BarkingBad BarkingBad linked a pull request Dec 8, 2021 that will close this issue
@dwijnand dwijnand modified the milestones: 3.1.1, 3.2.0 Dec 13, 2021
@dwijnand
Copy link
Member

With 3.1.1 coming up soon, I'm moving this, because it's not a regression in 3.1.0 and it has a workaround.

@acaproni
Copy link
Author

@dwijnand, thanks for the update.
Ddoes it mean that we have to wait v3.2 to have the fix in production as the workaround upon is for REPL only?

@dwijnand
Copy link
Member

No, it can be part of 3.1.2.

@BarkingBad
Copy link
Contributor

You can do manual fix with replacing the scala bash script at your /usr/bin/scala or wherever you have scala installed with the newer one from here

@Kordyjan Kordyjan modified the milestones: 3.2.0-RC1, 3.1.2 Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants