Skip to content

Unable to set classpath via @<argument-file> from dist/bin/scala command line #13552

Closed
@philwalk

Description

@philwalk

Compiler version

Scala code runner version 3.1.0-RC2 -- Copyright 2002-2021, LAMP/EPFL

Minimized command line

The test script, named importTest.sc:

#!/opt/scala3/bin/scala
import better.files._
def main (args: Array[String]): Unit =
  printf("import test\n")
# verify scala version:
philwalk@d5:/opt/ue$ /opt/scala3/bin/scala -version
Scala code runner version 3.1.0-RC2 -- Copyright 2002-2021, LAMP/EPFL

# verify contents of @<argument-file>:
philwalk@d5:/opt/ue$ cat argumentFile.txt
-classpath /opt/uejlib3/better-files_2.13-3.9.1.jar

# verify ability to set -classpath directly:
philwalk@d5:/opt/ue$ /opt/scala3/bin/scala -classpath /opt/uejlib3/better-files_2.13-3.9.1.jar jsrc/importTest.sc
import test

# demonstrate failure when setting classpath via @<argument-file>:
philwalk@d5:/opt/ue$ /opt/scala3/bin/scala @argumentFile.txt jsrc/importTest.sc

Output

-- [E006] Not Found Error: /opt/ue/jsrc/importTest.sc:2:7 ----------------------------------------------------------------------------------
2 |import better.files._
  |       ^^^^^^
  |       Not found: better

longer explanation available when compiling with `-explain`
1 error found
Error: Errors encountered during compilation
philwalk@d5:/opt/ue$ 

Expectation

Should be able to set the -classpath via @argumentFile.txt on the command line, as with previous releases.

Am able to demonstrate the problem in each of the following bash environments:

Linux quadd 5.4.0-81-generic #91~18.04.1-Ubuntu SMP Fri Jul 23 13:36:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Linux d5 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
CYGWIN_NT-10.0 d5 3.2.0(0.340/5/3) 2021-03-29 08:42 x86_64 Cygwin
MSYS_NT-10.0-19042 d5 3.2.0-340.x86_64 2021-07-02 08:36 UTC x86_64 Msys

Seems like this would have been caught by compiler/test/dotty/tools/scripting/BashScriptsTests.scala.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions