Programmer’s have to deal with the automatic [LF] <=> [CRLF] conversion
on DOS/Windows based systems regardless of the programming language they
use.
I’d say that reading a bunch of bytes without caring what they are is
basic and common functionality.
My daytime job mostly consists of doing Windows C++ and Java programming
(and attempts to to introduce some Ruby along the way, where
possible/appropriate).
On Windows, using native Win32 API, I can (and do) open a file, read a
bunch of bytes (or all of them), and write that to some other file/buffer as
it is, with no fuss and without ever wondering if something happened with
those bytes in the meantime. Ok, I have to set up some silly flags that
don’t mean much most of the time, but none of them relate to binary/text
properies of the file.
In Java, I open a plain FileInputStream, and read all the byte that I
need, manipulate them and write them to some other OutputStream without ever
thinking about LF/CRLF conversion.
It happened that cygwin Ruby builds that I was using (before the mswin32
builds started appearing) behaved in the same way.
Therefore, I do it every day, in both languages, without ever having to
deal with LF/CRLF conversion, as long as I don’t care much about the meaning
of that content, as, in this particular insance, I don’t.
Your experience is not specific to Ruby.
My experience is, in this instance, specific to Ruby.
Cygwin has an installation option how it should handle text files: same
as on unix (i.e. all files are effectively treated as binary), or same
as on a DOS system. You had luck and chose the unix option.
You can say that it was luck, but not as you describe it.
I never got to installing cygwin by itself, I just installed the PragProg
cygwin Ruby build and that is how it behaved out of the box.
And it was good. 
But thanks for the tip, if I ever get to install cygwin I will keep an eye
on this.
Of course. If you want binary, then by all means say so. It’s not ruby’s
fault that Billyboy had to introduce this trap for you.
From your general tone I sense that something in my post has upset you, and
I’m sorry that something I wrote made you … upset.
It’s not about “ruby’s fault”, nor “faults” at all, nor Billyboy.
It’s just about wanting to be able to “trust” libraries and software
written by other people.
If using other people’s code involves having to grep for all possible
occurences of “open” then this pretty much defeats the idea of reusability,
code sharing, and portability, especially if it’s some not so small LOC
number. At least for those of us that choose or are forced to run stuff both
on Linux and Windows.
I suppose it would be good to have it fixed in mswin32 build, since a
major
No! Ruby is not the place to fix OS design flaws.
IMHO, it’s not so much about fixing OS design flaws, as it is about
providing proper abstractions for both high (such as string) and low (such
as “bunch of bytes”) level concepts, and hiding or exposing those
abstractions from/to the user, and making those abstractions behave the same
on as much OSes as possible. Things like POSIX and Cygwin are a proof that
this is possible up to some (at least for me) acceptable level.
We would get user complaints like "I cannot open the textfile output from
your ruby script in my notepad editor" if ruby would attempt to “fix” it.
(Try it!)
Let me paraphrase you - software that we make isn’t the right place to fix
MS Notepad design flaws. 
I have a good idea on how those files look like, I get them every now and
then, and I don’t use notepad. UEdit recognizes them and offers to convert
them to DOS format.
practical consequence is that libraries and programs that don’t take
this
into consideration (like those done on Unix flavors and used on Win32)
will
break.
Yes, this is a problem. But the fix for it has to be done in these
libraries.
Send a bug report to the author of the library.
Since I’ve been flamed for a simple warning post, I can only imagine what
kind of flames would I be exposed to if I wrote to some unknown hard core
Linux proponent: “Your software doesn’t work on my Windows box. Fix it.”
But I realy don’t think of it as a library bug. Most of the people on this
list (people using Ruby in it’s native Linux environment) don’t care about
Ruby on Windows, and most probably shouldn’t.
Once again - it’s not about blame, and it’s not about “ruby’s fault” (as
you seem to have taken this).
It was just a warning “not to do as I have done”, along with a wish that it
is fixed “in one place only”, not “in all the libraries that were, are and
will be written”.
If it would make you happy, I can rephrase the warning as: “don’t be
stupid as I was to think that open(file).read() will behave the same on all
versions of Ruby”. There.
Regards,
M.
···
From: “Tobias Peters” t-peters@invalid.uni-oldenburg.de