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

UNIX bin scripts don't work for paths with spaces #4959

Closed
scabug opened this issue Sep 1, 2011 · 5 comments
Closed

UNIX bin scripts don't work for paths with spaces #4959

scabug opened this issue Sep 1, 2011 · 5 comments
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Sep 1, 2011

The default scripts in the unix download do not quote classpaths with the result that the scripts will work when installed in a directory such as:

/Users/dan/scala

but fail for:

/All Users/dan/scala

This affects: fsc, scala, scalac, scaladoc and scalap.

The fix in each case is to quote ${CPSELECT}${TOOL_CLASSPATH} - for example:

"${JAVACMD:=java}"
$JAVA_OPTS
"${java_args[@]}"
${CPSELECT}${TOOL_CLASSPATH}
-Dscala.usejavacp=true
-Dscala.home="$SCALA_HOME"
-Denv.emacs="$EMACS"
$CYGWIN_JLINE_TERMINAL
scala.tools.nsc.Main "$@"

should be:

"${JAVACMD:=java}"
$JAVA_OPTS
"${java_args[@]}"
"${CPSELECT}${TOOL_CLASSPATH}"
-Dscala.usejavacp=true
-Dscala.home="$SCALA_HOME"
-Denv.emacs="$EMACS"
$CYGWIN_JLINE_TERMINAL
scala.tools.nsc.Main "$@"

@scabug
Copy link
Author

scabug commented Sep 1, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4959?orig=1
Reporter: Dan Creswell (dancres)
Assignee: @lylek
Affected Versions: 2.9.1

@scabug
Copy link
Author

scabug commented Nov 13, 2011

Commit Message Bot (anonymous) said:
(extempore in r25994) Working on the runners.

Removed assumption that bash is in /bin. Removed --posix option to bash.
Modernized shell constructs: $() instead of ``, [[ ]] instead of [ ].
Added -debug option for all runners which will show you the exact java
command line being run before running it. Added -usebootcp to complement
-nobootcp, and made regular classpath the default on cygwin. Quoted more
things to give us a fighting chance against spaces and parens in paths.

I took the waste-half-a-day step of installing vmware fusion so I could
install windows so I could install cygwin so I could install scala under
cygwin so I could see if it still worked. Seems to. We still desperately
need some way of testing not only everything I'm attempting to address
in this pile of patches but everything which is most likely now regressing.

:javap now sort of works on windows (not for repl-defined classes as yet)
if JAVA_HOME is set such that I can find tools.jar. Closes #4959.
(Risks breaking and) references #2092. References #622 since that
shouldn't be hard to get working.

@scabug
Copy link
Author

scabug commented Feb 5, 2015

@adriaanm said:
Reopened and reassigned based on scala-internals post.

@scabug
Copy link
Author

scabug commented Feb 17, 2015

@adriaanm said:
scala/scala#4335

@scabug scabug closed this as completed Feb 18, 2015
@scabug
Copy link
Author

scabug commented Feb 19, 2015

@lylek said (edited on Feb 19, 2015 7:19:29 AM UTC):
The fix was to get rid of the classpathArgs function and use an array variable instead. The function could only output a string, where it can't be determined which spaces are between arguments and which ones are part of arguments. With the array, each element is an argument, and each argument can contain spaces.

Here's the reason we don't need cmd //c to translate paths for msys: It translates them automatically, on the fly! http://www.mingw.org/wiki/Posix_path_conversion

@scabug scabug added this to the 2.11.6 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant