diff --git a/Library/Homebrew/cask/lib/hbc/pkg.rb b/Library/Homebrew/cask/lib/hbc/pkg.rb index 497a7b6ddb..39252b48a5 100644 --- a/Library/Homebrew/cask/lib/hbc/pkg.rb +++ b/Library/Homebrew/cask/lib/hbc/pkg.rb @@ -98,8 +98,8 @@ module Hbc end end - # Some pkgs (microsoft office for one) leave files (generally nibs) but - # report them as directories. We remove these as files instead. + # 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) diff --git a/Library/Homebrew/cask/test/cask/pkg_test.rb b/Library/Homebrew/cask/test/cask/pkg_test.rb index b99d49ddd4..a52c90a0e6 100644 --- a/Library/Homebrew/cask/test/cask/pkg_test.rb +++ b/Library/Homebrew/cask/test/cask/pkg_test.rb @@ -68,11 +68,11 @@ describe Hbc::Pkg do fake_dir.must_be :exist? end - it "chokes on directories that are really files" do + it "cleans files incorrectly reported as directories" do pkg = Hbc::Pkg.new("my.fake.pkg", Hbc::NeverSudoSystemCommand) fake_dir = Pathname(Dir.mktmpdir) - fake_file = fake_dir.join("ima_file").tap { |path| FileUtils.touch(path) } + fake_file = fake_dir.join("ima_file_pretending_to_be_a_dir").tap { |path| FileUtils.touch(path) } pkg.stubs(:pkgutil_bom_specials).returns([]) pkg.stubs(:pkgutil_bom_files).returns([])