diff options
| author | Markus Reiter | 2017-02-04 23:53:16 +0100 |
|---|---|---|
| committer | GitHub | 2017-02-04 23:53:16 +0100 |
| commit | 33fa80944ebff6b609e67712fb87ccc394cb327b (patch) | |
| tree | fe188fd49cebef15c2a92b1366981655c785f149 /Library/Homebrew/cask/lib | |
| parent | 7c368962c9fc968beb812af9d209da2038c74cfb (diff) | |
| parent | d22cfd3866257abb9c3ade46c6c34f341cf70514 (diff) | |
| download | brew-33fa80944ebff6b609e67712fb87ccc394cb327b.tar.bz2 | |
Merge pull request #1743 from toonetown/robust-pkgutil-cleanup
Delete pkgutil directories that are really files.
Diffstat (limited to 'Library/Homebrew/cask/lib')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/pkg.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/pkg.rb b/Library/Homebrew/cask/lib/hbc/pkg.rb index 2fb634f24..39252b48a 100644 --- a/Library/Homebrew/cask/lib/hbc/pkg.rb +++ b/Library/Homebrew/cask/lib/hbc/pkg.rb @@ -26,6 +26,7 @@ module Hbc _deepest_path_first(pkgutil_bom_dirs).each do |dir| next unless dir.exist? && !MacOS.undeletable?(dir) _with_full_permissions(dir) do + _delete_broken_file_dir(dir) && next _clean_broken_symlinks(dir) _clean_ds_store(dir) _rmdir(dir) @@ -97,6 +98,13 @@ module Hbc end end + # Some pkgs incorrectly report files (generally nibs) + # as directories; we remove these as files instead. + def _delete_broken_file_dir(path) + return unless path.file? && !path.symlink? + @command.run!("/bin/rm", args: ["-f", "--", path], sudo: true) + end + # Some pkgs leave broken symlinks hanging around; we clean them out before # attempting to rmdir to prevent extra cruft from lying around after # uninstall |
