开发者

rsync error: Bad file number

I'm trying to rsync content from local machine (Windows 7 on 64bits) to remote server (Ubuntu 8 on 64bits) and it fails. Any piece of advice is more than welcome as I've already spent too much time with this crap... Thanks in advance!

$ ls -al
total 3
drwxr-xr-x    4 www www     4096 Jun  7 11:04 .
drwxr-xr-x    5 www www     4096 Jun  7 13:13 ..
drwxr-xr-x    7 www ww开发者_JAVA百科w        0 Jun  7 11:04 release-20110607110404

$ rsync -avz ./release-20110607110404/ www@web1:/home/www/
opening connection using: ssh -l www web1 rsync --server -vvlogDtprze.iLsf . /home/www/
select: Bad file number
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(610) [sender=3.0.8]

$ rsync --version
rsync  version 3.0.8  protocol version 30
Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, no xattrs, iconv, symtimes   


Heh, I figured it out, at least found the problem's source... It doesn't work in git bash from msysgit (code.google.com/p/msysgit), but it works in regular windows command line! Weird!!!


Alright, check this out. GitBash comes with a bunch of *nix utilities (including ssh) but cwRsync also comes with ssh. Now, on my system, the version of ssh that ships with GitBash is crazily out of date while the one that comes with cwRsync is very recent. If I run which ssh from inside GitBash, obviously the GitBash version shows up. So, guess which version rsync will use? The wrong one, I guess.

You can work around this.

You are trying to run this command:

rsync -avz ./release-20110607110404/ www@web1:/home/www/

But since you want to use a different ssh, you'll need something like this:

rsync -avz -e '<path to cwRsync ssh> www@web1' ./release-20110607110404/ :/home/www/

Now, if you're anything like me, you'll have another problem which is that ssh will complain that your ssh config file has the wrong permissions. That's because it's looking in /cygdrive/<the correct path to your config file> for some reason. But this too is fixable:

rsync -avz -e '<path to cwRsync ssh> -F <path to ssh config> www@web1' ./release-20110607110404/ :/home/www/

Now, keep in mind that the paths you must use to ssh and to your ssh config file need to be in the silly windows backslash format (at least my system seems to complain if I don't use that format) but I believe this will work for you and you can stay in GitBash instead of using cmd.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