diff options
author | Xavier Noria <fxn@hashref.com> | 2012-10-29 02:17:11 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-08 20:50:05 -0200 |
commit | 3d25292ae3da2e8cf7a501c69b331a8d08344c59 (patch) | |
tree | bc9e395d0b2ec735a84efcf30bbe4c50f90c5aae /activesupport | |
parent | 5222a33d0dc67f4984e26ccab46722b4ee2277d5 (diff) | |
download | rails-3d25292ae3da2e8cf7a501c69b331a8d08344c59.tar.gz rails-3d25292ae3da2e8cf7a501c69b331a8d08344c59.tar.bz2 rails-3d25292ae3da2e8cf7a501c69b331a8d08344c59.zip |
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
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG.md | 7 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/file/atomic.rb | 9 |
2 files changed, 14 insertions, 2 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 76a232665f..c54e933fdc 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,10 @@ +## Rails 3.2.10 (unreleased) + +* Handle the possible Permission Denied errors atomic.rb might trigger due to + its chown and chmod calls. [Backport #8027] + + *Daniele Sluijters* + ## Rails 3.2.9 (unreleased) * Add logger.push_tags and .pop_tags to complement logger.tagged: 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 |