Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 0/2] open() error checking

From: Thomas Rast <hidden>
Date: 2016-06-15 22:58:11

Junio C Hamano [off-list ref] writes:
Thomas Rast [off-list ref] writes:
quoted
I originally had a four-patch series to open 0/1/2 from /dev/null, but
then I noticed that this was shot down in 2008:

  http://thread.gmane.org/gmane.comp.version-control.git/93605/focus=93896
The way I recall the thread was not "shot down" but more like
"fizzled out without seeing a clear consensus".  As a normal POSIX
program, we do rely on fd#2 connected to an error stream, and I do
agree with the general sentiment of that old thread that it is very
wrong for warning() or die() to write to a pipe or file descriptor
we opened for some other purpose, corrupting the destination.

I briefly wondered if we can do the sanity check lazily (e.g. upon
first warning() see of fd#2 is open and otherwise die silently), but
we may open a fd (e.g. to create a new loose object) that may happen
to grab fd#2 and then it is too late for us to do anything about it,
so...
I think we'd have to do it on startup.  Since we do many things already,
a few extra dup calls should hardly matter.

I'll send the patches in reply in a minute, I had them lying around
already.  But if you (again) decide that it's not worth it, I don't care
too deeply.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help