Skip to content

Conversation

@xtremeperf
Copy link
Contributor

@xtremeperf xtremeperf commented Mar 26, 2018

  • Removed hashed_directory_umask option because it caused Cm_Cache_Backend_File class to explicitly set permissions using chmod, ignoring umask and setgid bit.
  • Zend_Cache_Backend_File class deprecated and removed hashed_directory_umask option from Zend Framework v1.12+
  • Magento Framework does not explicitly set file & directory permissions as of v2.0.6+

Description

This fix will allow the Magento Framework to no longer explicitly set file/directory permissions from the default cache backend by removing use of the hashed_directory_umask option
'hashed_directory_umask' => 0777,
from code within the file
lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php.

This option was deprecated and removed from the Zend Framework as of version 1.12, but has remained in the Magento Framework.

Cm_Cache_Backend_File class still supports "hashed_directory_umask" option, with additional class code providing backwards compatibility with ZF 1.11.

However, setting this option was causing Cm_Cache_Backend_File to use PHP's chmod function recursively on the hashed directory structure during file and directory creation. Simply removing this option allows permissions to be inherited properly from the file system, and respects SETGID bit and Magento umask.

Fixed Issues (if relevant)

  1. setup:di:compile's generated cache files inaccessible by the web-server user #11930: setup:di:compile's generated cache files inaccessible by the web-server user
  2. Magento 2 Admin panel show loading on each page #10700: Magento 2 Admin panel show loading on each page

Manual testing scenarios

  1. Install any version of Magento2
  2. Check file & directory permissions from var/cache and var/page_cache and up
  3. Notice that file & directory permissions are inherited from parent directories, and obey SETGID bit & umask.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

 - Removed hashed_directory_umask option because it caused Cm_Cache_Backend_File class to explicitly set permissions using chmod, ignoring umask and setgid bit.
 - Zend_Cache_Backend_File class deprecated and removed hashed_directory_umask option from Zend Framework v1.12+
 - Magento Framework does not explicitly set file & directory permissions as of v2.0.6+
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Mar 26, 2018

CLA assistant check
All committers have signed the CLA.

@orlangur orlangur self-assigned this Mar 26, 2018
Copy link
Contributor

@orlangur orlangur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice @xtremeperf! Glad to see this issue finally investigated and fixed, it was reported a bunch of times.

@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-1079 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@xtremeperf thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@okorshenko
Copy link
Contributor

@magento-engcom-team give me new test instance

@magento-engcom-team
Copy link
Contributor

Hi @okorshenko, here is your new test Magento instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants