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

chdir(): Permission denied (errno 13) #9649

Closed
bbeckford opened this issue Jan 26, 2021 · 4 comments · Fixed by #9651
Closed

chdir(): Permission denied (errno 13) #9649

bbeckford opened this issue Jan 26, 2021 · 4 comments · Fixed by #9651
Labels
Milestone

Comments

@bbeckford
Copy link
Contributor

When running composer update from CLI (via Plesk's composer install) via this command:

sudo -u ben /opt/plesk/php/7.3/bin/php /usr/lib64/plesk-9.0/composer.phar update -d /var/www/vhosts/ben.test.system/httpdocs -vvv

...I get the following exception:

...
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
5 packages you are using are looking for funding.
Use the `composer fund` command to find out more!


  [ErrorException]
  chdir(): Permission denied (errno 13)


Exception trace:
 () at phar:///usr/lib64/plesk-9.0/composer.phar/src/Composer/Console/Application.php:313
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 chdir() at phar:///usr/lib64/plesk-9.0/composer.phar/src/Composer/Console/Application.php:313
 Composer\Console\Application->doRun() at phar:///usr/lib64/plesk-9.0/composer.phar/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/lib64/plesk-9.0/composer.phar/src/Composer/Console/Application.php:122
 Composer\Console\Application->run() at phar:///usr/lib64/plesk-9.0/composer.phar/bin/composer:63
 require() at /usr/lib64/plesk-9.0/composer.phar:24

I installed composer from source in order to find out what working directory it was trying to change to and it was, in fact, the home directory of the admin user account I was running the CLI script from, which I suppose makes sense as the user ben can't see into that directory.

However as everything else worked as expected and this error happens almost literally right at the end of the program, I wonder if this particular error should be downgraded to a warning?
It would also be useful if it mentioned which directory it was trying to chdir() to.

I'll create a PR if I get time, but I thought it was worth mentioning as I found nothing when Googling and it's taken me quite a while to get to this point!

@stof
Copy link
Contributor

stof commented Jan 26, 2021

this error seems to happen at the time composer tries to change the current directory back to the original one (it does that when using the -d option, no idea why this is needed)

@Seldaek
Copy link
Member

Seldaek commented Jan 26, 2021

Yeah i am also not entirely sure why it does that. Maybe @derrabus still knows 😄 6f317b7

My guess is we could simply delete this.. or at least wrap it in a Silencer::call() to make sure it does not fail hard if it fails, because while it may be nicer to clean up after doing a ourselves here, the odds are in most cases this is useless. In weird embedded-composer contexts I guess this may have an impact.

@bbeckford
Copy link
Contributor Author

Wow 6f317b7 was a while ago, anyone else feel old?

Thanks for the suggestion @Seldaek, I've created a pull request.

@Seldaek Seldaek added this to the 2.0 milestone Jan 27, 2021
@Seldaek Seldaek added the Bug label Jan 27, 2021
@derrabus
Copy link
Contributor

Wow 6f317b7 was a while ago, anyone else feel old?

I certainly do!

Maybe @derrabus still knows 😄

That was a while ago. 👴🏻 In general, if I need to mutate the global state for an operation, I usually restore the previous state once I'm done. I think this is what I was doing there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants