From 3d25292ae3da2e8cf7a501c69b331a8d08344c59 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 29 Oct 2012 02:17:11 -0700 Subject: Merge pull request #8027 from daenney/master Atomic.rb assumes it may chown/chmod a file but doesn't handle the EPERM error. Conflicts: activesupport/CHANGELOG.md guides/source/active_support_core_extensions.md --- activesupport/lib/active_support/core_ext/file/atomic.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/core_ext/file/atomic.rb b/activesupport/lib/active_support/core_ext/file/atomic.rb index fc3277f4d2..b0daf6db9e 100644 --- a/activesupport/lib/active_support/core_ext/file/atomic.rb +++ b/activesupport/lib/active_support/core_ext/file/atomic.rb @@ -36,7 +36,12 @@ class File FileUtils.mv(temp_file.path, file_name) # Set correct permissions on new file - chown(old_stat.uid, old_stat.gid, file_name) - chmod(old_stat.mode, file_name) + begin + chown(old_stat.uid, old_stat.gid, file_name) + # This operation will affect filesystem ACL's + chmod(old_stat.mode, file_name) + rescue Errno::EPERM + # Changing file ownership failed, moving on. + end end end -- cgit v1.2.3