diff --git a/Library/Homebrew/unpack_strategy/dmg.rb b/Library/Homebrew/unpack_strategy/dmg.rb
index 970811bd5ceb52c54d59635fdd43744b95936200..b8395ddef5a0c901c6c756d01c5381372759e6fc 100644
--- a/Library/Homebrew/unpack_strategy/dmg.rb
+++ b/Library/Homebrew/unpack_strategy/dmg.rb
@@ -106,9 +106,18 @@ module UnpackStrategy
                                    args:    ["--bom", bomfile.path, "--", path, unpack_dir],
                                    verbose: verbose
 
-          odebug "BOM contents:", bom
           if result.stderr.include?("contains no files, nothing copied")
-            odebug "Directory contents:", Pathname.glob(path/"**/*", File::FNM_DOTMATCH).map(&:to_s).join("\n")
+            all_paths_find = system_command("find", args: [".", "-print0"], chdir: path, print_stderr: false)
+                             .stdout
+                             .split("\0")
+
+            all_paths_ruby = Pathname.glob(path/"**/*", File::FNM_DOTMATCH)
+                                     .map { |p| p.relative_path_from(path).to_s }
+
+            odebug "BOM contents:", bom
+            odebug "BOM contents (retry):", path.bom
+            odebug "Directory contents (find):", all_paths_find.join("\n")
+            odebug "Directory contents (Ruby):", all_paths_ruby.join("\n")
           end
 
           FileUtils.chmod "u+w", Pathname.glob(unpack_dir/"**/*", File::FNM_DOTMATCH).reject(&:symlink?)