Skip to content
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

Permission denied for phpunit result cache file #157

Open
florentdestremau opened this issue Jan 28, 2025 · 2 comments
Open

Permission denied for phpunit result cache file #157

florentdestremau opened this issue Jan 28, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@florentdestremau
Copy link
Contributor

florentdestremau commented Jan 28, 2025

MicroSymfony version(s) affected

latest (today)

Description

I used the docker on-liner to install the project.

~/dev/microsymfony🔒
❯ make test
PHPUnit 11.5.2 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.8
Configuration: /home/florent/dev/microsymfony/phpunit.xml.dist

...................                                               19 / 19 (100%)PHP Warning:  file_put_contents(/home/florent/dev/microsymfony/.phpunit.result.cache): Failed to open stream: Permission denied in /home/florent/dev/microsymfony/vendor/phpunit/phpunit/sr
c/Runner/ResultCache/DefaultResultCache.php on line 160

Warning: file_put_contents(/home/florent/dev/microsymfony/.phpunit.result.cache): Failed to open stream: Permission denied in /home/florent/dev/microsymfony/vendor/phpunit/phpunit/src/Runner/ResultCache/DefaultResultCache.php on line 160


Time: 00:00.278, Memory: 34.00 MB

OK (19 tests, 26 assertions)

It's probably an issue with the fact that it's installed as root:

~/dev/microsymfony🔒
❯ ls -a
Permissions Size User Date Modified  Name
drwxr-xr-x     - root  1 janv. 19:30  .github
drwxr-xr-x     - root  1 janv. 19:30  assets
drwxr-xr-x     - root  1 janv. 19:30  bin
drwxr-xr-x     - root  1 janv. 19:30  config
drwxr-xr-x     - root  1 janv. 19:30  public
drwxr-xr-x     - root  1 janv. 19:30  src
drwxr-xr-x     - root  1 janv. 19:30  templates
drwxr-xr-x     - root  1 janv. 19:30  tests
drwxrwxrwx     - root 28 janv. 09:31  var
drwxr-xr-x     - root 28 janv. 09:31  vendor
drwxr-xr-x     - root  1 janv. 19:30  vendor-bin
.rw-r--r--  1,1k root  1 janv. 19:30  .env
.rw-r--r--    25 root  1 janv. 19:30  .env.local.dist
.rw-r--r--   215 root  1 janv. 19:30  .env.test
.rw-r--r--   643 root  1 janv. 19:30  .gitignore
.rw-r--r--  2,0k root  1 janv. 19:30  .php-cs-fixer.dist.php
.rw-r--r--  9,1k root  1 janv. 19:30  castor.php
.rw-r--r--  5,3k root  1 janv. 19:30  CODE_OF_CONDUCT.md
.rw-r--r--  3,7k root 28 janv. 09:31  composer.json
.rw-r--r--  340k root 28 janv. 09:31  composer.lock
.rw-r--r--  3,0k root  1 janv. 19:30  CONTRIBUTING.md
.rw-r--r--   884 root  1 janv. 19:30  importmap.php
.rw-r--r--  6,5k root  1 janv. 19:30  Makefile
.rw-r--r--   969 root  1 janv. 19:30  phpstan.neon
.rw-r--r--  1,3k root  1 janv. 19:30  phpunit.xml.dist
.rw-r--r--   18k root  1 janv. 19:30  README.md
.rw-r--r--  3,0k root  1 janv. 19:30  scc
.rw-r--r--  1,1k root  1 janv. 19:30  scrutinizer-ci.yaml
.rw-r--r--  1,7k root  1 janv. 19:30  SECURITY.md
.rw-r--r--  5,6k root  1 janv. 19:30  symfony.lock

How to reproduce

Normal install using docker:

docker run --rm -it -v $PWD:/app composer:latest create-project strangebuzz/microsymfony && cd microsymfony
make test

Possible Solution

Use a chown command after docker install such as

chown -R $USER .

This fixes the issue.

Additional Context

No response

@COil COil added the bug Something isn't working label Jan 29, 2025
@COil
Copy link
Member

COil commented Jan 29, 2025

You are using Linux, I guess? I can't reproduce on macOS.
Maybe a note about this potential problem should be added in the doc.

I remember with Linux, Docker rights are a little more tricky than on macOS.
Because in this case, the project is created as root while with mac it is installed with the current user rights.

@florentdestremau
Copy link
Contributor Author

Yes ubuntu, and the files are created as root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants