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 /railties | |
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 'railties')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index fbccff5005..83e35214a5 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -3615,7 +3615,9 @@ File.atomic_write(joined_asset_path) do |cache| end </ruby> -To accomplish this +atomic_write+ creates a temporary file. That's the file the code in the block actually writes to. On completion, the temporary file is renamed, which is an atomic operation on POSIX systems. If the target file exists +atomic_write+ overwrites it and keeps owners and permissions. +To accomplish this `atomic_write` creates a temporary file. That's the file the code in the block actually writes to. On completion, the temporary file is renamed, which is an atomic operation on POSIX systems. If the target file exists `atomic_write` overwrites it and keeps owners and permissions. However there are a few cases where `atomic_write` cannot change the file ownership or permissions, this error is caught and skipped over trusting in the user/filesystem to ensure the file is accessible to the processes that need it. + +NOTE. Due to the chmod operation `atomic_write` performs, if the target file has an ACL set on it this ACL will be recalculated/modified. WARNING. Note you can't append with +atomic_write+. |