Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

atomic_write

#1702

When I use :file_store, Rails application must have permission to write in 'public/' directory. If it doesn't have access to 'public/', cache files are created as temporary files - i.e. 'menu.cache.20222.0' instead of 'menu.cache'.

atomic_write creates (in some cases) a file /permissions_check.XXXXXXX to determine the default permissions. This file is created in the current directory. If the script hasn't permission to write in the current directory, it fails and the code, which renames temporary file (created by the atomic_write) and changes its permissions, isn't executed.

The file .permission_check should be created in the same directory as the output file.

Note: It's my first report. If something is missing, let me know, I will add it.

Reported by Tomas K. · January 6th, 2009 @ 04:50 PM

State: resolved
Milestone: 2.x
Assigned to: josh josh
Importance: none

Activity

  1. joost baaij
  2. Pratik
    Pratik
    • Assigned user set to josh
    • Tag changed from activesupport to activesupport, patch

    March 8th, 2009 @ 03:18 PM

  3. josh
    josh
    • State changed from new to resolved

    Looks like this fix was already applied.

    
              begin
                # Get original file permissions
                old_stat = stat(file_name)
              rescue Errno::ENOENT
                # No old permissions, write a temp file to determine the defaults
                check_name = join(dirname(file_name), ".permissions_check.#{Thread.current.object_id}.#{Process.pid}.#{rand(1000000)}")
                open(check_name, "w") { }
                old_stat = stat(check_name)
                unlink(check_name)
              end
    

    March 10th, 2009 @ 02:48 AM