delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/05/14/07:15:38

X-Spam-Check-By: sourceware.org
Date: Mon, 14 May 2007 13:15:06 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: rsync and tcsh don't play well on Cygwin
Message-ID: <20070514111506.GA12259@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <f08at9$3ft$1 AT sea DOT gmane DOT org>
Mime-Version: 1.0
In-Reply-To: <f08at9$3ft$1@sea.gmane.org>
User-Agent: Mutt/1.4.2.2i
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Apr 19 11:01, Mark Riley wrote:
> After having problems with rsync (2.6.6) hanging while pushing files
> to a Cygwin machine over ssh, I searched the lists here and found
> that many other users were experiencing the same problem.  While
> some solutions seemed to mitigate the problem, there are still some
> users experiencing this problem (myself included).
> 
> After wading through massive(!) strace output files, it appears that 
> an interaction between tcsh and rsync on the remote Cygwin machine
> is the culprit.  If the remote machine is configured to use bash as the
> login shell, then the problem disappears - rsync works fine.  This
> might explain why some users can't reproduce the problem (they don't
> use tcsh).
> 
> When rsync connects to the remote machine using ssh, sshd launches
> a login shell (tcsh in this case) before the remote rsync command is run.
> Perusing the source for tcsh, it can be seen that tsch calls setmode(fd,
> O_TEXT) on the pipe supplied to it by sshd.  When rsync is subsequently
> invoked, it inherits this pipe.  Rsync apparently assumes it is getting an
> O_BINARY pipe and fails miserably when \r\n combinations are
> translated to \n.
> 
> Recompiling rsync with
> 
>    setmode(STDIN_FILENO, O_BINARY);
>    setmode(STDOUT_FILENO, O_BINARY);
> 
> placed near the beginning of main() fixes the problem and I can now
> use tcsh as my login shell on the remote machine again.
> 
> This may not be the ideal solution, but other solutions I've tried like
> putting "binmode" in the CYGWIN environment variable on the remote
> machine or invoking rsync with the --rsh="ssh -T" option didn't
> help.
> 
> Anyway, I hope this solution works for some of the others out there
> experiencing this problem.

This is IMHO a problem in both applications, rsync and tcsh.  rsync
should always make sure that its IO on the pipe is binary (as you do
above, for instance), and tcsh shouldn't assume O_TEXT for all input.
The latter is something I plan to change for years, but I got always
distracted by other stuff.  Maybe this year?!?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019