-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cypress System Tests fail when writing configuration.php #43465
Labels
Comments
muhme
added a commit
to muhme/joomla-cms
that referenced
this issue
May 13, 2024
Fix for issue joomla#43465 'Cypress System Tests fail when writing configuration.php' . remember the original file permission . set 644 . write file . restore original file permission additional: . writing file to ${Cypress.env('cmsPath')}/configuration.php` and no more to 'configuration.php' . error handle file is not existing
4 tasks
please test #43466 |
4 tasks
laoneo
added a commit
that referenced
this issue
Jun 7, 2024
…43466) * Fix for issue #43465 writing configuration.php Fix for issue #43465 'Cypress System Tests fail when writing configuration.php' . remember the original file permission . set 644 . write file . restore original file permission additional: . writing file to ${Cypress.env('cmsPath')}/configuration.php` and no more to 'configuration.php' . error handle file is not existing * typo * updated system tests README * corrected task names * Update tests/System/README.md of course, thank you for checking Co-authored-by: Richard Fath <richard67@users.noreply.github.com> * deleted failure handler config_setParameter() deleted failure handler for readFile as it is not needed, tested with chmod 0, Cypress fails with clear reason: CypressError: `cy.readFile("./configuration.php")` failed while trying to read the file at the following path: `.../43465/joomla-cms/configuration.php` The following error occurred: > "EACCES: permission denied, open '/Users/hlu/Desktop/no_backup/43465/joomla-cms/configuration.php'" * typo Co-authored-by: Brian Teeman <brian@teeman.net> * typo Co-authored-by: Brian Teeman <brian@teeman.net> * chain the then()-calls Chaining the then()-calls for a not so deeply nested code source looks catchy - thank Allon for the recommendation * adopted code formatting for better readability * fixing lint:js errors - deleted console.log statements - used const for never changing value - refactored file mask to not use bitwise operation '&' * fixed lint:testjs errors * Better fix for configuration.php permission issue Working with the code when fighting with the drone shows that a `chmod` was already implemented in `writeFile()`. Following changes with this commit: - Only using `chmod` method synchronously - Replaced setting directory mode to setting file mode before writing - Setting file mode only if the file exists - Having final file mode as parameter with default 0o444 - Using 0o444 as default file mode and not hard-wired 0o777 - The methods `getFilePermissions()` and `changeFilePermissions()` created for this PR earlier are deleted. Enhancement of the `tests/System/README.md` for troubleshooting three-user-problem in having Cypress running user, web server running user and `root` user. This commitment has been extensively tested in various combinations. Every test contains: - Checking error before - Doing the patch - Running installation twice and running overall test suite Tests are: - macOS 14.5 Sonoma, local with apache & Cypress same user, branch 4.4-dev - error before `> EACCES: permission denied, open './configuration.php'` - Docker, one container with joomla and one container with Cypress, using `root` users inside containers - no error before, but `configuration.php` is 777 - after the patch `configuration.php` is 444 inside container and shown 644 on host - tested four times, branches 4.4-dev, 5.1-dev, 5.2-dev and 6.0-dev - Ubuntu 24.04 LTS local installation, one non-root users running Cypress and another non-root user running Apache, branch 4.4-dev - error before `> EACCES: permission denied, open './configuration.php'` - need to use `sudo` and need to set `umask 0`, see troubleshooting - Windows 11 Pro, Laragon with Cmder, branch 4.4-dev - error before `> EPERM: operation not permitted, open 'C:\laragon\www\joomla-cms\configuration.php'` All tests are successful: - running `Installation.cy.js` twice, checking `configuration.php` 444 and params are set - running complete system test suite without errors * configuration.php CMS path relative && umask 0 - corrected mistake task writeFile was used with cmsPath + 'configuration.php' - extended writeFile to set process umask 0 - to prevent the 3-user-problem == no need to set umask 0 in sudo anymore This commitment has been tested in various combinations. Every test contains: - Checking error before - Doing the patch - Running Installation.cy.js only and running overall test suite Tests are: - Docker environment with drone images, root running Cypress and www-data running Apache, branch 4.4-dev - no error before, but /tests/www/cmysql/configuration.php has 777 - Ubuntu 24.04 LTS local installation, one non-root user running Cypress and another non-root user running Apache, branch 4.4-dev - error before `> EACCES: permission denied, open './configuration.php'` - need to use `sudo`, see troubleshooting (umask 0 is no more needed) - Windows 11 Pro, Laragon with Cmder, branch 4.4-dev - error before `> EPERM: operation not permitted, open 'C:\laragon\www\joomla-cms\configuration.php'` - found out that on the second run cy.exec('rm configuration.php') does not work under Windows - deleted file manually and i will create an issue afterwards to avoid enlarging this one - macOS 14.5 Sonoma, local with apache & Cypress same user, branch 4.4-dev - error before `> EACCES: permission denied, open './configuration.php'` All tests are successful: - running `Installation.cy.js`, checking `configuration.php` 444 and params are set - running complete system test suite without errors --------- Co-authored-by: Richard Fath <richard67@users.noreply.github.com> Co-authored-by: Brian Teeman <brian@teeman.net> Co-authored-by: Allon Moritz <allon.moritz@digital-peak.com>
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(edited)
Steps to reproduce the issue
Expected result
configuration.php
parameters like $mailer = 'smtp' are set correctconfiguration.php
file mask is still read-only (444)Actual result
System information (as much as possible)
root
user (as typically in Docker container based installation)root
installation there is the file mask 777 from the web-server createdconfiguration.php
file, which may be another problemAdditional comments
configuration.php
will likely be the causeroot
user who is able to overwrite a read-only file:sudo npx cypress run --spec 'tests/System/integration/install/Installation.cy.js'
root
user or you use actual users Cypress installation cache, e.g.sudo CYPRESS_CACHE_FOLDER=$HOME/.cache/Cypress npx cypress run --spec 'tests/System/integration/install/Installation.cy.js'
The text was updated successfully, but these errors were encountered: