# MacOSX 10.6.7 cuts off stdin at 1024 chars

buffercatmacosterminal

I've written a little perl script that I invoke as follows:

perl -pe'...' <a


I wanted to copy the contents of the input file 'a' from a web browser (a whole wordpress blog entry, to be exact). The copy part works perfectly, the full contents show up in ClipMenu. But when I try to paste it into a file using cat and redirect:

cat >a


It emits exactly 1024 characters, then stops accepting input – only CTRL-C can help. I've tried pasting only 1023 bytes/chars, and that works, after pressing enter, I could enter it into the file without any problems. But if I entered 1024 chars on a single line, there was no way to do anything else other than CTRL-C.

I've tried iTerm and Terminal.app, both show the exact same behavior. I've tried bash from macports and /bin, with the exact same results. I've even tried dd:

dd bs=1M of=a


To the exact same result. Nothing seems to help.

I'm clueless – why does this happen? And how could I copy-paste into a file on Mac OS X easily, and in a way that I can be sure the contents are not altered in any way?