I have drush 8 up and running ok on windows 10 with cygwin, except for running an sql-sync command.
When running the command to sync from stag(remote) to dev(local), it generated the dump file on the remote server fine but then has a problem pulling it down to my local machine.
Adding the -verbose option to the sql-sync command reveals that the path that it tries to put the database dump file is wrong.
eg.
/cygdrive/C/wamp/www/kev//cygdrive/C/Users/2pha/AppData/Local/Temp
as you can see the path is wrong.
You will delete files in /cygdrive/C/wamp/www/kev//cygdrive/C/Users/2pha/AppData/Local/Temp/kev_stag_20170123_095407.sql
.gz and replace with data from [email protected]:/home/twopha/drush-backups/kev_stag/20170123095407/kev_stag_2017012
3_095407.sql.gz
Do you really want to continue? (y/n): y
Calling system(rsync -e 'ssh ' -akzv --exclude=".git" --exclude=".gitignore" --exclude=".hg" --exclude=".hgignore" --exc
lude=".hgrags" --exclude=".bzr" --exclude=".bzrignore" --exclude=".bzrtags" --exclude=".svn" --stats --progress --remove
-source-files [email protected]:/home/twopha/drush-backups/kev_stag/20170123095407/kev_stag_20170123_095407.sql.gz /
cygdrive/C/wamp/www/kev//cygdrive/C/Users/2pha/AppData/Local/Temp/kev_stag_20170123_095407.sql.gz);
receiving incremental file list
rsync: change_dir#3 "/cygdrive/C/wamp/www/kev//cygdrive/C/Users/2pha/AppData/Local/Temp" failed: No such file or directo
ry (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(713) [Receiver=3.1.2]
Here is the relevant part of my aliases:
$aliases['dev'] = array(
'root' => 'C:/wamp/www/kev',
'uri' => 'localsite.dev',
'path-aliases' => array(
'%dump-dir' => 'c:/wamp/tmp',
'%files' => 'sites/default/files',
),
'source-command-specific' => array (
'sql-sync' => array (
'no-cache' => TRUE,
'create-db' => TRUE,
'mode' => 'rultvz',
),
),
);
$aliases['stag'] = array (
'uri' => 'xxx.xxx.com',
'root' => '/var/www/xxx.xxx.com/public_html',
'remote-user' => 'serveruser',
'remote-host' => 'xxx.xxx.xxx.xxx',
'path-aliases' => array(
'%dump-dir' => '/tmp',
'%files' => 'sites/default/files',
),
'source-command-specific' => array (
'sql-sync' => array (
'no-cache' => TRUE,
),
),
// No need to modify the following settings
'command-specific' => array (
'sql-sync' => array (
'sanitize' => TRUE,
'no-ordered-dump' => TRUE,
'structure-tables' => array(
// You can add more tables which contain data to be ignored by the database dump
'common' => array('cache', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions', 'watchdog'),
),
),
),
);
EDIT
Also, while running rsync to sync the files, the paths seems all messed up:
I ran:
drush rsync @kev.stage:%files/ @kev.dev:%files
And this is what I got (notice the paths):
You will delete files in /cygdrive/C/wamp/www/kev//cygdrive/C/wamp/www/kev/sites/default/files and replace with data fro
m @kev.stage:/cygdrive/C/wamp/www/kev//cygdrive/C/wamp/www/kev/sites/default/files/
So, as far as using drush (specifically sql-sync and rsync with cygwin)
Is there some setting I am missing in relation to the paths?
Has someone encountered this before?
Is this a Drush bug? (I did search the issue queue but found nothing)
Drush issues that seem relevant:
Drush is converting Cygwin paths unnecessarily. If Cygwin PHP is being used, paths should not be converted.
fix for use under cygwin's php
drush_sitealias_evaluate_path
function in drush/includes/sitealias.inc to look for 2 occurrences of /cygdriveif(substr_count($site_alias_settings['evaluated-path'], '/cygdrive') > 1)
and if found remove everything before second occurrence$site_alias_settings['evaluated-path'] = trim(substr($site_alias_settings['evaluated-path'], strrpos($site_alias_settings['evaluated-path'], '/cygdrive')));
. It works, but I feel dirty altering a drush function.