{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/24902719","id":24902719,"diff_hunk":"@@ -686,19 +686,17 @@ private[spark] object Utils extends Logging {\n       // user has access to them.\n       getYarnLocalDirs(conf).split(\",\")\n     } else {\n-      // In non-Yarn mode (or for the driver in yarn-client mode), we cannot trust the user\n-      // configuration to point to a secure directory. So create a subdirectory with restricted\n-      // permissions under each listed directory.\n       Option(conf.getenv(\"SPARK_LOCAL_DIRS\"))\n         .getOrElse(conf.get(\"spark.local.dir\", System.getProperty(\"java.io.tmpdir\")))\n         .split(\",\")\n         .flatMap { root =>\n           try {\n             val rootDir = new File(root)\n-            if (rootDir.exists || rootDir.mkdirs()) {\n-              val dir = createDirectory(root)\n-              chmod700(dir)\n-              Some(dir.getAbsolutePath)\n+            if (rootDir.exists) {\n+              Some(rootDir.getAbsolutePath)\n+            } else if (rootDir.mkdirs()) {\n+              chmod700(rootDir)","path":"core/src/main/scala/org/apache/spark/util/Utils.scala","position":20,"original_position":20,"commit_id":"c0635f13ce02fbf5920d9a5fb8a312fc16061b55","original_commit_id":"c0635f13ce02fbf5920d9a5fb8a312fc16061b55","user":{"login":"growse","id":378067,"avatar_url":"https://avatars.githubusercontent.com/u/378067?v=3","gravatar_id":"","url":"https://api.github.com/users/growse","html_url":"https://github.com/growse","followers_url":"https://api.github.com/users/growse/followers","following_url":"https://api.github.com/users/growse/following{/other_user}","gists_url":"https://api.github.com/users/growse/gists{/gist_id}","starred_url":"https://api.github.com/users/growse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/growse/subscriptions","organizations_url":"https://api.github.com/users/growse/orgs","repos_url":"https://api.github.com/users/growse/repos","events_url":"https://api.github.com/users/growse/events{/privacy}","received_events_url":"https://api.github.com/users/growse/received_events","type":"User","site_admin":false},"body":"The default value of `spark.local.dir` is `/tmp`, which should exist on all linux systems at least. If I've read the patch right, that means that `getOrCreateLocalRootDirs` will simply return `/tmp`, which is usually readable by everyone. Presumably, the spark worker will then just write a load of stuff into `/tmp`. It seems that the whole purpose of the previous behaviour was to create an isolated directory inside `spark.local.dir`, because it was assumed that this value was a shared directory.\r\n\r\nIs this not desirable behaviour, or have I missed something?","created_at":"2015-02-18T14:11:23Z","updated_at":"2015-02-18T14:11:23Z","html_url":"https://github.com/apache/spark/pull/4620#discussion_r24902719","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/4620","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/24902719"},"html":{"href":"https://github.com/apache/spark/pull/4620#discussion_r24902719"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/4620"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/4620","id":29352656,"html_url":"https://github.com/apache/spark/pull/4620","diff_url":"https://github.com/apache/spark/pull/4620.diff","patch_url":"https://github.com/apache/spark/pull/4620.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/4620","number":4620,"state":"open","locked":false,"title":"[SPARK-5830][Core]Don't create unnecessary directory for local root dir","user":{"login":"Sephiroth-Lin","id":10866770,"avatar_url":"https://avatars.githubusercontent.com/u/10866770?v=3","gravatar_id":"","url":"https://api.github.com/users/Sephiroth-Lin","html_url":"https://github.com/Sephiroth-Lin","followers_url":"https://api.github.com/users/Sephiroth-Lin/followers","following_url":"https://api.github.com/users/Sephiroth-Lin/following{/other_user}","gists_url":"https://api.github.com/users/Sephiroth-Lin/gists{/gist_id}","starred_url":"https://api.github.com/users/Sephiroth-Lin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sephiroth-Lin/subscriptions","organizations_url":"https://api.github.com/users/Sephiroth-Lin/orgs","repos_url":"https://api.github.com/users/Sephiroth-Lin/repos","events_url":"https://api.github.com/users/Sephiroth-Lin/events{/privacy}","received_events_url":"https://api.github.com/users/Sephiroth-Lin/received_events","type":"User","site_admin":false},"body":"Now will create an unnecessary directory for local root directory, and this directory will not be deleted after application exit.\r\nFor example:\r\nbefore will create tmp dir like \"/tmp/spark-UUID\"\r\nnow will create tmp dir like \"/tmp/spark-UUID/spark-UUID\"\r\nso the dir \"/tmp/spark-UUID\" will not be deleted as a local root directory.","created_at":"2015-02-16T06:39:57Z","updated_at":"2015-02-18T14:11:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b8df51410595333d9d95c3794cf225dfc065088","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/4620/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/4620/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments/{number}","comments_url":"https://api.github.com/repos/apache/spark/issues/4620/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/c0635f13ce02fbf5920d9a5fb8a312fc16061b55","head":{"label":"Sephiroth-Lin:SPARK-5830","ref":"SPARK-5830","sha":"c0635f13ce02fbf5920d9a5fb8a312fc16061b55","user":{"login":"Sephiroth-Lin","id":10866770,"avatar_url":"https://avatars.githubusercontent.com/u/10866770?v=3","gravatar_id":"","url":"https://api.github.com/users/Sephiroth-Lin","html_url":"https://github.com/Sephiroth-Lin","followers_url":"https://api.github.com/users/Sephiroth-Lin/followers","following_url":"https://api.github.com/users/Sephiroth-Lin/following{/other_user}","gists_url":"https://api.github.com/users/Sephiroth-Lin/gists{/gist_id}","starred_url":"https://api.github.com/users/Sephiroth-Lin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sephiroth-Lin/subscriptions","organizations_url":"https://api.github.com/users/Sephiroth-Lin/orgs","repos_url":"https://api.github.com/users/Sephiroth-Lin/repos","events_url":"https://api.github.com/users/Sephiroth-Lin/events{/privacy}","received_events_url":"https://api.github.com/users/Sephiroth-Lin/received_events","type":"User","site_admin":false},"repo":{"id":30388176,"name":"spark","full_name":"Sephiroth-Lin/spark","owner":{"login":"Sephiroth-Lin","id":10866770,"avatar_url":"https://avatars.githubusercontent.com/u/10866770?v=3","gravatar_id":"","url":"https://api.github.com/users/Sephiroth-Lin","html_url":"https://github.com/Sephiroth-Lin","followers_url":"https://api.github.com/users/Sephiroth-Lin/followers","following_url":"https://api.github.com/users/Sephiroth-Lin/following{/other_user}","gists_url":"https://api.github.com/users/Sephiroth-Lin/gists{/gist_id}","starred_url":"https://api.github.com/users/Sephiroth-Lin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sephiroth-Lin/subscriptions","organizations_url":"https://api.github.com/users/Sephiroth-Lin/orgs","repos_url":"https://api.github.com/users/Sephiroth-Lin/repos","events_url":"https://api.github.com/users/Sephiroth-Lin/events{/privacy}","received_events_url":"https://api.github.com/users/Sephiroth-Lin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Sephiroth-Lin/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/Sephiroth-Lin/spark","forks_url":"https://api.github.com/repos/Sephiroth-Lin/spark/forks","keys_url":"https://api.github.com/repos/Sephiroth-Lin/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sephiroth-Lin/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sephiroth-Lin/spark/teams","hooks_url":"https://api.github.com/repos/Sephiroth-Lin/spark/hooks","issue_events_url":"https://api.github.com/repos/Sephiroth-Lin/spark/issues/events{/number}","events_url":"https://api.github.com/repos/Sephiroth-Lin/spark/events","assignees_url":"https://api.github.com/repos/Sephiroth-Lin/spark/assignees{/user}","branches_url":"https://api.github.com/repos/Sephiroth-Lin/spark/branches{/branch}","tags_url":"https://api.github.com/repos/Sephiroth-Lin/spark/tags","blobs_url":"https://api.github.com/repos/Sephiroth-Lin/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sephiroth-Lin/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sephiroth-Lin/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sephiroth-Lin/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sephiroth-Lin/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/Sephiroth-Lin/spark/languages","stargazers_url":"https://api.github.com/repos/Sephiroth-Lin/spark/stargazers","contributors_url":"https://api.github.com/repos/Sephiroth-Lin/spark/contributors","subscribers_url":"https://api.github.com/repos/Sephiroth-Lin/spark/subscribers","subscription_url":"https://api.github.com/repos/Sephiroth-Lin/spark/subscription","commits_url":"https://api.github.com/repos/Sephiroth-Lin/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sephiroth-Lin/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sephiroth-Lin/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sephiroth-Lin/spark/issues/comments/{number}","contents_url":"https://api.github.com/repos/Sephiroth-Lin/spark/contents/{+path}","compare_url":"https://api.github.com/repos/Sephiroth-Lin/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sephiroth-Lin/spark/merges","archive_url":"https://api.github.com/repos/Sephiroth-Lin/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sephiroth-Lin/spark/downloads","issues_url":"https://api.github.com/repos/Sephiroth-Lin/spark/issues{/number}","pulls_url":"https://api.github.com/repos/Sephiroth-Lin/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/Sephiroth-Lin/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/Sephiroth-Lin/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sephiroth-Lin/spark/labels{/name}","releases_url":"https://api.github.com/repos/Sephiroth-Lin/spark/releases{/id}","created_at":"2015-02-06T01:20:43Z","updated_at":"2015-02-06T01:21:00Z","pushed_at":"2015-02-17T08:13:10Z","git_url":"git://github.com/Sephiroth-Lin/spark.git","ssh_url":"git@github.com:Sephiroth-Lin/spark.git","clone_url":"https://github.com/Sephiroth-Lin/spark.git","svn_url":"https://github.com/Sephiroth-Lin/spark","homepage":null,"size":91772,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"c78a12c4cc4d4312c4ee1069d3b218882d32d678","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments/{number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-02-18T14:02:21Z","pushed_at":"2015-02-18T12:20:30Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":1301703,"stargazers_count":2917,"watchers_count":2917,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2543,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":267,"forks":2543,"open_issues":267,"watchers":2917,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/4620"},"html":{"href":"https://github.com/apache/spark/pull/4620"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/4620"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/4620/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/4620/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/4620/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/c0635f13ce02fbf5920d9a5fb8a312fc16061b55"}}}}