Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you don't open the files as binary, the script doesn't do what it's supposed to.


from the manpage of cat(1) my emphasis:

"cat - concatenate files and print on the standard output"

Cat has quite a few options that clearly deal with text files: --number-nonblank, --show-ends, --number, -show-tabs, --show-nonprinting, --squeeze-blank ...

BSD cat[1] is a little more conservative, but it's not entirely clear cut that when printing to standard output (or reading from standard input) you want binary mode. And silently copying a binary stream to a text stream does sound like a bug. Even if that is the expected behaviour of standard "cat".

[1] http://www.freebsd.org/cgi/man.cgi?cat(1)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: