Skip to content

Write permission check incorrectly fails for new directories not yet existing in current installation #753

@ishizakahiroshi

Description

@ishizakahiroshi

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

  1. Install Nextcloud 33.0.2 under a subdirectory (e.g. /var/www/nextcloud)
  2. Run sudo -u www-data php updater/updater.phar --no-interaction
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions