Write permission check incorrectly fails for new directories not yet existing in current installation
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 51
- Forks
- 40
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 3
Description
Bug description
When updating from Nextcloud 33.0.2 to 33.0.3 using updater.phar --no-interaction, the process fails at the "Check for write permissions" step with the following message:
[✘] Check for write permissions failed
The following places can not be written to:
css
The css directory is newly introduced in 33.0.3 and does not exist in a 33.0.2 installation. PHP's is_writable() returns false for non-existent paths — even when the parent directory is fully writable by the web server user.
Steps to reproduce
- Install Nextcloud 33.0.2 under a subdirectory (e.g.
/var/www/nextcloud) - Run
sudo -u www-data php updater/updater.phar --no-interaction - Observe failure at "Check for write permissions" for
css
Root cause
is_writable('/var/www/nextcloud/css') returns false when css does not exist, regardless of parent directory permissions:
php -r "var_dump(is_writable('/var/www/nextcloud/css'));" // bool(false)
php -r "var_dump(is_writable('/var/www/nextcloud'));" // bool(true)
php -r "mkdir('/var/www/nextcloud/css_test'); echo 'ok';" // ok — write works fine
The updater should check is_writable(dirname($path)) when $path does not yet exist.
Attempted workaround — triggers a second bug
Manually pre-creating /var/www/nextcloud/css causes the earlier "Check for expected files" step to fail instead:
[✘] Check for expected files failed
Unknown files detected within the installation folder:
css
These two checks are mutually exclusive for a non-existent path: you cannot satisfy both. The only way forward is to perform the update fully manually (download zip → rsync → occ upgrade).
Environment
| Item | Value |
|---|---|
| Nextcloud (before) | 33.0.2.2 |
| Nextcloud (after, manual) | 33.0.3 |
| updater.phar version | v33.0.0-2-g643f78d |
| PHP | 8.3.6 (NTS, OPcache enabled) |
| OS | Ubuntu 24.04.4 LTS (noble), kernel 6.8.0-110-generic |
| Web server | nginx 1.24.0 |
| Database | MariaDB 10.11.14 |
| Web server user | www-data |
| Install path | /var/www/nextcloud (subdirectory, overwritewebroot: /nextcloud) |
Expected behavior
When the target path does not exist, the write permission check should fall back to is_writable(dirname($path)) so that new directories introduced in the target version are handled correctly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at updater/updater.phar and locate the "Check for write permissions" logic that evaluates paths such as css, then compare it with the expected-files check described in the issue. Verify behavior for an existing path and a missing path whose parent is writable. Done means an upgrade with a newly introduced directory passes permission checking without treating a manually created directory as an unknown file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100