Drush finds fresh Drupal site, if passed root and uri:

[20:55] g:/> drush --root=g:/dev/site/rel/r1_0/www --uri=r1_0.spacewealth.org status 
 Drupal version         :  7.13-dev                        
 Site URI               :  r1_0.spacewealth.org            
 Database driver        :  mysql                           
 Database hostname      :  localhost                       
 Database username      :  bc                              
 Database name          :  r1_0                            
 Database               :  Connected                       
 Drupal bootstrap       :  Successful                      
 Drupal user            :  Anonymous                       
 Default theme          :  bartik                          
 Administration theme   :  seven                           
 PHP configuration      :  G:\dev\bin\php\php5.4.0\php.ini 
 Drush version          :  5.1                             
 Drush configuration    :  G:\dev\bin\drush\drushrc.php    
 Drupal root            :  g:/dev/site/rel/r1_0/www        
 Site path              :  sites/default                   
 File directory path    :  sites/default/files        

But Drush DOES NOT find Drupal if those root and uri are in an alias:

[21:01] g:/> drush @dev status -d
Bootstrap to phase 0. [0.01 sec, 1.89 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 2.02 MB] [bootstrap]
Loading drushrc "G:\dev\bin\drush\drushrc.php" into "drush" scope.   [bootstrap]
[0.01 sec, 2.02 MB]
Load alias @dev [0.01 sec, 2.03 MB]                                     [notice]          <<---
Load alias @dev [0.02 sec, 2.03 MB]                                     [notice]
Cache MISS cid: 5.1-commandfiles-0-3d3039a2d93bf9a5ba8df7ed6a07a7c4      [debug]
[0.03 sec, 2.03 MB]
Cache SET cid: 5.1-commandfiles-0-3d3039a2d93bf9a5ba8df7ed6a07a7c4       [debug]
[0.04 sec, 2.05 MB]
Array to string conversion core.drush.inc:885 [0.06 sec, 3.99 MB]       [notice]
Array to string conversion core.drush.inc:885 [0.06 sec, 3.99 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.06 sec, 3.99 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.06 sec, 4 MB]          [notice]
Array to string conversion core.drush.inc:894 [0.06 sec, 4 MB]          [notice]
Bootstrap to phase 0. [0.07 sec, 4.85 MB]                            [bootstrap]
Array to string conversion core.drush.inc:885 [0.07 sec, 5.02 MB]       [notice]
Array to string conversion core.drush.inc:885 [0.07 sec, 5.02 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.07 sec, 5.02 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.07 sec, 5.03 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.07 sec, 5.03 MB]       [notice]
Bootstrap to phase 5. [0.08 sec, 4.86 MB]                            [bootstrap]
The drush command '@dev status' could not be found.  Run `drush          [error]
cache-clear drush` to clear the commandfile cache if you have
installed new extensions. [0.08 sec, 4.86 MB]
A Drupal installation directory could not be found [0.08 sec, 4.87       [error]

The Drush install folder (g:/dev/bin/drush/) contains both drushrc.php and aliases.drush.php, stripped down for troubleshooting:

drushrc.php:

<?php
$options['alias-path'] = array('g:/dev/bin/drush');
?>

aliases.drush.php:

<?php
  $aliases['dev'] = array(
    'root' => 'G:/dev/site/rel/r1_0/www/',
    'uri' => 'r1_0.spacewealth.org',
  );
?>

Drush site-alias finds only @none, it does not seem to read aliases.drush.php:

[21:06] g:/> drush sa -d
Bootstrap to phase 0. [0.01 sec, 1.89 MB]                            [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 2.02 MB] [bootstrap]
Loading drushrc "G:\dev\bin\drush\drushrc.php" into "drush" scope.   [bootstrap]
[0.01 sec, 2.02 MB]
Cache MISS cid: 5.1-commandfiles-0-3d3039a2d93bf9a5ba8df7ed6a07a7c4      [debug]
[0.02 sec, 2.03 MB]
Cache SET cid: 5.1-commandfiles-0-3d3039a2d93bf9a5ba8df7ed6a07a7c4       [debug]
[0.03 sec, 2.04 MB]
Array to string conversion core.drush.inc:885 [0.05 sec, 3.99 MB]       [notice]
Array to string conversion core.drush.inc:885 [0.05 sec, 3.99 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.05 sec, 3.99 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.05 sec, 3.99 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.05 sec, 4 MB]          [notice]
Bootstrap to phase 0. [0.06 sec, 4.86 MB]                            [bootstrap]
Array to string conversion core.drush.inc:885 [0.06 sec, 5.02 MB]       [notice]
Array to string conversion core.drush.inc:885 [0.06 sec, 5.02 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.06 sec, 5.02 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.06 sec, 5.03 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.06 sec, 5.03 MB]       [notice]
Bootstrap to phase 0. [0.07 sec, 4.86 MB]                            [bootstrap]
Found command: site-alias (commandfile=sitealias) [0.07 sec, 4.87 MB][bootstrap]
Array to string conversion core.drush.inc:885 [0.07 sec, 5.04 MB]       [notice]
Array to string conversion core.drush.inc:885 [0.07 sec, 5.05 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.07 sec, 5.05 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.07 sec, 5.05 MB]       [notice]
Array to string conversion core.drush.inc:894 [0.07 sec, 5.05 MB]       [notice]
Array to string conversion core.drush.inc:885 [0.08 sec, 5.1 MB]        [notice]
Array to string conversion core.drush.inc:885 [0.08 sec, 5.1 MB]        [notice]
Array to string conversion core.drush.inc:894 [0.08 sec, 5.1 MB]        [notice]
Array to string conversion core.drush.inc:894 [0.08 sec, 5.1 MB]        [notice]
Array to string conversion core.drush.inc:894 [0.08 sec, 5.1 MB]        [notice]
Array to string conversion sitealias.drush.inc:96 [0.1 sec, 4.92 MB]    [notice]
@none
Command dispatch complete [0.1 sec, 4.89 MB]                            [notice]
Peak memory usage was 6 MB [0.1 sec, 4.89 MB]                           [memory]

Windows 7; Emacs 24/Eshell.

Any suggestions?

Thanks!

Comments

quicksketch’s picture

Moving back after spam.

greg.1.anderson’s picture

Category: support » bug
Issue tags: +Windows

Something in includes/sitealias.inc is getting confused by the Windows-format path.

asteroid.miner’s picture

Version: » 7.x-5.1
Category: bug » support

Hello Greg,

Thanks for your note.

I see that sitealias.inc makes allowances for Windows in four places
(lines 202, 307, 1435, and 1661).

My wild guess is that the normalization at line 307, which tries to
"make sure we don't add the same path twice" may not succeed.
It looks like @dev is in fact added twice.

Is there something I can do to make the alias more palatable?

Drush works fine from /www, but I really would like to use aliases.

Thanks for any suggestions or workarounds.

(Thanks too for writing the aliases code, and the Drush chapter!)

asteroid.miner’s picture

Category: support » bug

Reset category to "bug report".

greg.1.anderson’s picture

Sorry I don't have time to work on this. The normalization you are talking about is handling $options['alias-path'] = array('g:/dev/bin/drush');, not the @dev alias. As a workaround, if you are using cygwin, you could try converting all of your paths to /cygdrive/g/...; I believe that msysgit has a similar Unix-style path available for Windows paths.

greg.1.anderson’s picture

asteroid.miner’s picture

Title: Alias loaded but not used (Windows 7) » Alias loaded but not used (Windows 7) -- SOLVED (syntax)
Status: Active » Closed (works as designed)

It was a file name error.

The alias file needs to be:

aliases.drushrc.php 

or:

aliases.drush5rc.php 

And not:

aliases.drush.php 

I was led astray by the notice:

Load alias @dev [0.01 sec, 2.03 MB]                                     [notice]

The function _drush_sitealias_load_alias,
in sitealias.inc, sends that comment to the drush_log when it gets
an alias name, but before it finds and reads aliases.drushrc.php.

Moving forward again, with a deeper appreciation of what goes on.