Can a check be added to only show this warning if the directory isn't empty and it failed to do it?

Could not change permissions of /var/aegir/platforms/drupal-7.x/sites/all/libraries to 2775 (chmod to 2775 failed on /var/aegir/platforms/drupal-7.x/sites/all/libraries)

Comments

realityloop’s picture

Issue summary: View changes
ergonlogic’s picture

Status: Active » Postponed (maintainer needs more info)

So, in this case, it's failing to chmod an empty libraries/ dir? Presumably it'd fail similarly if libraries/ wasn't empty... Is this from a standard platform build, or are you doing something custom? We have a bunch of hooks for managing the behaviour of our chmod's, mkdir's, chgrp's. See: http://cgit.drupalcode.org/provision/tree/provision.api.php#n190. Perhaps one of those can address the issue you're facing.

That said, I'm tempted to close this issue as a duplicate of #2378175: Run file operations under sudo, since that'd presumably solve the issue described here too. In fact, all of _provision_drupal_create_directories() needs to be re-factored imo.

realityloop’s picture

@ergonlogic yes it's the empty libraries dir, no it doesn't throw the error if the dir isn't empty, this error occurs on standard drupal core installation.

realityloop’s picture

Status: Postponed (maintainer needs more info) » Active
helmo’s picture

Why would the chmod fail if the directory exists but is empty?

helmo’s picture

To answer my own question ... the empty dir might be owned by the aegir user while the chmod is tried as user www-data.

I'm wondering if we should set the file_chmod_file and file_chmod_directory config variable for Drupal ... It defaults to 664 and 755 and seems to be broader then what we try to set when installing a new site.

drush @example.com vset file_chmod_file 0660
drush @example.com vset file_chmod_directory 0770

I was seeing warnings from a site like 'The file permissions could not be set on public://tweet-feed-profile-image/55430bd3b70970cd85d0ab1b89733244.jpg.' the directory and file is owned by aegir which prevents www-data from chaning the file permissions.

In platform/provision_drupal.drush.inc we set it for dirs to 770 so adding this default sounds reasonable.