Pasting via ssh causes data loss

Eugene Pimenov libc.mail at
Mon Dec 1 01:21:26 PST 2008

On 1 дек, 05:03, Chris <eaglet... at> wrote:
> I was curious about your situation and set up a couple of tests. Noting
> you mentioned iTerm, I thought I might be able to recreate it on a Mac
> (OS-X 10.4 with 1.4.3 (100) version Terminal, I had removed iTerm due
> to unreliability sometime back).

I've downloaded iTerm for this test. I'm using Apple's

> I copied a 23094 byte program I was working on locally in MacVIM. I
> first did
> a cat >testfile then pasted through an ssh connection
> over satellite (very
> bad connection) into a FreeBSD 7.0 box I built in the last month. At
> the far end it received 23094 bytes. sftp of the file to the remote and
> diff showed no differences. I then opened an ssh session to a FreeBSD
> server
> on my local lan and repeated with the same results. No problems.

I believe that FreeBSD fetches all data. When I ssh back to my mac
from FreeBSD, I recieve all data all the time. TCP should handle
so nothing surprising here.

> The problem does not appear to be obvious or common so there must be
> something
> unique about how this situation if you have reproduced it on two
> different terminal programs using ssh that would work correctly to other
> servers using the same shell and collection method (e.g. cat >blah).

I tried zsh, sh, bash and my program on the freebsd box.

> Something missing here. Have you checked if you have
> errors shown on the interface of the server? Are there losses if you
> sftp
> the files from your machine to the remote (Try pushing a 1.5 MB file and
> see if that shows failures). Did you install something other than the
> default
> OpenSSH on the server? Do the text files have something other than text
> in them or even control sequences for the remote? Just taking
> potshots here.

sftp doesn't lose data. Even cat file | ssh host 'cat >file' doesn't.
Only pasting.
It's 100% reproducible, I don't think it's some kind of side effect.

$ netstat -I bge0
Name    Mtu Network       Address              Ipkts Ierrs    Opkts
Oerrs  Coll
bge0   1500 <Link#1>      00:a0:d1:e3:fd:9c 55134708     0
48858321     0     0
(no errors)

Terminal sessions:

I believe nothing strange was installed on the server... it's a
typical freebsd web-server.

> A somewhat side note here, I would personally never think to move
> files this
> way since it's quite possible that content of files can disrupt the
> stream.
> I tend to use sftp.

I never do that for binary files. I use sftp either. However, when I
need to
change some source on a server, I already have an opened text editor
with the file and a terminal, in that case cat >file is just quickier.

BTW, thank you for your help, guys...

More information about the freebsd-questions mailing list