Closed (fixed)
Project:
Drush
Version:
All-versions-4.x-dev
Component:
PM (dl, en, up ...)
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
23 Sep 2011 at 08:37 UTC
Updated:
26 Feb 2012 at 06:50 UTC
When updating a module, the function drush_prepare_backup_dir (in drush/includes/drush.inc) is called. It tries to detect if the backup directory is inside the Drupal root. Since the Drupal root doesn't end with a slash, you can get false positives.
To reproduce:
1) Drupal root - /var/www/drupal
2) Drush backup-dir - /var/www/drupal_backup
With this setup "strpos($backup_parent, $drupal_root)" will return 0 since $backup_parent is /var/www/drupal_backup/databasename and $drupal_root is /var/www/drupal.
The trivial fix is attached as a patch.
PS! This bug might be fix in 5.x-dev, but is still a problem in 4.x-dev.
| Comment | File | Size | Author |
|---|---|---|---|
| drush-includes-drush-inc-201109231021.patch | 324 bytes | hansfn |
Comments
Comment #1
jonhattanCommitted. Thanks.
Comment #2
jonhattanComment #3
hansfn commentedI wonder if my patch was too trivial - maybe DIRECTORY_SEPARATOR is needed in stead of a bare "/"? I don't know the inner workings of Drush (and I don't have Windows to test on).
Comment #4
jonhattanI'm out of windows world. Perhaps we should always normalize paths to '/' form before any operation.
Reference #966002: Proper usage of DIRECTORY_SEPARATOR.
Comment #5
msonnabaum commentedBackported.