On my laptop I have several sites named to the module(s) i'm building or testing.
This happens to site 'ubercart' when running drush pm update ubercart.

The untarring takes place in DRUPAL_ROOT==ubercart ~/www/ubercart instead of ~/www/ubercart/sites/ubercart/module

Patch included.

This patch contains more verbose logging in order to better pinpoint this.

Comments

clemens.tolboom’s picture

StatusFileSize
new4.96 KB

Patch adds:

drush_pm_install_package()
- some verbose logging
- a drush_error when unsuccessful installing ... ie a full stop when installing multiple projects

drush_pm_update()
- verbose logging
- mkdir if check ... this was the start point for this bug

drush_pm_get_project_path()
- verbose logging
- fix for directory backtrace ... it was forward scanned instead of backwards.

moshe weitzman’s picture

Status: Active » Needs work

Does not apply anymore - sorry. Could you resubmit with just the bug fixes? The point of verbose in my mind is not to debug drush itself. It is to help a user when his command isn't working.

moshe weitzman’s picture

Priority: Critical » Normal
clemens.tolboom’s picture

(my setup is a little ruined ... so no patch)
The (offending) lines are in drush_pm_get_project_path

       $parts = explode('/', $path);
-      $i = count($parts) - 1;
-      $stop = array_search($project, $parts);
-      while ($i > $stop) {
-        unset($parts[$i]);
-        $i--;
+      while( $parts[ count($parts)-1] != $project){
+        array_pop( $parts);
       }

The bug is in calculating the $stop which finds the first occurance of $project where it should use (in my case) the last. Unless there are modules out there with their info files in directories like $project/$project/test.info

So I'm not sure whether this fix would not introduce a bug the other way around.

clemens.tolboom’s picture

Status: Needs work » Needs review
StatusFileSize
new862 bytes

When having a site(s) setup like

- /var/www/annotate/sites/annotate/modules/annotate

the old algorithm would delete

- /var/www/annotate directory

and not the annotate module

- /var/www/annotate/sites/annotate/modules/annotate

which would be the usage scenario.

clemens.tolboom’s picture

Could anybody be so kind to review this patch.

I know it's a weird problem having a website name the same as a module name but the code is 'so wrong' :p

And today I 'deleted' a local site again :-( drush pm update ubercart deleted my /var/www/ubercart/ site. It is fortunately a symlink.

moshe weitzman’s picture

Status: Needs review » Closed (fixed)

Too old. Please reopen if needed. Code has changed.