git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuval Kogman <nothingmuch@woobling.org>
To: Tay Ray Chuan <rctay89@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Don't try to reclose in command_close_bidi_pipe
Date: Fri, 30 Jan 2009 17:06:11 +0200	[thread overview]
Message-ID: <a891e1bd0901300706h4fdffe24m78c418f8c1ae7cd8@mail.gmail.com> (raw)
In-Reply-To: <be6fef0d0901300635v4e6009f1n7da405ebc4c8dd68@mail.gmail.com>

Resending, forgot to CC

2009/1/30 Tay Ray Chuan <rctay89@gmail.com>
> From this message, you seem to intend this as a fix. Can you tell us
> how one might go about to reproduce this issue?

Here is an example:
http://github.com/yanick/git-cpan-patch/blob/ed67d3f86f371764935fd0da3e7f08536c95b606/git-cpan-import#L190

Since git-commit-tree requires the message to be written before it can
write the sha1 of the new commit object, the handle has to be closed
already, which makes command_close_bidi_pipe die with an error.
The workaround in the linked code reopens a fake handle so that
close() will not error.
For what it's worth, I've been poking at t/t9700/test.pl but since
it's pretty sparse I figured I should contribute this fix
independently.

> Is "unless defined(fileno($fh))" a reliable way to check if the handle
> is closed?

Yes, since the handle is expected to be the result of a pipe open. The
documentation refers to this case:

    open my $fh, "<", \$buffer;

in which case the filehandle $fh has no associated file descriptor.

fileno() is not a universal check, but it is applicable in this situation.

  reply	other threads:[~2009-01-30 15:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-30  4:59 [PATCH] Don't try to reclose in command_close_bidi_pipe Yuval Kogman
2009-01-30 14:35 ` Tay Ray Chuan
2009-01-30 15:06   ` Yuval Kogman [this message]
2009-01-31  0:03     ` Tay Ray Chuan

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=a891e1bd0901300706h4fdffe24m78c418f8c1ae7cd8@mail.gmail.com \
    --to=nothingmuch@woobling.org \
    --cc=git@vger.kernel.org \
    --cc=rctay89@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).