Hi,

When I try to update, I get the following errors:

WD php: rename(): The first argument to copy() function cannot be a directory in                                [error]
/[path to drush]/includes/drush.inc on line 581.
WD php:                                                                                                         [error]
rename(/[path to drupal]/sites/all/modules/admin_menu,/[path to drush]/backup/modules/20100519114134/admin_menu):
Success in /[path to drush]/includes/drush.inc on line 581.
Failed to backup project directory /[path to drupal]/sites/all/modules/admin_menu to                [error]
/[path to drupal]/backup/modules/20100519114134/admin_menu
rename(): The first argument to copy() function cannot be a directory in                                        [warning]
/[path to drush]/drush/includes/drush.inc on line 581.
rename(/[path to drupal]/sites/all/modules/admin_menu,/[path to drupal]/backup/modules/20100519114134/admin_menu):[warning]
Success in /[path to drush]/drush/includes/drush.inc on line 581.
An error occurred at function : drush_pm_updatecode                                                             [error]
WD php: array_merge(): Argument #2 is not an array in /[path to drush]/commands/pm/updatecode.pm.inc  [error]
on line 210.
array_merge(): Argument #2 is not an array in /[path to drush]/commands/pm/updatecode.pm.inc on line  [warning]
210.
An error occurred at function : drush_pm_update        

I'm just running "drush up". There are two modules to update, admin_menu and save_as_draft. The backup directories do get created. If I choose the modules individually, I get the same respective errors.

This is my first time using drush for updating, so I'm not sure if I'm doing something wrong. This is a Red Hat linux server, php 5.2.10. I'm running the command from the Drupal root.

Comments

j0rd’s picture

same issue, but php 5.3

" array_merge(): Argument #2 is not an array in /usr/src/drush/commands/pm/updatecode.pm.inc on line[warning]
210."

j0rd’s picture

Title: errors running update » updatecode.pm.inc on line 210 errors running Drush Update

updating title

tribe_of_dan’s picture

Drush pm-update doesn't work for me either!

subscribe

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)

file permissions?

tribe_of_dan’s picture

Hi Moshe, I'm not sure if its a file permissions thing... what could be cuasing that?

Do I need to check the permissions on some specific files?

this is my error message:

Unable to checkout drupal from cvs.drupal.org.                                                                                         [error]
Project drupal was updated successfully. Installed version is now 6.17.
An error occurred at function : drush_pm_updatecode                                                                                    [error]
WD php: rename(,/home/daniel_san/mywebsite/drupal-6.17): No such file or directory in                                         [error]
/home/daniel_san/drush/includes/drush.inc on line 581.
Could not restore backup and rollback from failed upgrade. You will need to resolve manually.                                          [error]
rename(,/home/daniel_san/mywebsite/drupal-6.17): No such file or directory in /home/daniel_san/drush/includes/drush.inc on    [warning]
line 581.
An error occurred at function : drush_pm_update                                                                                        [error]
davidhernandez’s picture

I shouldn't have any file permission problems. I've run it as myself and also root.

greg.1.anderson’s picture

Title: updatecode.pm.inc on line 210 errors running Drush Update » updatecode requires modules dir and backup dir to be on the same volueme (updatecode.pm.inc on line 210)
Category: support » bug
Status: Postponed (maintainer needs more info) » Active

Sorry for not responding earlier, y'all.

This is a limitation of PHP. You'll get it when your backup directory is on a different volume than where the update was downloaded to. That's what the error from rename means in #0. I think there's a dup issue somewhere, but I didn't look for it. I guess I'll mark this 'active' for now.

