Little Bug under Win32

Corinna Vinschen vinschen at redhat.com
Wed Feb 14 09:28:03 EST 2001


On Mon, Feb 12, 2001 at 08:30:25PM +0100, Christian Fruth wrote:
> Hi
> 
>     I found a small Bug when compiling OpenSSH under Win32 using Cygwin.
> 
>     When you use SSH as a interactive Shell everthing looks normal but when
>     you try to transfer binary data via SSH you will get only garbage.
> 
>     Example:
>         ssh -l root -i ./.ssh/identity server1 cat /tmp/test.tar.gz >
> c:\test.tar.gz
> 
>     The problem is that stdout is opend as Text-File so every LF which comes
>     from the SSH-Server (Unix) will be translated to CR LF
>     on a Win32-Machine.
> 
>     The problem can be fixed by adding following line to the beginning of
>     the clientloop-function:
> 
>         setmode(fileno(stdout), O_BINARY);

Sorry, no. That's incorrect. You are moving a typical and heavily
discussed problem of stdout filemode in Cygwin to ssh.

Ssh can't and must not decide about the mode of stdout. The same
problem as it's for `cat'. The mode of stdout is dependent of the
mode of the underlying mount point of the file written to (if any).
You will find this discussed in detail in the Cygwin mailing list
archive.

If you want to be sure to copy binary use scp.

Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen at redhat.com





More information about the openssh-unix-dev mailing list