Hi,

Attached is suggestion for fix for sql-sync command when executed from Windows enviroment.

The problem: If I have in my alias the '%dump-dir' defined normally (ex: c:/temp/drush) mysqldump (or the tool used for exporting based on the database) works fine and manages to make a dump BUT rsync is giving the error: "The source and destination cannot both be remote". The reason for this is because when rsync-ing rsync expects the path in format /cygdrive/c/temp/drush.
If I put in my alias the '%dump-dir' to be in the format /cygdrive/c/temp/drush then mysqldump (or the tool used for exporting based on the database) can not export dump of the localdatabase.

I think to some extent this issue is connected to #1149880: Remote commands to drush on Windows server + backend invoke / sql-sync refactor.

CommentFileSizeAuthor
#4 sql_sync_fix_both.patch1.43 KBrdeknijf
sql_sync_fix.patch805 byteswelinwelchev

Comments

greg.1.anderson’s picture

Status: Needs review » Needs work

Hm, maybe #0 would work on msysgit. "RSYNC" mode is the right thing to do here, but that code probably needs to be fixed up to work correctly on cygwin. Also, this patch needs an equivalent modification on the remote -> local code path.

Thanks for pushing this forward.

moshe weitzman’s picture

Status: Needs work » Postponed (maintainer needs more info)

sqlsync tests are passing on windows. is resolved?

rdeknijf’s picture

The patch fixes it in one direction, but remote => local still has the same problem. I'm looking into it, but I'm probably unequipped to fix this.

rdeknijf’s picture

StatusFileSize
new1.43 KB

Ah, apparently I underestimated myself.
There was one more drush_core_call_rsync() for remote => local, and it needed similar treatment.

I've never made a patch before, but there you go.

It's working both ways now, as far as I can test it.

greg.1.anderson’s picture

Status: Postponed (maintainer needs more info) » Needs review
greg.1.anderson’s picture

Patch looks right to me, but I have not tried it.

Regarding whether this resolves sql-sync on Windows, this patch still requires that the remote system be running rsync, e.g. if the local system is Windows and the remote system is Linux. For a Windows-to-Windows sql-sync, a different mechanism must be used. I think that could be taken up in a separate issue -- and I thought that there was one already, but I could not find it searching for "Windows" tags or "rsync" issues. I added #1473386: Provide a remote-file copy utility use with remote Windows servers not running rsync as a placeholder. There are a couple of other related issues ( #1173644: Use winrs when using "drush ssh" command on Windows and #1149886: sql dump does not work with windows sql server), but I think this one can be closed once verified and committed.

moshe weitzman’s picture

Status: Needs review » Fixed

Committed without testing as the patch looks simple.

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