From: Jim Meyering <jim@meyering.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
git@vger.kernel.org, Matthias Lederhofer <matled@gmx.net>
Subject: Re: [PATCH 2/2] Check for IO errors after running a command
Date: Mon, 25 Jun 2007 16:01:48 +0200 [thread overview]
Message-ID: <877ipsw2sz.fsf@rho.meyering.net> (raw)
In-Reply-To: <7vy7i8xtap.fsf@assigned-by-dhcp.pobox.com> (Junio C. Hamano's message of "Mon\, 25 Jun 2007 02\:44\:14 -0700")
Junio C Hamano <gitster@pobox.com> wrote:
> Linus Torvalds <torvalds@linux-foundation.org> writes:
...
>> For example, then we could just do
>>
>> status = p->fn(...);
>> if (status)
>> return status;
>> /* Somebody closed stdout? */
>> if (fstat(fileno(stdout), &st))
>> return 0;
>> /* Ignore write errors for pipes and sockets.. */
>> if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode))
>> return 0;
>>
>> which makes it easy to explain what's going on, and avoids having any deep
>> indentation at all.
>
> I took the liberty of munging your two patches to follow your
> comments above
That has the disadvantage of ignoring *all* pipe and socket write errors.
IMHO, git would be better served if it didn't do that, since writing to
those can fail with EIO and even a new one: EACCES (though this latter
is only for sockets). Also possible, according to POSIX: ENOBUFS.
Of course, one can probably argue that those are all unlikely.
They may be even less likely than an actual EPIPE, but the point is
that people and tools using git plumbing should be able to rely on
it to report such write failures, no matter how unusual they are.
next prev parent reply other threads:[~2007-06-25 14:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-23 15:13 (resend) [PATCH] Don't ignore write failure from git-diff, git-log, etc Jim Meyering
2007-06-24 9:01 ` Junio C Hamano
2007-06-24 17:08 ` Linus Torvalds
2007-06-24 17:10 ` [PATCH 1/2] Clean up internal command handling Linus Torvalds
2007-06-24 17:29 ` [PATCH 2/2] Check for IO errors after running a command Linus Torvalds
2007-06-25 9:44 ` Junio C Hamano
2007-06-25 13:20 ` Johannes Schindelin
2007-06-25 13:42 ` Johannes Sixt
2007-06-25 14:01 ` Jim Meyering [this message]
2007-06-25 15:57 ` Linus Torvalds
2007-06-26 13:33 ` Matthias Lederhofer
2007-06-25 19:54 ` Jim Meyering
2007-06-24 19:13 ` (resend) [PATCH] Don't ignore write failure from git-diff, git-log, etc Jim Meyering
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877ipsw2sz.fsf@rho.meyering.net \
--to=jim@meyering.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=matled@gmx.net \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).