Skip to content

Commit

Permalink
zip: restore extended attributes when under MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
amyspark committed Oct 8, 2018
1 parent 3fd75bb commit 9e43899
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb
Expand Up @@ -2,10 +2,21 @@ module UnpackStrategy
class Zip
prepend Module.new {
def extract_to_dir(unpack_dir, basename:, verbose:)
volumes = super.stderr.chomp
.split("\n")
.map { |l| l[/\A skipping: (.+) volume label\Z/, 1] }
.compact
result = super

volumes = result.stderr.chomp
.split("\n")
.map { |l| l[/\A skipping: (.+) volume label\Z/, 1] }
.compact

if result.stderr.lines.any? { |line| line.start_with?("._") }
# Merge ._ files back into extended attributes.
# ._ files inside volumes are automatically merged by ditto.
system_command!("dot_clean",
args: ["-mv", "--keep=dotbar", unpack_dir],
verbose: verbose,
print_stderr: false)
end

return if volumes.empty?

Expand Down

0 comments on commit 9e43899

Please sign in to comment.