FS#37632 - [dart] 0.8.7.0-1 symlink breaks pub

Attached to Project: Community Packages
Opened by Michael Gerhaeuser (migerh) - Monday, 04 November 2013, 11:12 GMT
Last edited by Alexander F. Rødseth (xyproto) - Monday, 04 November 2013, 12:09 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Alexander F. Rødseth (xyproto)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The symlink /usr/bin/pub -> /opt/dart/dart-sdk/bin/pub breaks pub:

/usr/bin/pub: line 42: /usr/../out/ReleaseIA32/dart-sdk/bin/dart: No such file or directory


Using /opt/dart/dart-sdk/bin/pub directly works. The patch included in the AUR package resolves this issue as well (pub.patch in the package .tar.gz):

<code diff>
--- src/dart-sdk/bin/pub 2013-10-22 05:51:13.000000000 -0600
+++ pub 2013-10-28 11:28:17.924039151 -0600
@@ -9,7 +9,13 @@
# Setting BIN_DIR this way is ugly, but is needed to handle the case where
# dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work
# with this case.
-BIN_DIR="$(cd "${0%/*}" ; pwd -P)"
+_source="${BASH_SOURCE[0]}"
+while [ -h "$_source" ]; do # resolve $_source until the file is no longer a symlink
+ BIN_DIR="$( cd -P "$( dirname "$_source" )" && pwd )"
+ _source="$(readlink "$_source")"
+ [[ $_source != /* ]] && _source="$BIN_DIR/$_source" # if $_source was a relative symlink, we need to resolve it relative to the path where the symlink file was located
+done
+BIN_DIR="$( cd -P "$( dirname "$_source" )" && pwd )"
SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"

SNAPSHOT="$BIN_DIR/snapshots/pub.dart.snapshot"
@@ -40,4 +46,4 @@
PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart"

exec "$DART" "--package-root=$PACKAGES_DIR" "$PUB" "$@"
-fi
\ No newline at end of file
+fi
</code>

All the other commands (dart, dart2js, dartanalyzer, dartdoc) seem to work.
This task depends upon

Closed by  Alexander F. Rødseth (xyproto)
Monday, 04 November 2013, 12:09 GMT
Reason for closing:  Fixed
Comment by Alexander F. Rødseth (xyproto) - Monday, 04 November 2013, 11:30 GMT
Hi, thanks for reporting. I'll look at this right away.
Comment by Alexander F. Rødseth (xyproto) - Monday, 04 November 2013, 12:09 GMT
Fixed and tested the pub script. The updated package should appear in [community] shortly.

Loading...