This is what I get if trying to update the views module between two developing versions of views on D7beta3.

For other modules (and even for the same views module just yesterday) drush worked just fine. I suspect the error is thrown only if downloaded archives are corrupted.

File views-7.x-3.x-dev.tar.gz is corrupt (wrong md5 checksum). [error]
Updating project views failed. Attempting to roll back to previously installed version. [error]
An error occurred at function : drush_pm_updatecode [error]
Backups were restored successfully. [ok]
WD php: Warning: array_merge(): Argument #2 is not an array in _pm_update_move_files() (line 211 of /home/mac/drush/commands/pm/updatecode.pm.inc). [warning]
array_merge(): Argument #2 is not an array in _pm_update_move_files() (line 211 of /home/mac/drush/commands/pm/updatecode.pm.inc). [warning]
An error occurred at function : drush_pm_update

Comments

Mac Ryan’s picture

Just a little addition. This is what I get after the file is downloaded if I issue "drush -d pm-download views":

2010-11-18 22:14:25 (970 KB/s) - `./views-7.x-3.x-dev.tar.gz' saved [1585419/1585419]

Downloading views-7.x-3.x-dev.tar.gz was successful. [3.45 sec, 19.06 MB] [notice]
Calling unlink(views-7.x-3.x-dev.tar.gz)
File views-7.x-3.x-dev.tar.gz is corrupt (wrong md5 checksum). [3.47 sec, 19.06 MB] [error]
An error occurred at function : drush_pm_download [3.47 sec, 19.05 MB] [error]
Command dispatch complete [3.47 sec, 19.04 MB] [notice]
Timer Cum (sec) Count Avg (msec)
page 3.238 1 3237.93

jonhattan’s picture

Version: All-versions-3.3 »
Status: Active » Closed (works as designed)

It is the correct behaviour. views-7.x-3.x-dev has a bad checksum.

Note drush did show:

Calling unlink(views-7.x-3.x-dev.tar.gz)
File views-7.x-3.x-dev.tar.gz is corrupt (wrong md5 checksum). [3.47 sec, 19.06 MB] [error]

But it's fine: before that, the md5 checksum has been checked. I mean it does not remove the file before doing the check.

Mac Ryan’s picture

Title: Possible improvement in managing bad md5 » Possible improvement for Drush messages.

Thank you Jon for your answer. I understand now that I got confused between the [error] message and the fact drush also threw in a couple of warnings.

I wonder if there is a way to improve the output of drush for making the output more self-explanatory. Admittedly I am more of a python guy than of a PHP one, yet it looks to me that a bad md5 should be handled as an exception rather than an error, and therefore the calls that now generate warnings could be included in a try ... catch block.

I changed the title, reopened the issue and re-categorised it under "feature request", bat that was more for attracting the attention of the devs. If not applicable for any reason, just close it again! :)

Mac Ryan’s picture

Title: Drush throw errors if the downloaded archive is corrupted. » Possible improvement in managing bad md5
Category: bug » feature
Priority: Normal » Minor
Status: Closed (works as designed) » Needs work
jonhattan’s picture

Title: Possible improvement for Drush messages. » Possible improvement in managing bad md5
Status: Needs work » Fixed

not a big thing but just changed the order of the messages: http://drupalcode.org/viewvc/drupal/contributions/modules/drush/commands...

About using exceptions: I don't think there's an oposition to this. Current approach is just the way drush has grown but can be changed. I invite you to analyze the way to introduce exception handling in drush and make a formal proposition in a dedicated issue :)

Status: Fixed » Closed (fixed)

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