I am not sure if I just need help or if this is a bug.

Steps to reproduce

  1. Configure a shell alias in drushrc.php that has a parameter that includes a string with spaces, such as the drush sql-query command with a query
    $options['shell-aliases']['tpd'] = "!drush sql-sync @dev && drush sql-query 'UPDATE users SET mail = \"user@example.com\" WHERE uid > 1' && drush updb";
  2. Run drush tpd.
    • Expected behaviour: The sql query executes
    • Actual behaviour: There is a MySQL about the syntax near "'UPDATE" (Note the single quote)
  3. Run the unescaped drush sql-query command on it's own: drush sql-query 'UPDATE users SET mail = "user@example.com" WHERE uid > 1'. There is no error.

Comments

moonray’s picture

Same problem with the following shell alias:

$options['shell-aliases']['devel'] = "!drush en -y devel && drush rap 'anonymous user' 'access devel information' && drush rap 'authenticated user' 'access devel information'";

Running it I get the following output:

devel is already enabled.                                                                   [ok]
There were no extensions that could be enabled.                                             [ok]
FirePHP already present. No download required.                                              [ok]
WD php: DrushRoleException: Could not find the role: 'anonymous in DrushRole->__construct() [error]
(line 43 of /usr/local/share/drush/classes/DrushRole.php).
DrushRoleException: Could not find the role: 'anonymous in DrushRole->__construct() (line 43 of /usr/local/share/drush/classes/DrushRole.php).
Drush command terminated abnormally due to an unrecoverable error.                          [error]
moshe weitzman’s picture

Status: Active » Fixed

Fixed in Drush 6 just now as part of https://github.com/drush-ops/drush/pull/40. The fix there uses a php 5.3 only function so we need to backport different for drush5. Help wanted.

Status: Fixed » Closed (fixed)

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