DescriptionEnsure proper path traversals for linked commands;
These changes involve the bulk of scripted commands in sdk/bin.
Example:
consider: $ ls -s $DART/dart-sdk/bin/dart2js /usr/local/bin/dart2js
Problem:
* old: code would cd to the dirname of $0, and get the linked path to that dir.
- e.g.: BIN_DIR=/usr/local/bin # wrong; want $DART/dart-sdk/bin
* Solution: follow links on $0 (not it's dir); return it's dir, and resolve any remaining links on that;
- additional commentary: (from original code):
-# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
- a simple test shows this to be false (at least on OS/X; no bash documentation supports this claim either);
- while $(source some_script) will return the shell in $0 (not "some_script), these commands end in exec,
and will never be called. $0 is clearer, more direct about intent (as well as more general across shells).
* Problem (e.g. dartanalyzer, dartdoc, pub)
- old code would resolve links to path of command link (but not command itself first);
* Solution: add function / idiom, similar to dart2js;
* Problem (general):
- function follow_links() used illegal variable name on left-hand-side
- e.g. 1=$2 # positional vars cannot be assigned to
- function returned a file-name path, where everywhere a dirname path required
* Solution:
- assign positional parameter to a valid variable name;
- return dir of linked-to-file rather than linked file;
- rename function
BUG=dart:10806
Patch Set 1 #Patch Set 2 : This patch set fixes / also handles symlinked directories (e.g. sdk/bin) #
Total comments: 10
Messages
Total messages: 13 (0 generated)
|