(n.b.: the error from rename in #5 (with an empty source path) is completely different and unrelated -- no idea what's going on there.)

davidhernandez’s picture

Can you explain what the limitation is exactly?

davidhernandez’s picture

I researched a bit the problem with rename(); I see now. I do store the my modules directory on a file server that is mounted on my web server and symbolically linked to in the drupal directory. I copied the modules directory locally to the sites/all/modules directory and the update worked fine. I think I can find a solution from here, if it means I have to move some files around.

moshe weitzman’s picture

Assigned: Unassigned » greg.1.anderson
kanani’s picture

So this is kind of a hack but:

rsync -avz public_html/example.com public_html/example.com_tmp

mv public_html/example.com public_html/example.com_bak

mv public_html/example.com_tmp public_html/example.com

worked for me.

greg.1.anderson’s picture

Yeah, I was originally planning on solving this with rsync, but there is some controversy in that rsync is not always available on Windows. I'm in favor of making rsync a requirement, but I guess a decision one way or the other hasn't been firmly made. It would be possible to do just with php, with extra programming (probably less efficiency too).

davidhernandez’s picture

The simplest solution I've found is just specifying the backup directory (--backup-dir=). The default is the root of the Drupal install, but I made a backup directory on the same remote server I store my modules, and specify it when I run the command. That works fine, and seems like a proper solution.

davidhernandez’s picture

Actually, now that I think about it (and thinking out loud), is the root of Drupal the best place to put the backups?

greg.1.anderson’s picture

No, not best, just simplest.

dpalmer’s picture

Subscribing

davepoon’s picture

Version: All-versions-3.0-beta1 » All-versions-3.1

I am using All-versions-3.1 of drush on Mac.
I have got a similar problem, just couldn't use the "drush up" and "drush upc"
It threw an error like this,
WD php: Notice: Undefined variable: print in pm_update_packages() (line 236 of [error]
/Applications/drush/commands/pm/updatecode.pm.inc).
The examples directory could not be found within the modules directory at [error]
/Applications/MAMP/htdocs/drupal/sites, perhaps the project is enabled but has been deleted from disk.
An error occurred at function : drush_pm_updatecode [error]
WD php: Notice: Undefined index: full_project_path in drush_pm_updatecode_rollback() (line 322 of [error]
/Applications/drush/commands/pm/updatecode.pm.inc).
WD php: Notice: Undefined index: skip_list in drush_pm_updatecode_rollback() (line 322 of [error]
/Applications/drush/commands/pm/updatecode.pm.inc).
WD php: Warning: array_merge(): Argument #2 is not an array in _pm_update_move_files() (line 210 of [error]
/Applications/drush/commands/pm/updatecode.pm.inc).
WD php: Notice: Undefined index: full_project_path in drush_pm_updatecode_rollback() (line 323 of [error]
/Applications/drush/commands/pm/updatecode.pm.inc).
array_merge(): Argument #2 is not an array in _pm_update_move_files() (line 210 of [warning]
/Applications/drush/commands/pm/updatecode.pm.inc).
An error occurred at function : drush_pm_update

I currently just used "drush dl modulename" to manually update/replace the out-dated modules one by one.

stkrzysiak’s picture

Although this comment doesn't directly address the issue at hand, it is the solution that fixed things for me when I saw this error. So I will post in the hope it helps someone someday. Before drush did all my dirty work, I would do a cp -r sites/all/modules from previous sites I had built. I forgot that this copies all files, including .svn directories. Which, turned out to be the 'remote' volumes that drush was trying to access, the repos. So, if anyone has an issue with this error and sees some svn error in drush's output, this is what I did to remove my svn directories(i'm using git now):

find /project_dir -type d -name .svn -exec rm -rf '{}' +

where /project_dir is your drupal directory. Via this site: http://linux.byexamples.com/archives/195/remove-all-svn-directories-at-o...

Ingumsky’s picture

I had the same error on my Linux machine but I figured out why that occured. And yes, that was file permissions — drush couldn't create and/or use backup directory if launched by ordinary user. When I tried to repeat the same as root it worked flawlessly. Hopefully it helps other users to get rid of this issue.

PS That's my first experience with drush and it works just great. Thank you!

greg.1.anderson’s picture

Component: Code » PM (dl, en, up ...)
Assigned: greg.1.anderson » jonhattan

@jonhattan: you fixed this, yes?

jonhattan’s picture

Status: Active » Fixed

The file permission thing should not happen anymore as backups are now stored in the user home directory, or you can use --backup-dir.

The cross volume thing is the same as #965878: Cross-volume backup failure.

Status: Fixed » Closed (fixed)

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