Skip to content

Commit

Permalink
Merge pull request #18040 from Homebrew/dmg-uid
Browse files Browse the repository at this point in the history
  • Loading branch information
carlocab authored Aug 13, 2024
2 parents e1289c1 + 467666c commit b805167
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Library/Homebrew/unpack_strategy/dmg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,10 @@ def extract_to_dir(unpack_dir, basename:, verbose:)

bomfile_path = T.must(bomfile.path)

# Ditto will try to write as the UID, not the EUID and the Tempfile has 0700 permissions.
if Process.euid != Process.uid
FileUtils.chown(nil, Process.gid, bomfile_path)
FileUtils.chmod "g+rw", bomfile_path
end

system_command!("ditto",
args: ["--bom", bomfile_path, "--", path, unpack_dir],
verbose:)
args: ["--bom", bomfile_path, "--", path, unpack_dir],
verbose:,
reset_uid: true)

FileUtils.chmod "u+w", Pathname.glob(unpack_dir/"**/*", File::FNM_DOTMATCH).reject(&:symlink?)
end
Expand Down

0 comments on commit b805167

Please # to comment.