<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Solving rsync hangs with Cygwin</title>
	<atom:link href="http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/feed/" rel="self" type="application/rss+xml" />
	<link>http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/</link>
	<description></description>
	<lastBuildDate>Thu, 15 Jul 2010 07:55:28 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ray</title>
		<link>http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/comment-page-1/#comment-299866</link>
		<dc:creator>Ray</dc:creator>
		<pubDate>Tue, 09 Mar 2010 16:27:40 +0000</pubDate>
		<guid isPermaLink="false">http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/#comment-299866</guid>
		<description>Dragos Toader&#039;s fix worked for me.  Thanks!</description>
		<content:encoded><![CDATA[<p>Dragos Toader&#8217;s fix worked for me.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc</title>
		<link>http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/comment-page-1/#comment-299694</link>
		<dc:creator>Marc</dc:creator>
		<pubDate>Wed, 10 Feb 2010 15:58:13 +0000</pubDate>
		<guid isPermaLink="false">http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/#comment-299694</guid>
		<description>Interesting. Thanks for the info! I don&#039;t use cygwin regularly these days so I probably won&#039;t get a chance to try this, but perhaps some others who stumble upon this page will find your comments very useful.

So why doesn&#039;t it work with socketpair()? Is socketpair()? broken on Cygwin?</description>
		<content:encoded><![CDATA[<p>Interesting. Thanks for the info! I don&#8217;t use cygwin regularly these days so I probably won&#8217;t get a chance to try this, but perhaps some others who stumble upon this page will find your comments very useful.</p>
<p>So why doesn&#8217;t it work with socketpair()? Is socketpair()? broken on Cygwin?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dragos Toader</title>
		<link>http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/comment-page-1/#comment-299687</link>
		<dc:creator>Dragos Toader</dc:creator>
		<pubDate>Wed, 10 Feb 2010 01:32:02 +0000</pubDate>
		<guid isPermaLink="false">http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/#comment-299687</guid>
		<description>The URL got mangled.  Here it is again:
&lt;a href=&quot;http://www.mail-archive.com/cygwin@cygwin.com/msg82514.html&quot; rel=&quot;nofollow&quot;&gt;http://www.mail-archive.com/cygwin@cygwin.com/msg82514.html&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>The URL got mangled.  Here it is again:<br />
<a href="http://www.mail-archive.com/<span id="emob-pltjva@pltjva.pbz-68">cygwin {at} cygwin(.)com<script type="text/javascript">
    var mailNode = document.getElementById('emob-pltjva@pltjva.pbz-68');
    var linkNode = document.createElement('a');
    linkNode.setAttribute('href', "mailto:%63%79%67%77%69%6E%40%63%79%67%77%69%6E%2E%63%6F%6D");
    tNode = document.createTextNode("cygwin {at} cygwin(.)com");
    linkNode.appendChild(tNode);
    linkNode.setAttribute('id', "emob-pltjva@pltjva.pbz-68");
    mailNode.parentNode.replaceChild(linkNode, mailNode);
</script>/msg82514.html" rel="nofollow">http://www.mail-archive.com/<span id="emob-pltjva@pltjva.pbz-68">cygwin {at} cygwin(.)com</span><script type="text/javascript">
    var mailNode = document.getElementById('emob-pltjva@pltjva.pbz-68');
    var linkNode = document.createElement('a');
    linkNode.setAttribute('href', "mailto:%63%79%67%77%69%6E%40%63%79%67%77%69%6E%2E%63%6F%6D");
    tNode = document.createTextNode("cygwin {at} cygwin(.)com");
    linkNode.appendChild(tNode);
    linkNode.setAttribute('id', "emob-pltjva@pltjva.pbz-68");
    mailNode.parentNode.replaceChild(linkNode, mailNode);
</script>/msg82514.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dragos Toader</title>
		<link>http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/comment-page-1/#comment-299686</link>
		<dc:creator>Dragos Toader</dc:creator>
		<pubDate>Wed, 10 Feb 2010 01:30:19 +0000</pubDate>
		<guid isPermaLink="false">http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/#comment-299686</guid>
		<description>
You do not need to run rsync as a daemon.
Download the rsync source from cygwin. 
(using setup.exe)

...
In short:
Compile rsync from source and use pipes instead of socketpair.

# To do this:
cd /usr/src/rsync-3.0.6/
./prepare-source
./configure

# Now undefine HAVE_SOCKETPAIR in config.h
# Search for /HAVE_SOCKETPAIR
# Comment out 
# #define HAVE_SOCKETPAIR 1
# //#define HAVE_SOCKETPAIR 1
vi config.h
  // #define HAVE_SOCKETPAIR 1

make
make install

# Instead of overwriting the original executable 
# at /bin/rsync use the compiled executable 
# (/usr/local/bin/rsync.exe) in your backup scripts.
# This way, even if /bin/rsync gets overwritten 
# by cygwin setup.exe, we are still using the good 
# rsync version compiled from source.

See
http://www.mail-archive.com/cygwin@cygwin.com/msg82514.html

The hang is occuring when rsync is attempting to exchange protocol version numbers, it writes its version and then hangs waiting endlessly for a reply.  The ssh process is detached, and apparently not diretly connected to rsync, as it is an orphan, owned by process 1.  The ssh process never even gets as far as attempting network access and rsync
never does anything of value.

Not defining HAVE_SOCKETPAIR in the make configuration is enough to use pipe() vs. socketpair(), which is enough for rsync to run using ssh, just as it does on UNIX.  While I&#039;ve not done extensive testing, I&#039;ve used it enough to believe it is working as designed/intended.

The source file that is affected by the above change (primarily) is
util.c in function: fd_pair():

#ifdef HAVE_SOCKETPAIR
        ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
#else
        ret = pipe(fd);
#endif

While use of socketpair() may be a better method, use of 
pipe() does work.
...
</description>
		<content:encoded><![CDATA[<p>You do not need to run rsync as a daemon.<br />
Download the rsync source from cygwin.<br />
(using setup.exe)</p>
<p>&#8230;<br />
In short:<br />
Compile rsync from source and use pipes instead of socketpair.</p>
<p># To do this:<br />
cd /usr/src/rsync-3.0.6/<br />
./prepare-source<br />
./configure</p>
<p># Now undefine HAVE_SOCKETPAIR in config.h<br />
# Search for /HAVE_SOCKETPAIR<br />
# Comment out<br />
# #define HAVE_SOCKETPAIR 1<br />
# //#define HAVE_SOCKETPAIR 1<br />
vi config.h<br />
  // #define HAVE_SOCKETPAIR 1</p>
<p>make<br />
make install</p>
<p># Instead of overwriting the original executable<br />
# at /bin/rsync use the compiled executable<br />
# (/usr/local/bin/rsync.exe) in your backup scripts.<br />
# This way, even if /bin/rsync gets overwritten<br />
# by cygwin setup.exe, we are still using the good<br />
# rsync version compiled from source.</p>
<p>See<br />
<a href="http://www.mail-archive.com/<span id="emob-pltjva@pltjva.pbz-36">cygwin {at} cygwin(.)com<script type="text/javascript">
    var mailNode = document.getElementById('emob-pltjva@pltjva.pbz-36');
    var linkNode = document.createElement('a');
    linkNode.setAttribute('href', "mailto:%63%79%67%77%69%6E%40%63%79%67%77%69%6E%2E%63%6F%6D");
    tNode = document.createTextNode("cygwin {at} cygwin(.)com");
    linkNode.appendChild(tNode);
    linkNode.setAttribute('id', "emob-pltjva@pltjva.pbz-36");
    mailNode.parentNode.replaceChild(linkNode, mailNode);
</script>/msg82514.html" rel="nofollow">http://www.mail-archive.com/<span id="emob-pltjva@pltjva.pbz-36">cygwin {at} cygwin(.)com</span><script type="text/javascript">
    var mailNode = document.getElementById('emob-pltjva@pltjva.pbz-36');
    var linkNode = document.createElement('a');
    linkNode.setAttribute('href', "mailto:%63%79%67%77%69%6E%40%63%79%67%77%69%6E%2E%63%6F%6D");
    tNode = document.createTextNode("cygwin {at} cygwin(.)com");
    linkNode.appendChild(tNode);
    linkNode.setAttribute('id', "emob-pltjva@pltjva.pbz-36");
    mailNode.parentNode.replaceChild(linkNode, mailNode);
</script>/msg82514.html</a></p>
<p>The hang is occuring when rsync is attempting to exchange protocol version numbers, it writes its version and then hangs waiting endlessly for a reply.  The ssh process is detached, and apparently not diretly connected to rsync, as it is an orphan, owned by process 1.  The ssh process never even gets as far as attempting network access and rsync<br />
never does anything of value.</p>
<p>Not defining HAVE_SOCKETPAIR in the make configuration is enough to use pipe() vs. socketpair(), which is enough for rsync to run using ssh, just as it does on UNIX.  While I&#8217;ve not done extensive testing, I&#8217;ve used it enough to believe it is working as designed/intended.</p>
<p>The source file that is affected by the above change (primarily) is<br />
util.c in function: fd_pair():</p>
<p>#ifdef HAVE_SOCKETPAIR<br />
        ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fd);<br />
#else<br />
        ret = pipe(fd);<br />
#endif</p>
<p>While use of socketpair() may be a better method, use of<br />
pipe() does work.<br />
&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Sayers</title>
		<link>http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/comment-page-1/#comment-293134</link>
		<dc:creator>Andrew Sayers</dc:creator>
		<pubDate>Thu, 24 Apr 2008 13:20:57 +0000</pubDate>
		<guid isPermaLink="false">http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/#comment-293134</guid>
		<description>Thanks - I was stuck on this.

Since this is the top hit on Google for &quot;rsync hangs windows&quot;, I thought I&#039;d outline how the paranoid amongst us can still use SSH:

1. On the server, set &quot;hosts allow = 127.0.0.1&quot; in rsyncd.conf.  This will only allow local connections to the rsync server
2. On the client, SSH in to the server, forwarding local port 873 to localhost:873.  In PuTTY, this is configured through Connection-&gt;SSH-&gt;Tunnels in the PuTTY configuration.
3. On the client, change rsync://server/whatever to rsync://localhost/whatever and run rsync in the normal way

Basically, instead of getting the rsync client to talk to a remote rsync server, this uses a feature of SSH that fools the client and server into thinking they&#039;re on the same computer.  I have no idea why this should be any better, but it works fine for me.

	- Andrew Sayers</description>
		<content:encoded><![CDATA[<p>Thanks &#8211; I was stuck on this.</p>
<p>Since this is the top hit on Google for &#8220;rsync hangs windows&#8221;, I thought I&#8217;d outline how the paranoid amongst us can still use SSH:</p>
<p>1. On the server, set &#8220;hosts allow = 127.0.0.1&#8243; in rsyncd.conf.  This will only allow local connections to the rsync server<br />
2. On the client, SSH in to the server, forwarding local port 873 to localhost:873.  In PuTTY, this is configured through Connection-&gt;SSH-&gt;Tunnels in the PuTTY configuration.<br />
3. On the client, change rsync://server/whatever to rsync://localhost/whatever and run rsync in the normal way</p>
<p>Basically, instead of getting the rsync client to talk to a remote rsync server, this uses a feature of SSH that fools the client and server into thinking they&#8217;re on the same computer.  I have no idea why this should be any better, but it works fine for me.</p>
<p>	- Andrew Sayers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gis</title>
		<link>http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/comment-page-1/#comment-289939</link>
		<dc:creator>gis</dc:creator>
		<pubDate>Mon, 21 Jan 2008 16:44:19 +0000</pubDate>
		<guid isPermaLink="false">http://marc-abramowitz.com/archives/2007/10/14/solving-rsync-hangs-with-cygwin/#comment-289939</guid>
		<description>i was pulling my hair out trying to set this rsync over ssh on win sbs 2k3. thanks to you it now works! i wish that chaps from cygwin project would include this in their bloody FAQ! 

:-)</description>
		<content:encoded><![CDATA[<p>i was pulling my hair out trying to set this rsync over ssh on win sbs 2k3. thanks to you it now works! i wish that chaps from cygwin project would include this in their bloody FAQ! </p>
<p> <img src='http://marc-abramowitz.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
