[Mono-bugs] [Bug 489019] mono throwing exception while closing file descriptor 0

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 20 16:12:57 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=489019

User miguel at novell.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=489019#c26





--- Comment #26 from Miguel de Icaza <miguel at novell.com>  2009-04-20 14:12:56 MDT ---
I am saying that the patch above is *wrong* and should not be done in the Mono
side of things, it should be done by whoever is calling Mono.

Every Unix library hardcodes the following POSIX file descriptors for standard
output and error:

STDIN_FILENO, STDOUT_FILENO and STDERR_FILENO

These should never be closed because they interact badly with system libraries.

Consider a root C program whose 0, 1 and 2 file descriptors were closed and
then proceeds to open, say /etc/resolv.conf and happens to get 2.   During this
process a library notices something and logs an error to stderr, what we end up
with is a corrupt file.

Descriptors 0, 1 and 2 should *always* be assigned unless you control entirely
the software stack.

The fix that was provided by the Mono team is a band-aid, the *correct* fix is
for the caller to *NOT* do this in the first place.   And I would like the CASA
team to actualy fix this problem at the *real* spot instead of asking us to put
a workaround for this broken behavior that is breaking *every* Unix practice.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list