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

2.12.12 regression in Bash: fscbad option: '-Ytrack-dependencies' #12102

Closed
mb73 opened this issue Jul 30, 2020 · 7 comments
Closed

2.12.12 regression in Bash: fscbad option: '-Ytrack-dependencies' #12102

mb73 opened this issue Jul 30, 2020 · 7 comments

Comments

@mb73
Copy link

mb73 commented Jul 30, 2020

reproduction steps

using Scala 2.12.12, running the following file

#!/bin/bash
echo "in Bash"
exec scala "$0" "$@"
!#
object Example {
  def main(args: Array[String]) {
    println("in Scala")
  }
}

problem

should output

in Bash
in Scala

(as it did with Scala 2.12.11 and before) but outputs

in Bash
fscbad option: '-Ytrack-dependencies'
  fsc -help  gives more information
error: IO error while decoding /home/marcus/-Ytrack-dependencies with UTF-8: /home/marcus/-Ytrack-dependencies (No such file or directory)
Please try specifying another one using the -encoding option
error: IO error while decoding /home/marcus/-Xscript with UTF-8: /home/marcus/-Xscript (No such file or directory)
Please try specifying another one using the -encoding option
error: IO error while decoding /home/marcus/Main with UTF-8: /home/marcus/Main (No such file or directory)
Please try specifying another one using the -encoding option
three errors found
@josephw
Copy link

josephw commented Jul 30, 2020

git log v2.12.11..v2.12.12 -S track-dependencies only turns up scala/scala#8861.

@som-snytt
Copy link

The long-standing tradition that boolean flags default to false means that defaulting the new flag to true makes it show up in the fsc command via unparse. Other settings test value != default, but a boolean setting only tests for true.

In any case, it's necessary to exit the background resident compiler when switching foreground runners.

➜  snips scala -version                         
Scala code runner version 2.12.11 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc.
➜  snips ./huh.sh                               
in Bash
in Scala
➜  snips PATH=~/scala-2.12.12/bin:$PATH ./huh.sh
in Bash
fscbad option: '-Ytrack-dependencies'
  fsc -help  gives more information
error: IO error while decoding...
three errors found
➜  snips fsc -shutdown                          
[Compile server exited]
➜  snips PATH=~/scala-2.12.12/bin:$PATH ./huh.sh
in Bash
in Scala

You can tell in this simple test whether the script is actually getting re-compiled, because there will be a delay in output.

@SethTisue
Copy link
Member

SethTisue commented Jul 30, 2020

Note that starting with Scala 2.13.0, -nocompdaemon is the default: scala/scala#6747. And https://github.com/scala/scala/releases/tag/v2.13.0 says "The daemon was not reliable and will likely be removed entirely from a future release"

On 2.12.x, I would suggest explicitly using -nocompdaemon in all scripts.

@som-snytt
Copy link

Another option is to be less scripty and use scalac -d mytool.jar to stick it into a jar, then scala mytool.jar.

@som-snytt
Copy link

We forgot say fixed in ammonite.

@mb73
Copy link
Author

mb73 commented Aug 3, 2020

Thanks. However, I wonder why the daemon is not stopped on uninstalling scala. Sounds like a bug to me.

@SethTisue
Copy link
Member

Yeah, it's a bug. The "fix" is to increasingly disable and discourage use of the daemon at all.

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

4 participants