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.10.0-M3 shell script wrappers do not resolve relative symlinks #5792
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5792?orig=1 |
@paulp said: That means if you do this: cd /tmp You create a bogus symlink, because bash (wildly guessing you're using bash) "helpfully" resolves .. according to the path by which you arrived. It acts as if you're in /tmp/bin, but you're in /private/tmp/bin. To verify this is the problem, try it from /private/tmp instead of /tmp and I think you'll find it works. (At least, I do.) |
@paulp said: |
@blair said: I tried this on my Ubuntu 12.04 system with /tmp being a real directory and I got the same error. Blair |
@paulp said:
|
@blair said: Is local at /local? In that case, I believe the symlink's leading ..'s will go back to / so it'll continue to work. With your current test of the scala symlink, can you cd somewhere deeper and try it, say /usr/share/doc, where ../.. doesn't take you to /. |
@paulp said: |
Peter Vlugter (pvlugter) said: If you take an even more perverse scenario: relative/scala -> ../bin/scala
relative/again/scala -> ../scala with multiple relative symlinks, then the fix in 4cd0253d0d also won't work. Just trying something now that could be better. Will put it in a pull request. |
In MacPorts we install symlinks into $prefix/bin for all the shell scripts. The symlinks are relative, so
scala
is a symlink to ``../share/scala-2.10/bin/` instead of using an absolute symlink (makes it slightly more relocatable.) This works in 2.9 and breaks in 2.10. The 2.10 code works if one is cd'ed into the directory where the symlink resolved, but most times people are not cd'ed into $prefix/bin.This works:
cd /tmp
tar xvfz /opt/local/var/macports/distfiles/scala29/scala-2.9.2.tgz
mkdir bin
cd bin
ln -sf ../scala-2.9.2/bin/scala .
cd /
/tmp/bin/scala
This doesn't work:
cd /tmp
tar xvfz /opt/local/var/macports/distfiles/scala210/scala-2.10.0-M3.tgz
mkdir bin
cd bin
ln -sf ../scala-2.10.0-M3/bin/scala .
cd /
/tmp/bin/scala
Returns
/tmp/bin/scala: line 15: cd: ../scala-2.10.0-M3/bin/..: No such file or directory
Error: Could not find or load main class scala.tools.nsc.MainGenericRunner
I'll change the symlinks in MacPorts to absolute.
The text was updated successfully, but these errors were encountered: