Stop setup:config:set from requiring writable pub/media (#38435) - #41154
Open
lbajsarowicz wants to merge 3 commits into
Open
Stop setup:config:set from requiring writable pub/media (#38435)#41154lbajsarowicz wants to merge 3 commits into
lbajsarowicz wants to merge 3 commits into
Conversation
Contributor
Author
|
@magento run all tests |
|
Hi @lbajsarowicz. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Contributor
Author
|
@magento run all tests |
setup:config:set ran the full installation permission check
(FilePermissions::getMissingWritablePathsForInstallation()), which walks
app/etc, var, pub/media and - outside production mode - generated and
pub/static. A single non-writable file directly inside pub/media (for
example a read-only NFS mount or media owned by the web server user) aborted
the command with:
Missing write permissions to the following paths:
<root>/pub/media/logo.png
setup:config:set writes to app/etc only, so that is the only location whose
permissions are relevant. Add
FilePermissions::getMissingWritablePathsForDeploymentConfig(), which checks
app/etc the same way the database upgrade check does, and use it from
ConfigModel. setup:install keeps the full installation check.
…allation Static Tests flagged the pre-existing @deprecated tag in the touched file: the Magento2 coding standard requires an explained motivation and an @see reference to the replacement.
lbajsarowicz
force-pushed
the
fix/38435-config-set-permissions-check
branch
from
August 27, 2026 16:56
c0d8d95 to
26f58a3
Compare
Contributor
Author
|
@magento run all tests |
1 similar comment
Contributor
Author
|
@magento run all tests |
…nfig-set-permissions-check
Contributor
Author
|
@magento run WebAPI Tests |
1 similar comment
Contributor
Author
|
@magento run WebAPI Tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description (*)
bin/magento setup:config:setfails when any file directly insidepub/mediais not writable by the CLI user (read-only NFS/EFS mount, media owned by the web server user, a straychmod 444):Root cause:
Magento\Setup\Model\ConfigModel::process()runsFilePermissions::getMissingWritablePathsForInstallation()— the fullsetup:installprecondition, which walksapp/etc,var,pub/mediaand (outside production mode)generatedandpub/static, one level deep.setup:config:setonly ever writesapp/etc/env.php/app/etc/config.php, so the state ofpub/mediais irrelevant to it.Fix:
FilePermissions::getMissingWritablePathsForDeploymentConfig()— checksapp/etconly, with the same semantics as the existinggetMissingWritableDirectoriesForDbUpgrade()(directory writable → OK; otherwise its direct entries must be writable).ConfigModeluses it instead of the installation-wide check.setup:installis unchanged:Installer::installDeploymentConfig()still runscheckInstallationFilePermissions()before delegating toConfigModel.No public signatures changed; one public method added.
Related Pull Requests
setup:upgrade/setup:db-data:upgradewith a read-onlyapp/etc(Read-only app/etc/ #26292). Independent change.Fixed Issues (if relevant)
setup:config:setresults in checkingpub/mediafiles permissions #38435Manual testing scenarios (*)
pub/medianon-writable for the CLI user, e.g.touch pub/media/logo.png && chmod 444 pub/media/logo.png(must be a filesystem that honours permissions for that user).bin/magento setup:config:set --cache-id-prefix=test_ --no-interactionMissing write permissions to the following paths: <root>/pub/media/logo.pngenv.phpupdated.chmod 555 app/etc && chmod 444 app/etc/*, run the same command — still refused withMissing write permissions to the following paths: <root>/app/etc(the check that actually matters is kept).bin/magento setup:install ...with a non-writablepub/mediastill fails the file permissions check as before.Questions or comments
Unit tests:
FilePermissionsTest(writableapp/etc→ nothing reported and no other directory looked up; read-onlyapp/etcwith writable entries → nothing reported) andConfigModelTest(installation-wide check no longer called). Both fail against2.4-developwithout the fix.Contribution checklist (*)