Overwriting file-cached keys on Windows results in an access denied error

Created on 4 December 2015, over 8 years ago
Updated 11 August 2023, 11 months ago

This is most easily reproduced by running PhpBackendUnitTest, which fails on Windows resulting in a error similar to:

rename(sites/simpletest/454911/files/php/cache_page/.2182f2ee82,sites/simpletest/454911/files/php/cache_page/4DdMbToh62rmlatZJ9JZhKIsaANqRJmDb53GpRYrTfI/77b96f84dee112a2bc5cbb6c09722bee07bde3bd8bc78675274980ca21cf3378.php): Access is denied. (code: 5)

This is because rename() on Windows incorrectly uses the target file permissions rather than the containing directory permissions. See this PHP bug report.

πŸ› Bug report
Status

Needs work

Version

9.5

Component
CacheΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States mikeker

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β†’ as a guide.

    This will need a test case to show the issue. Would recommend the #testing channel on slack for how to write a windows only test.

  • πŸ‡ΊπŸ‡ΈUnited States crutch

    Experiencing this now on local windows dev machine using XAMPP v3.3.0, D9.5.5, PHP 8.1. #14 isn't applying.

    Scenario
    When trying to generate video thumbnails using core media, I ran into an issue with the file system. After adding/using the video field "media_oembed_video" and saving, I edited the media item and changed the suggested file path which was public://oembed_thumbnails or public://oembed_thumbnails/videos to use a custom location. I then deleted the files and folders from the suggested locations above and in the styles directory expecting auto-regeneration of the folders and files. Now getting error...

    Warning: rename(sites/default/files/php/twig/.r3Zx1jkE6kBEezw2NmPNEuratkI,sites/default/files/php/twig/641488bb00721_status-messages--alerts.h_kDfXO1DP-OaUrNTKHNGCTb_0Q/TcuRT0AQzFp7awBIpnkgIIYABxTnucXuVfQO6jOzM7I.php): Access is denied (code: 5) in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save() (line 88 of C:\xampp\htdocs\web\core\lib\Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage.php)

    references: https://www.drupal.org/project/drupal/issues/2700019 πŸ› MTimeProtectedFastFileStorage crashes with concurrency. Needs work , https://www.drupal.org/project/drupal/issues/2606772 πŸ› Long Twig cache directories can cause failures on some filesystems Fixed

  • πŸ‡­πŸ‡ΊHungary Grabby

    I’m running D9.5.10 (PHP 8.1.21) with Laragon on a Windows box and tried #14, but I’m still getting

    Warning: rename(tmp//twig/.4zqGXfPLZK7G4mnjw2abMtYMKkU,tmp//twig/64d68a2a2a255___string_template__1e7a22_5NnBESfxNIwNCEGCXhF2pxNyN/hXVFktFf4R1YIAvzgQqXtx4ksD18LS7FG6vvGU5r9og.php): Access is denied (code: 5) in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save() (line 105 of mysite\web\core\lib\Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage.php)

    In my case it’s triggered by adding or configuring blocks in layout builder.

Production build 0.69.0 2024