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

Issue 15954011: Ensure proper path traversals for linked commands; (Closed)

Created:
7 years, 6 months ago by yarkot1
Modified:
5 years, 10 months ago
Reviewers:
nweiz, ahe, kasperl
CC:
reviews_dartlang.org, nweiz
Visibility:
Public.

Description

Ensure 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
Unified diffs Side-by-side diffs Delta from patch set Stats (+50 lines, -26 lines) Patch
M sdk/bin/dart2js View 1 1 chunk +8 lines, -11 lines 10 comments Download
M sdk/bin/dartanalyzer View 1 1 chunk +12 lines, -2 lines 0 comments Download
M sdk/bin/dartanalyzer_developer View 1 1 chunk +8 lines, -10 lines 0 comments Download
M sdk/bin/dartdoc View 1 1 chunk +10 lines, -1 line 0 comments Download
M sdk/bin/pub View 1 1 chunk +12 lines, -2 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
ahe
I don't think this handles the case where someone has made a symlink to sdk/bin. ...
7 years, 6 months ago (2013-05-29 05:29:10 UTC) #1
yarkot1
On 2013/05/29 05:29:10, ahe wrote: > I don't think this handles the case where someone ...
7 years, 6 months ago (2013-05-29 22:22:27 UTC) #2
yarkot1
On 2013/05/29 22:22:27, yarkot1 wrote: > On 2013/05/29 05:29:10, ahe wrote: > > I don't ...
7 years, 6 months ago (2013-05-30 00:09:03 UTC) #3
yarkot1
On 2013/05/30 00:09:03, yarkot1 wrote: > On 2013/05/29 22:22:27, yarkot1 wrote: > > On 2013/05/29 ...
7 years, 6 months ago (2013-05-30 05:05:16 UTC) #4
ahe
I don't understand most of the changes made to the dart2js script. As far as ...
7 years, 6 months ago (2013-05-30 10:00:19 UTC) #5
yarkot1
On 2013/05/30 10:00:19, ahe wrote: > I don't understand most of the changes made to ...
7 years, 6 months ago (2013-05-31 04:39:50 UTC) #6
ahe
On 2013/05/31 04:39:50, yarkot1 wrote: > To help this along, I am in the process ...
7 years, 6 months ago (2013-05-31 07:57:36 UTC) #7
ahe
Turns out that Nathan is working on something similar, see: https://codereview.chromium.org/15362003/ It would be great ...
7 years, 6 months ago (2013-05-31 07:58:50 UTC) #8
nweiz
https://codereview.chromium.org/15954011/diff/5001/sdk/bin/dart2js File sdk/bin/dart2js (right): https://codereview.chromium.org/15954011/diff/5001/sdk/bin/dart2js#newcode15 sdk/bin/dart2js:15: # Handle the case where dart-sdk/bin has been symlinked ...
7 years, 6 months ago (2013-05-31 19:35:21 UTC) #9
yarkot1
https://codereview.chromium.org/15954011/diff/5001/sdk/bin/dart2js File sdk/bin/dart2js (right): https://codereview.chromium.org/15954011/diff/5001/sdk/bin/dart2js#newcode11 sdk/bin/dart2js:11: # if dir linked, not file, need to follow ...
7 years, 6 months ago (2013-05-31 22:22:17 UTC) #10
ahe
https://codereview.chromium.org/15954011/diff/5001/sdk/bin/dart2js File sdk/bin/dart2js (right): https://codereview.chromium.org/15954011/diff/5001/sdk/bin/dart2js#newcode11 sdk/bin/dart2js:11: # if dir linked, not file, need to follow ...
7 years, 6 months ago (2013-06-03 10:29:01 UTC) #11
kasperl
Just found this review still sitting around. How far are we from being able to ...
7 years ago (2013-11-28 10:02:03 UTC) #12
kasperl
7 years ago (2013-11-28 10:31:22 UTC) #13
Looks like the main problem this is addressing may have been fixed in
https://codereview.chromium.org/68503004/. Are there any of the changes in this
"issue" that we should still try to get submitted?

Powered by Google App Engine
This is Rietveld 408576698