Pasting via ssh causes data loss

Eugene Pimenov libc.mail at gmail.com
Sat Nov 29 22:19:40 PST 2008


Hello everyone,

I'm not really sure weither it's related to freebsd or ssh.

When I paste a lot of data (6060 bytes, 60 lines 100 bytes each +  
‘\n’) via ssh into `cat > test.txt` or the small program, one freebsd  
receives 5181, another receives 3221 bytes.

The number of bytes freebsd receives are always the same.

I can't reproduce this on linux (OpenSSH 4.3p2 on debian and OpenSSH  
4.7p1 on 2 gentoo boxes). Also, I have one freebsd box without this  
problem (7.0-STABLE, openssh 4.5p1).

Source of the small program:

   #include <stdio.h>

   int main()
   {
       char buf[10000];
       size_t readed = 0;
       while(!feof(stdin)) {
           readed+=fread(buf, 1, sizeof(buf), stdin);
       }

       printf("I've received %d bytes\n", readed);
       return 0;
   }

Versions of sshd are “OpenSSH_4.5p1 FreeBSD-20061110, OpenSSL 0.9.8e  
23 Feb 2007”. FreeBSD versions are FreeBSD 7.0-BETA4 and FreeBSD 7.0- 
RELEASE.

Why is it happening? What should I do to stop this? It's pretty  
annoying.

~




More information about the freebsd-questions mailing list