{"action":"created","comment":{"url":"https://api.github.com/repos/Homebrew/brew/pulls/comments/83541001","pull_request_review_id":4380306,"id":83541001,"diff_hunk":"@@ -13,32 +13,32 @@ def migrate_caskroom_from_repo_to_prefix\n         FileUtils.mv repo_caskroom, Hbc.caskroom\n       else\n         opoo \"#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom.\"\n-        system \"/usr/bin/sudo\", \"--\", \"/bin/mv\", \"--\", repo_caskroom.to_s, Hbc.caskroom.parent.to_s\n+        command \"/bin/mv\", repo_caskroom, Hbc.caskroom.parent, :use_sudo => true\n       end\n     end\n \n     def ensure_caskroom_exists\n       return if Hbc.caskroom.exist?\n \n       ohai \"Creating Caskroom at #{Hbc.caskroom}\"\n-      if Hbc.caskroom.parent.writable?\n-        Hbc.caskroom.mkpath\n-      else\n-        ohai \"We'll set permissions properly so we won't need sudo in the future\"\n-        toplevel_dir = Hbc.caskroom\n-        toplevel_dir = toplevel_dir.parent until toplevel_dir.parent.root?\n-        unless toplevel_dir.directory?\n-          # If a toplevel dir such as '/opt' must be created, enforce standard permissions.\n-          # sudo in system is rude.\n-          system \"/usr/bin/sudo\", \"--\", \"/bin/mkdir\", \"--\",         toplevel_dir\n-          system \"/usr/bin/sudo\", \"--\", \"/bin/chmod\", \"--\", \"0775\", toplevel_dir\n-        end\n-        # sudo in system is rude.\n-        system \"/usr/bin/sudo\", \"--\", \"/bin/mkdir\", \"-p\", \"--\", Hbc.caskroom\n-        unless Hbc.caskroom.parent == toplevel_dir\n-          system \"/usr/bin/sudo\", \"--\", \"/usr/sbin/chown\", \"-R\", \"--\", \"#{Utils.current_user}:staff\", Hbc.caskroom.parent.to_s\n-        end\n+      ohai \"We'll set permissions properly so we won't need sudo in the future\"\n+      use_sudo = !Hbc.caskroom.parent.writable?\n+\n+      command \"/bin/mkdir\", \"-p\", Hbc.caskroom, :use_sudo => use_sudo\n+      command \"/bin/chmod\", \"g+rwx\", Hbc.caskroom, :use_sudo => use_sudo\n+      command \"/usr/sbin/chown\", Utils.current_user, Hbc.caskroom, :use_sudo => use_sudo\n+      command \"/usr/bin/chgrp\", \"admin\", Hbc.caskroom, :use_sudo => use_sudo\n+    end\n+\n+    def command(*args)","path":"Library/Homebrew/cask/lib/hbc/caskroom.rb","position":39,"original_position":39,"commit_id":"d51cd15e0c748d1b2a35f6327a131622b6ee48b7","original_commit_id":"d51cd15e0c748d1b2a35f6327a131622b6ee48b7","user":{"login":"niw","id":13096,"avatar_url":"https://avatars.githubusercontent.com/u/13096?v=3","gravatar_id":"","url":"https://api.github.com/users/niw","html_url":"https://github.com/niw","followers_url":"https://api.github.com/users/niw/followers","following_url":"https://api.github.com/users/niw/following{/other_user}","gists_url":"https://api.github.com/users/niw/gists{/gist_id}","starred_url":"https://api.github.com/users/niw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niw/subscriptions","organizations_url":"https://api.github.com/users/niw/orgs","repos_url":"https://api.github.com/users/niw/repos","events_url":"https://api.github.com/users/niw/events{/privacy}","received_events_url":"https://api.github.com/users/niw/received_events","type":"User","site_admin":false},"body":"Ah, there is that. Sure!","created_at":"2016-10-15T21:58:05Z","updated_at":"2016-10-15T21:58:05Z","html_url":"https://github.com/Homebrew/brew/pull/1252#discussion_r83541001","pull_request_url":"https://api.github.com/repos/Homebrew/brew/pulls/1252","_links":{"self":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/comments/83541001"},"html":{"href":"https://github.com/Homebrew/brew/pull/1252#discussion_r83541001"},"pull_request":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/1252"}}},"pull_request":{"url":"https://api.github.com/repos/Homebrew/brew/pulls/1252","id":88593751,"html_url":"https://github.com/Homebrew/brew/pull/1252","diff_url":"https://github.com/Homebrew/brew/pull/1252.diff","patch_url":"https://github.com/Homebrew/brew/pull/1252.patch","issue_url":"https://api.github.com/repos/Homebrew/brew/issues/1252","number":1252,"state":"open","locked":false,"title":"FIX: cask changes /usr/local ownership recursively","user":{"login":"niw","id":13096,"avatar_url":"https://avatars.githubusercontent.com/u/13096?v=3","gravatar_id":"","url":"https://api.github.com/users/niw","html_url":"https://github.com/niw","followers_url":"https://api.github.com/users/niw/followers","following_url":"https://api.github.com/users/niw/following{/other_user}","gists_url":"https://api.github.com/users/niw/gists{/gist_id}","starred_url":"https://api.github.com/users/niw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niw/subscriptions","organizations_url":"https://api.github.com/users/niw/orgs","repos_url":"https://api.github.com/users/niw/repos","events_url":"https://api.github.com/users/niw/events{/privacy}","received_events_url":"https://api.github.com/users/niw/received_events","type":"User","site_admin":false},"body":"**Problems**\r\n\r\nRelatively old code in `Hbc::Caskroom` recursively changes the ownership\r\nof the directory where the `Caskroom` directory exists, that changes\r\nentire files in `/usr/local` to `user:staff` if Homebrew setup with default\r\nconfiguration.\r\n\r\nThis is really dangerous because it's easy to trigger (just simply type\r\n`brew cask something` by following some installation documentation.)\r\n\r\n**Solution**\r\n\r\nThis patch removes entire `chown` with `-R` option and make the logic\r\nsimply creating `Caskroom` directory with default Homebrew directories\r\nownership and permission.","created_at":"2016-10-09T20:39:47Z","updated_at":"2016-10-15T21:58:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d77ec40b57b8de2bcc3d37f668bd08d23ec23c31","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Homebrew/brew/pulls/1252/commits","review_comments_url":"https://api.github.com/repos/Homebrew/brew/pulls/1252/comments","review_comment_url":"https://api.github.com/repos/Homebrew/brew/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Homebrew/brew/issues/1252/comments","statuses_url":"https://api.github.com/repos/Homebrew/brew/statuses/d51cd15e0c748d1b2a35f6327a131622b6ee48b7","head":{"label":"niw:fix_cask_command_changes_entire_directory_ownership","ref":"fix_cask_command_changes_entire_directory_ownership","sha":"d51cd15e0c748d1b2a35f6327a131622b6ee48b7","user":{"login":"niw","id":13096,"avatar_url":"https://avatars.githubusercontent.com/u/13096?v=3","gravatar_id":"","url":"https://api.github.com/users/niw","html_url":"https://github.com/niw","followers_url":"https://api.github.com/users/niw/followers","following_url":"https://api.github.com/users/niw/following{/other_user}","gists_url":"https://api.github.com/users/niw/gists{/gist_id}","starred_url":"https://api.github.com/users/niw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niw/subscriptions","organizations_url":"https://api.github.com/users/niw/orgs","repos_url":"https://api.github.com/users/niw/repos","events_url":"https://api.github.com/users/niw/events{/privacy}","received_events_url":"https://api.github.com/users/niw/received_events","type":"User","site_admin":false},"repo":{"id":70428441,"name":"brew","full_name":"niw/brew","owner":{"login":"niw","id":13096,"avatar_url":"https://avatars.githubusercontent.com/u/13096?v=3","gravatar_id":"","url":"https://api.github.com/users/niw","html_url":"https://github.com/niw","followers_url":"https://api.github.com/users/niw/followers","following_url":"https://api.github.com/users/niw/following{/other_user}","gists_url":"https://api.github.com/users/niw/gists{/gist_id}","starred_url":"https://api.github.com/users/niw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niw/subscriptions","organizations_url":"https://api.github.com/users/niw/orgs","repos_url":"https://api.github.com/users/niw/repos","events_url":"https://api.github.com/users/niw/events{/privacy}","received_events_url":"https://api.github.com/users/niw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/niw/brew","description":":beer: The missing package manager for macOS","fork":true,"url":"https://api.github.com/repos/niw/brew","forks_url":"https://api.github.com/repos/niw/brew/forks","keys_url":"https://api.github.com/repos/niw/brew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/niw/brew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/niw/brew/teams","hooks_url":"https://api.github.com/repos/niw/brew/hooks","issue_events_url":"https://api.github.com/repos/niw/brew/issues/events{/number}","events_url":"https://api.github.com/repos/niw/brew/events","assignees_url":"https://api.github.com/repos/niw/brew/assignees{/user}","branches_url":"https://api.github.com/repos/niw/brew/branches{/branch}","tags_url":"https://api.github.com/repos/niw/brew/tags","blobs_url":"https://api.github.com/repos/niw/brew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/niw/brew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/niw/brew/git/refs{/sha}","trees_url":"https://api.github.com/repos/niw/brew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/niw/brew/statuses/{sha}","languages_url":"https://api.github.com/repos/niw/brew/languages","stargazers_url":"https://api.github.com/repos/niw/brew/stargazers","contributors_url":"https://api.github.com/repos/niw/brew/contributors","subscribers_url":"https://api.github.com/repos/niw/brew/subscribers","subscription_url":"https://api.github.com/repos/niw/brew/subscription","commits_url":"https://api.github.com/repos/niw/brew/commits{/sha}","git_commits_url":"https://api.github.com/repos/niw/brew/git/commits{/sha}","comments_url":"https://api.github.com/repos/niw/brew/comments{/number}","issue_comment_url":"https://api.github.com/repos/niw/brew/issues/comments{/number}","contents_url":"https://api.github.com/repos/niw/brew/contents/{+path}","compare_url":"https://api.github.com/repos/niw/brew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/niw/brew/merges","archive_url":"https://api.github.com/repos/niw/brew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/niw/brew/downloads","issues_url":"https://api.github.com/repos/niw/brew/issues{/number}","pulls_url":"https://api.github.com/repos/niw/brew/pulls{/number}","milestones_url":"https://api.github.com/repos/niw/brew/milestones{/number}","notifications_url":"https://api.github.com/repos/niw/brew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/niw/brew/labels{/name}","releases_url":"https://api.github.com/repos/niw/brew/releases{/id}","deployments_url":"https://api.github.com/repos/niw/brew/deployments","created_at":"2016-10-09T20:26:21Z","updated_at":"2016-10-09T20:26:23Z","pushed_at":"2016-10-10T18:17:51Z","git_url":"git://github.com/niw/brew.git","ssh_url":"git@github.com:niw/brew.git","clone_url":"https://github.com/niw/brew.git","svn_url":"https://github.com/niw/brew","homepage":"http://brew.sh","size":17188,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"Homebrew:master","ref":"master","sha":"0546d90e3dbdae30407e5256d680be5ed5f5f000","user":{"login":"Homebrew","id":1503512,"avatar_url":"https://avatars.githubusercontent.com/u/1503512?v=3","gravatar_id":"","url":"https://api.github.com/users/Homebrew","html_url":"https://github.com/Homebrew","followers_url":"https://api.github.com/users/Homebrew/followers","following_url":"https://api.github.com/users/Homebrew/following{/other_user}","gists_url":"https://api.github.com/users/Homebrew/gists{/gist_id}","starred_url":"https://api.github.com/users/Homebrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Homebrew/subscriptions","organizations_url":"https://api.github.com/users/Homebrew/orgs","repos_url":"https://api.github.com/users/Homebrew/repos","events_url":"https://api.github.com/users/Homebrew/events{/privacy}","received_events_url":"https://api.github.com/users/Homebrew/received_events","type":"Organization","site_admin":false},"repo":{"id":53238813,"name":"brew","full_name":"Homebrew/brew","owner":{"login":"Homebrew","id":1503512,"avatar_url":"https://avatars.githubusercontent.com/u/1503512?v=3","gravatar_id":"","url":"https://api.github.com/users/Homebrew","html_url":"https://github.com/Homebrew","followers_url":"https://api.github.com/users/Homebrew/followers","following_url":"https://api.github.com/users/Homebrew/following{/other_user}","gists_url":"https://api.github.com/users/Homebrew/gists{/gist_id}","starred_url":"https://api.github.com/users/Homebrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Homebrew/subscriptions","organizations_url":"https://api.github.com/users/Homebrew/orgs","repos_url":"https://api.github.com/users/Homebrew/repos","events_url":"https://api.github.com/users/Homebrew/events{/privacy}","received_events_url":"https://api.github.com/users/Homebrew/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Homebrew/brew","description":":beer: The missing package manager for macOS","fork":false,"url":"https://api.github.com/repos/Homebrew/brew","forks_url":"https://api.github.com/repos/Homebrew/brew/forks","keys_url":"https://api.github.com/repos/Homebrew/brew/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Homebrew/brew/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Homebrew/brew/teams","hooks_url":"https://api.github.com/repos/Homebrew/brew/hooks","issue_events_url":"https://api.github.com/repos/Homebrew/brew/issues/events{/number}","events_url":"https://api.github.com/repos/Homebrew/brew/events","assignees_url":"https://api.github.com/repos/Homebrew/brew/assignees{/user}","branches_url":"https://api.github.com/repos/Homebrew/brew/branches{/branch}","tags_url":"https://api.github.com/repos/Homebrew/brew/tags","blobs_url":"https://api.github.com/repos/Homebrew/brew/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Homebrew/brew/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Homebrew/brew/git/refs{/sha}","trees_url":"https://api.github.com/repos/Homebrew/brew/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Homebrew/brew/statuses/{sha}","languages_url":"https://api.github.com/repos/Homebrew/brew/languages","stargazers_url":"https://api.github.com/repos/Homebrew/brew/stargazers","contributors_url":"https://api.github.com/repos/Homebrew/brew/contributors","subscribers_url":"https://api.github.com/repos/Homebrew/brew/subscribers","subscription_url":"https://api.github.com/repos/Homebrew/brew/subscription","commits_url":"https://api.github.com/repos/Homebrew/brew/commits{/sha}","git_commits_url":"https://api.github.com/repos/Homebrew/brew/git/commits{/sha}","comments_url":"https://api.github.com/repos/Homebrew/brew/comments{/number}","issue_comment_url":"https://api.github.com/repos/Homebrew/brew/issues/comments{/number}","contents_url":"https://api.github.com/repos/Homebrew/brew/contents/{+path}","compare_url":"https://api.github.com/repos/Homebrew/brew/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Homebrew/brew/merges","archive_url":"https://api.github.com/repos/Homebrew/brew/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Homebrew/brew/downloads","issues_url":"https://api.github.com/repos/Homebrew/brew/issues{/number}","pulls_url":"https://api.github.com/repos/Homebrew/brew/pulls{/number}","milestones_url":"https://api.github.com/repos/Homebrew/brew/milestones{/number}","notifications_url":"https://api.github.com/repos/Homebrew/brew/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Homebrew/brew/labels{/name}","releases_url":"https://api.github.com/repos/Homebrew/brew/releases{/id}","deployments_url":"https://api.github.com/repos/Homebrew/brew/deployments","created_at":"2016-03-06T05:08:38Z","updated_at":"2016-10-15T21:30:20Z","pushed_at":"2016-10-15T16:52:55Z","git_url":"git://github.com/Homebrew/brew.git","ssh_url":"git@github.com:Homebrew/brew.git","clone_url":"https://github.com/Homebrew/brew.git","svn_url":"https://github.com/Homebrew/brew","homepage":"http://brew.sh","size":18113,"stargazers_count":4052,"watchers_count":4052,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1109,"mirror_url":null,"open_issues_count":38,"forks":1109,"open_issues":38,"watchers":4052,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/1252"},"html":{"href":"https://github.com/Homebrew/brew/pull/1252"},"issue":{"href":"https://api.github.com/repos/Homebrew/brew/issues/1252"},"comments":{"href":"https://api.github.com/repos/Homebrew/brew/issues/1252/comments"},"review_comments":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/1252/comments"},"review_comment":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Homebrew/brew/pulls/1252/commits"},"statuses":{"href":"https://api.github.com/repos/Homebrew/brew/statuses/d51cd15e0c748d1b2a35f6327a131622b6ee48b7"}}}}
{"actor":{"display_login":"niw"}}