I am having trouble running drush up to update views. This looks like a permissions error but I cannot tell where drush is trying to write to.

#drush -d @site up
.
.
Downloading release history from                                        [notice]
http://updates.drupal.org/release-history/drush/7.x [9.91 sec, 42.58
MB]
Executing: wget 'http://updates.drupal.org/release-history/drush/7.x'
  --2011-09-08 16:32:28--  http://updates.drupal.org/release-history/drush/7.x
  Resolving updates.drupal.org... 140.211.166.21, 140.211.166.6
  Connecting to updates.drupal.org|140.211.166.21|:80... connected.
  HTTP request sent, awaiting response... 200 OK
  Length: 14752 (14K) [text/xml]
  7.x: Permission denied

  Cannot write to `7.x' (Permission denied).
Executing: curl -O 'http://updates.drupal.org/release-history/drush/7.x'
  Warning: Failed to create the file 7.x
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
 16 14752   16  2403    0     0  14852      0 --:--:-- --:--:-- --:--:-- 14852
  curl: (23) Failed writing body
simplexml_load_file(): I/O warning : failed to load external entity  [warning]
"" pm.drush.inc:2103 [11.41 sec, 42.58 MB]
Calling unlink(Object) [11.41 sec, 42.59 MB]                             [debug]
unlink(): No such file or directory drush.inc:1216 [11.41 sec, 42.59 [warning]
MB]
Could not download project status information from                   [error]
http://updates.drupal.org/release-history/drush/7.x [11.41 sec, 42.59
MB]
Undefined index: drush drush.inc:202 [11.41 sec, 42.59 MB]              [notice]
Invalid argument supplied for foreach() drush.inc:202 [11.41 sec,    [warning]
42.59 MB]
drush self-update check: drush 4.5 is up-to-date. [11.41 sec, 42.59     [notice]
MB]
Code updates will be made to the following projects: Views [views-7.x-3.x-dev]

Note: A backup of your project will be stored to backups directory if it is not managed by a supported version control system.
Note: If you have made any modifications to any file that belongs to one of these projects, you will have to migrate those modifications after updating.
Do you really want to continue with the update process? (y/n): n
Aborting. [13.87 sec, 42.59 MB]                                      [cancel]
Changes made in drush_pm_updatecode have been rolled back. [13.88     [rollback]
sec, 41.41 MB]
Command dispatch complete [13.88 sec, 41.36 MB]                         [notice]
 Timer  Cum (sec)  Count  Avg (msec)
 page   13.617     1      13616.72

Peak memory usage was 43.28 MB [13.88 sec, 41.35 MB]                    [memory]

Comments

greg.1.anderson’s picture

Status: Active » Postponed (maintainer needs more info)

There are a few issues in the queue right now on drush temp file usage:

http://drupal.org/node/1234904
http://drupal.org/node/1168812
http://drupal.org/node/966378
http://drupal.org/node/1272820

I can't support permission denied errors directly; I'm swamped right now. If you have patches to submit that make it easier to control or diagnose temp file usage, your help in the issue queue would be most appreciated.

Sorry for any inconvenience drush is causing you in its temp directory selection.

waverate’s picture

Status: Postponed (maintainer needs more info) » Fixed

Well, reading those issues helped a lot.

It looks like drush needs to write to drupal root. The subtlety that I did not notice previously, is that the required write permissions are not for the webserver user (apache) but for the user running drush.

Because drush does not have to be run from drupal root, the error:

  Cannot write to `7.x' (Permission denied).

is quite vague. Perhaps adding a full path to the error message (at least in debug) would help identify the problem sooner.

SOLUTION
- give the user running drush write permission to the drupal root directory

jonhattan’s picture

Version: 7.x-4.5 »
Component: Core Commands » PM (dl, en, up ...)
Category: support » bug
Status: Fixed » Active

@waverate that shouldn't be the solution.

To confirm, just seen that:

Downloading release history from http://updates.drupal.org/release-history/token/6.x [1.01 sec, 16.06 MB]            [notice]
Executing: wget -q --timeout=30 -O /tmp/download_fileafANjA http://updates.drupal.org/release-history/token/6.x
Calling is_readable(/tmp/download_fileafANjA) [1.75 sec, 16.06 MB]                                                    [debug]
Calling is_writable(/var/www/drupal6) [1.75 sec, 16.06 MB]                                                            [debug]
Calling rename(/tmp/download_fileafANjA, /var/www/drupal6/6.x) [1.75 sec, 16.07 MB]   
jonhattan’s picture

Title: simplexml_load_file(): I/O warning : failed to load external entity » Download release history to tmp instead of drupal root
Status: Active » Fixed
jonhattan’s picture

Version: » All-versions-4.x-dev
Assigned: Unassigned » msonnabaum
Status: Fixed » Patch (to be ported)
msonnabaum’s picture

Status: Patch (to be ported) » Fixed

Backported.

Status: Fixed » Closed (fixed)

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