Re: [PATCH 0/2] open() error checking
- From
Thomas Rast <trast@inf.ethz.ch>
- Date
- Jul 16, 2013, 09:25 UTC
- Message-ID
- <87hafukga9.fsf@linux-k42r.v.cablecom.net>
- In-Reply-To
- <7vtxjzlmaf.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 19 quoted lines
> Thomas Rast <trast@inf.ethz.ch> writes: > >> 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