{"action":"created","issue":{"url":"https://api.github.com/repos/Homebrew/homebrew/issues/45174","labels_url":"https://api.github.com/repos/Homebrew/homebrew/issues/45174/labels{/name}","comments_url":"https://api.github.com/repos/Homebrew/homebrew/issues/45174/comments","events_url":"https://api.github.com/repos/Homebrew/homebrew/issues/45174/events","html_url":"https://github.com/Homebrew/homebrew/pull/45174","id":112295526,"number":45174,"title":"unlinkapps: avoid deleting too many symlinks","user":{"login":"UniqMartin","id":11892150,"avatar_url":"https://avatars.githubusercontent.com/u/11892150?v=3","gravatar_id":"","url":"https://api.github.com/users/UniqMartin","html_url":"https://github.com/UniqMartin","followers_url":"https://api.github.com/users/UniqMartin/followers","following_url":"https://api.github.com/users/UniqMartin/following{/other_user}","gists_url":"https://api.github.com/users/UniqMartin/gists{/gist_id}","starred_url":"https://api.github.com/users/UniqMartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UniqMartin/subscriptions","organizations_url":"https://api.github.com/users/UniqMartin/orgs","repos_url":"https://api.github.com/users/UniqMartin/repos","events_url":"https://api.github.com/users/UniqMartin/events{/privacy}","received_events_url":"https://api.github.com/users/UniqMartin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-20T06:20:00Z","updated_at":"2015-10-20T07:44:29Z","closed_at":"2015-10-20T07:40:42Z","pull_request":{"url":"https://api.github.com/repos/Homebrew/homebrew/pulls/45174","html_url":"https://github.com/Homebrew/homebrew/pull/45174","diff_url":"https://github.com/Homebrew/homebrew/pull/45174.diff","patch_url":"https://github.com/Homebrew/homebrew/pull/45174.patch"},"body":"Use `start_with?` to make sure the symlink actually points into one of the Homebrew directories (depending on given arguments). Previously, only a substring match was used, which would also remove a symlink to a hypothetical `/opt/unrelated/usr/local/opt/Unrelated.app`. Even if unlikely to occur, altering stuff unrelated to Homebrew is bad.\r\n\r\nFurthermore, make sure to always use a trailing slash with directories. Otherwise, e.g., `brew unlinkapps qt` will unlink .app bundles of both `qt` and `qt5` if both are installed and `brew linkapps qt qt5` was issued before. (Please ignore that `qt` and `qt5` offer a conflicting set of .app bundles. This will have to be addressed elsewhere.)"},"comment":{"url":"https://api.github.com/repos/Homebrew/homebrew/issues/comments/149465000","html_url":"https://github.com/Homebrew/homebrew/pull/45174#issuecomment-149465000","issue_url":"https://api.github.com/repos/Homebrew/homebrew/issues/45174","id":149465000,"user":{"login":"UniqMartin","id":11892150,"avatar_url":"https://avatars.githubusercontent.com/u/11892150?v=3","gravatar_id":"","url":"https://api.github.com/users/UniqMartin","html_url":"https://github.com/UniqMartin","followers_url":"https://api.github.com/users/UniqMartin/followers","following_url":"https://api.github.com/users/UniqMartin/following{/other_user}","gists_url":"https://api.github.com/users/UniqMartin/gists{/gist_id}","starred_url":"https://api.github.com/users/UniqMartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UniqMartin/subscriptions","organizations_url":"https://api.github.com/users/UniqMartin/orgs","repos_url":"https://api.github.com/users/UniqMartin/repos","events_url":"https://api.github.com/users/UniqMartin/events{/privacy}","received_events_url":"https://api.github.com/users/UniqMartin/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T07:44:29Z","updated_at":"2015-10-20T07:44:29Z","body":"I'll have a look at #45165. No promises though …\r\n\r\nThose `linkapps` and `unlinkapps` fixes were never intended. They were born as a byproduct while working on something completely different. :wink:"}}