From: Tanaka Akira Date: 2010-01-06T02:24:54+09:00 Subject: [ruby-core:27427] Re: closing of the stderr pipe not detected - issue in 1.9.1? 2010/1/6 Robert Klemme : > > Thank you for the hint! Why should I do this? Does Ruby somehow > prevent the stream to be closed in order to be able to deliver error > messages? The standard input/output/error may be used by external library. So error messages may be produced for stderr (fd 2) even if Ruby closes stderr. If we close stderr (fd 2), fd 2 is reused for next fd allocation: open(), socket(), etc. If fd 2 is used for a socket, the error message is sent to the server. If fd 2 is used for a database (dbm), the error message break it. Another example is CVE-2002-0572. (It doesn't use close, though) So I think the standard input/output/error should not be closed. reopen doesn't have the problems because stderr is not reused because it is still open (to /dev/null). -- Tanaka Akira