Pasting via ssh causes data loss

Mel fbsd.questions at rachie.is-a-geek.net
Sun Nov 30 08:37:19 PST 2008


On Sunday 30 November 2008 06:46:59 Eugene Pimenov wrote:
> 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.

Not sure, but can you copy files via cat? As in:
cat /tmp/foo | ssh machine "cat - >/tmp/foo"

If that isn't truncated, I can only think of clipboard limitations or tty 
issues.

-- 
Mel

Problem with today's modular software: they start with the modules
    and never get to the software part.


More information about the freebsd-questions mailing list