From bcf8cfc97ce23ae94304cfabef19c7b2febd77bc Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 22 Nov 2018 23:37:57 +0100 Subject: [PATCH] Remove `atomic_write` workaround. --- Library/Homebrew/extend/pathname.rb | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 3a62488aa8..78b3a460a7 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -162,18 +162,8 @@ class Pathname # NOTE: This always overwrites. def atomic_write(content) - # The enclosing `mktmpdir` and the `chmod` are a workaround - # for https://github.com/rails/rails/pull/34037. - Dir.mktmpdir(".d", dirname) do |tmpdir| - should_fix_sticky_bit = dirname.world_writable? && !dirname.sticky? - FileUtils.chmod "+t", dirname if should_fix_sticky_bit - begin - File.atomic_write(self, tmpdir) do |file| - file.write(content) - end - ensure - FileUtils.chmod "-t", dirname if should_fix_sticky_bit - end + File.atomic_write(self) do |file| + file.write(content) end end