PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar bembelimen
bembelimen
14 May 2024

@nikosdion reported the following issue

Summary of Changes

I am seeing a problem with Kickstart extracting backup archives and Joomla's installation ZIP file on some cPanel hosts (e.g. Rochen). This seems to have started the last couple of days, and only affects recent versions of PHP under active support (8.1, 8.2, and 8.3).

The problem I see is that PHP reports the file we're trying to write into is not writeable, even though it most definitely can be written to. This happens around the first few files included in the ZIP file.

I traced the problem on two affected hosts and found it happens because we change the permissions of the still-empty file, right before writing into it. In theory, this shouldn't be a problem. PHP should update its file stat cache upon changing the permissions, therefore know the file exists and is writeable. On the affected hosts it wasn't the case. Removing the line changing the permissions worked (removing a useful fefature), and so did adding a clearstatcache() after that line (which is the right way to solve it).

Joomla! Update uses the same code, line for line, but I have not been able to reproduce the issue with it. Still, I think that this problem MAY occur under conditions I do not yet know, preventing people from updating their sites. Since it looks like it's very timing-sensitive it might explain why there have been some users reporting a failure to update with a message about files not being able to be written to, even though their host tells them this is not the case. Maybe their host isn't lying to them, maybe this is a bug that's been very hard to reproduce.

In any case, I would ask you to find the two lines reading

$this->setCorrectPermissions($this->fileHeader->file);

in extract.php and add

clearstatcache($this->fileHeader->file);

after them. It doesn't hurt performance in any measurable way, and it makes sure that any PHP file stat cache shenanigans won't get in the way of Joomla! Update.

Testing Instructions

Code review

avatar bembelimen bembelimen - open - 14 May 2024
avatar bembelimen bembelimen - change - 14 May 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 14 May 2024
Category Administration com_joomlaupdate
avatar brianteeman
brianteeman - comment - 14 May 2024

Would it be a good idea to add a comment with this code to explain its purpose especially as rthe rest of this file is very well documented?

This file is changed during the script's operation so we clear the status cache.

avatar bembelimen bembelimen - change - 15 May 2024
Labels Added: PR-4.4-dev
avatar bembelimen
bembelimen - comment - 15 May 2024

Would it be a good idea to add a comment with this code to explain its purpose especially as rthe rest of this file is very well documented?

This file is changed during the script's operation so we clear the status cache.

Thanks, done

avatar MacJoom MacJoom - change - 16 May 2024
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-05-16 06:50:13
Closed_By MacJoom
avatar MacJoom MacJoom - close - 16 May 2024
avatar MacJoom MacJoom - merge - 16 May 2024
avatar MacJoom
MacJoom - comment - 16 May 2024

Thank you!

Add a Comment

Login with GitHub to post a comment