When the module is first installed a new directory, xmlsitemap, is created. It does not appear to correctly inherit the group ownership of the parent directory. i.e.

/sites/default/files is emmajane:www-data
/sites/default/files/xmlsitemap is emmajane:emmajane.

This results in an error. Updating the group ownership results in the error message going away.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

I'm not sure how we fix this with the APIs?

Dave Reid’s picture

Status: Active » Postponed (maintainer needs more info)

We use http://api.drupal.org/api/function/file_prepare_directory/7, which is also used in core. Do other folders in your files directory have this same problem?

Anonymous’s picture

Wouldn't the group of a created directory be the group of the user that created that directory? For Drupal that would be the group assigned to the web server user. Or if you're running php as cgi from the emmajane user account then you need to add the emmajane user to the www-data group and switch to that group before starting php for the group to be www-data.

emmajane’s picture

Status: Postponed (maintainer needs more info) » Needs work

Other folders in the files directory do not have this problem, although core modules don't seem to be consistent in applying the user and group ownership.

Here's how the sandbox is set-up:

1. the server is running as www-data.
2. Drupal files are stored in my home directory: /home/emmajane/websites/drupal/drupal7/drupal-7.x-dev/

gollum:files 12:34:02 $ ps aux | grep apache
root 1652 0.0 0.3 38352 7880 ? Ss Aug02 0:00 /usr/sbin/apache2 -k start
www-data 1663 0.0 1.2 55840 25016 ? S Aug02 0:02 /usr/sbin/apache2 -k start

gollum:default 12:29:25 $ drush si

You are about to DROP your 'd7_head_20100718' database and then CREATE a new one. Do you want to continue? (y/n): y
Starting Drupal installation. This takes 30 seconds or so ... [ok]
gollum:default 12:29:47 $ cd files
gollum:files 12:29:52 $ ll
total 8.0K
drwxr-xr-x 3 www-data www-data 4.0K 2010-08-04 12:30 field
drwxrwxr-x 2 emmajane emmajane 4.0K 2010-08-04 12:29 styles
gollum:files 12:30:39 $ ll field/
total 4.0K
drwxrwxr-x 2 www-data www-data 4.0K 2010-08-04 12:30 image
gollum:files 12:30:49 $ ll field/image/
total 32K
-rw-rw-r-- 1 www-data www-data 30K 2010-08-04 12:30 2008-09-30-183848.jpg
gollum:files 12:30:51 $

Note the permissions on field and styles which are core modules. The directories are created and the Image is uploaded. I hope that helps?

Dave Reid’s picture

Status: Needs work » Postponed (maintainer needs more info)

Yeah I don't know how this is an XML sitemap specific problem. Was the module installed or anything done with drush? Because it may very well run as a different user than www-data.

Until we know how this can be fixed, let's leave this as needs more info.

emmajane’s picture

I'm not sure what information you need? Installing a module with Drush doesn't affect the /sites/default/files directory. The xmlsitemap directory is created by Drupal when cron is run. What additional information do you need about how your module creates the directory when triggered by cron?

drwxr-xr-x 3 www-data www-data 4.0K 2010-08-04 12:30 field <--- created by Drupal core
drwxrwxr-x 2 www-data www-data 4.0K 2010-08-04 13:02 mine <--- created by Drupal when a custom content type with an Image file is added
drwxrwxr-x 2 emmajane emmajane 4.0K 2010-08-04 12:29 styles <--- created by Drupal core
drwxrwxr-x 2 emmajane emmajane 4.0K 2010-08-04 13:18 xmlsitemap <--- created by xmlsitemap when cron is run.

Dave Reid’s picture

We don't know how to fix it since it's obviously not an xmlsitemap specific bug since the same problem is with your styles directory. FYI the directory is usually created on module install, not cron.

emmajane’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)
FileSize
76.36 KB
53.35 KB

Scrapped everything and downloaded all modules from scratch. Enabled the module from Drupal's admin screen instead of Drush. Permissions were assigned based on the Web server (not based on the files directory).

It appears as though:

1. If Drush is used to install the module the permissions assigned to the xmlsitemap are based on the Drush user, not the Web server.
2. If insufficient permissions are available on the directory xmlsitemap the module is unable to create the directory and related files. The configuration screen for XML sitemap displays the errors seen in screen shot 1.
3. If insufficient permissions are available on the directory xmlsitemap clicking the cron link in the error message yields the warning seen in screen shot 2.

Fix: Disable *AND* uninstall XML sitemap using the Drupal administration screens. then re-enable XML Sitemap using the Drupal administration screens.

Dave Reid’s picture

Status: Closed (won't fix) » Active

Ah, ok that was what I was thinking it was. I think you can run drush commands as the web users, or add your local user account as part of the web-group. Something like that. :/

I do need to make sure that message is fixed up. Emma I'd love your help finding the appropriate handbook page to link to.

Some possibilities:
http://drupal.org/node/394704
http://drupal.org/node/34025

emmajane’s picture

I cleaned up http://drupal.org/node/394704 and rolled in the comments. This page should be ok now. Although it doesn't include the fix of disabling and uninstalling the module.

Dave Reid’s picture

Status: Active » Fixed

Committed the fixes to the requirements message on both branches:
http://drupal.org/cvs?commit=411304
http://drupal.org/cvs?commit=411306

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.