git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jim Meyering <jim@meyering.net>
To: "Alex Riesen" <raa.lkml@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-log: detect dup and fdopen failure
Date: Wed, 27 Jun 2007 16:14:13 +0200	[thread overview]
Message-ID: <87tzstmqmi.fsf@rho.meyering.net> (raw)
In-Reply-To: <81b0412b0706270704y58c9e05bh6ec10118d7ee406c@mail.gmail.com> (Alex Riesen's message of "Wed\, 27 Jun 2007 16\:04\:28 +0200")

"Alex Riesen" <raa.lkml@gmail.com> wrote:

> On 6/27/07, Jim Meyering <jim@meyering.net> wrote:
>> "Alex Riesen" <raa.lkml@gmail.com> wrote:
>> > Check if this works in some exotic but common
>> > environments (like MacOSX, Cygwin or HP-UX).
>>
>> What do you mean?
>> I know that dup and fdopen work in those environments.
>
> Exactly as you described?

No, but why does that matter?

> Are you sure fdopen on Cygwin
> sets ENOMEM?

Are you suggesting not to use errno because
it won't contain useful information on Mingw32?

>> It's ok, but for the fact that when dup fails, all you get
>> is the uninformative EINVAL from fdopen.
>
> EBADF on Cygwin, 0 on Mingw32. Can't even imagine what msvc

EBADF is fine.  Setting errno to 0 upon error is a bug.
Don't cater to buggy systems.

> (which actually isn't a developers tool, but very common) will return.
>
>> > (Yes, I do think that "duplicate standard output" is useless,
>> > except for debugging. Exactly as strerror is, but that is shorter).
>>
>> I like to include *something* in the diagnostic so that when someone
>> sees it and reports it developers have an easier time finding where it
>> comes from in the code.  Especially with something as unlikely (and hard
>> to reproduce) as this, that might be useful.
>
> Then put file name and the line number in!

Surely you're playing devil's advocate, now...
If you go that route, you might as well use assert() for both conditions,
and we all know *that* is silly.

  reply	other threads:[~2007-06-27 14:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-27 11:59 [PATCH] detect dup failure Jim Meyering
2007-06-27 12:48 ` Alex Riesen
2007-06-27 13:02   ` [PATCH] git-log: detect dup and fdopen failure Jim Meyering
2007-06-27 13:18     ` Alex Riesen
2007-06-27 13:32       ` Jim Meyering
2007-06-27 14:04         ` Alex Riesen
2007-06-27 14:14           ` Jim Meyering [this message]
2007-06-27 15:57             ` Alex Riesen
2007-06-27 16:34               ` Jim Meyering
2007-06-27 13:54     ` Geert Bosch
2007-06-27 14:06       ` Jim Meyering
2007-06-27 14:28       ` Jim Meyering
2007-06-27 16:49         ` Linus Torvalds
2007-06-28  2:46           ` Josh Triplett
2007-06-28  5:02             ` Shawn O. Pearce

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=87tzstmqmi.fsf@rho.meyering.net \
    --to=jim@meyering.net \
    --cc=git@vger.kernel.org \
    --cc=raa.lkml@gmail.com \
    /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).