Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: sdk/bin/dartanalyzer_developer

Issue 15954011: Ensure proper path traversals for linked commands; (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: This patch set fixes / also handles symlinked directories (e.g. sdk/bin) Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« sdk/bin/dart2js ('K') | « sdk/bin/dartanalyzer ('k') | sdk/bin/dartdoc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/bin/dartanalyzer_developer
diff --git a/sdk/bin/dartanalyzer_developer b/sdk/bin/dartanalyzer_developer
index b522f56902026a1469a2af28b288a8b808eec2f6..3fadd7585c67d269015a8e9bc8b9d6a9d45f0736 100755
--- a/sdk/bin/dartanalyzer_developer
+++ b/sdk/bin/dartanalyzer_developer
@@ -8,21 +8,19 @@
# the testing infrastructure.
set -e
-function follow_links() {
- while [ -h "$1" ]; do
+function link_dir() {
+ a="$1"
+ while [ -h "$a" ]; do
# On Mac OS, readlink -f doesn't work.
- 1="$(readlink "$1")"
+ a="$(readlink "$a")"
done
- echo "$1"
+ # if dir linked, not file, need to follow dir path:
+ echo $(cd $(dirname $a); pwd -P)
}
-# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
-PROG_NAME="$(follow_links "$BASH_SOURCE")"
-
# Handle the case where the binary dir has been symlinked to.
-CUR_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")"
-
-SDK_DIR="$(cd "${CUR_DIR}/.." ; pwd -P)"
+CUR_DIR="$(link_dir "$0")"
+SDK_DIR="${CUR_DIR}%/*"}
if [ -z "$DART_CONFIGURATION" ];
then
« sdk/bin/dart2js ('K') | « sdk/bin/dartanalyzer ('k') | sdk/bin/dartdoc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698