Skip to content
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

[SPARK-5434] [EC2] Preserve spaces in EC2 path #4224

Closed
wants to merge 1 commit into from

Conversation

nchammas
Copy link
Contributor

Fixes SPARK-5434.

Simple demonstration of the problem and the fix:

$ spacey_path="/path/with some/spaces"
$ dirname $spacey_path
usage: dirname path
$ echo $?
1
$ dirname "$spacey_path"
/path/with some
$ echo $?
0

@nchammas
Copy link
Contributor Author

cc @JoshRosen @shivaram

A minor issue, but we might want to backport this. Shall I create a JIRA?

@SparkQA
Copy link

SparkQA commented Jan 27, 2015

Test build #26169 has started for PR 4224 at commit 960711a.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Jan 27, 2015

Test build #26169 has finished for PR 4224 at commit 960711a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/26169/
Test PASSed.

@shivaram
Copy link
Contributor

LGTM. Would be good to create a JIRA especially if we want to backport. @JoshRosen might have more ideas on backporting

@nchammas nchammas changed the title [EC2] Preserve spaces in EC2 path [SPARK-5434] [EC2] Preserve spaces in EC2 path Jan 27, 2015
@@ -20,6 +20,6 @@

# Preserve the user's CWD so that relative paths are passed correctly to
#+ the underlying Python script.
SPARK_EC2_DIR="$(dirname $0)"
SPARK_EC2_DIR="$(dirname "$0")"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jw - what does it mean to nest quotes inside of other quotes like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$() invokes a subshell, so the quotes inside the subshell are processed independently of those outside.

So here we're making sure dirname gets exactly 1 argument by quoting the $0, in case the value of $0 has spaces.

Then, we're making sure the output of dirname in turn is captured as 1 argument when passed to SPARK_EC2_DIR by quoting the whole subshell, in case that output has spaces.

Welcome to the most deceptive feature of Bash: Word Splitting.

@nchammas
Copy link
Contributor Author

@shivaram JIRA created.

@andrewor14
Copy link
Contributor

Ok I'm merging this into master and marking it as backport needed (since we're in the middle of a 1.2.1 release)

@asfgit asfgit closed this in d44ee43 Jan 28, 2015
@nchammas nchammas deleted the patch-1 branch January 28, 2015 21:01
asfgit pushed a commit that referenced this pull request Feb 27, 2015
Fixes [SPARK-5434](https://issues.apache.org/jira/browse/SPARK-5434).

Simple demonstration of the problem and the fix:

```
$ spacey_path="/path/with some/spaces"
$ dirname $spacey_path
usage: dirname path
$ echo $?
1
$ dirname "$spacey_path"
/path/with some
$ echo $?
0
```

Author: Nicholas Chammas <nicholas.chammas@gmail.com>

Closes #4224 from nchammas/patch-1 and squashes the following commits:

960711a [Nicholas Chammas] [EC2] Preserve spaces in EC2 path
@srowen
Copy link
Member

srowen commented Feb 27, 2015

I backported this to 1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants