git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Johan Herland <johan@herland.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Peter Krefting <peter@softwolves.pp.se>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	Alex Riesen <raa.lkml@gmail.com>
Subject: Re: [PATCH] quickfetch(): Prevent overflow of the rev-list command line
Date: Thu, 09 Jul 2009 14:22:24 +0200	[thread overview]
Message-ID: <4A55E100.9010700@viscovery.net> (raw)
In-Reply-To: <200907091134.45492.johan@herland.net>

Johan Herland schrieb:
> However, using rev-list --stdin is not entirely straightforward: rev-list
> terminates immediately when encountering an unknown object, which can
> trigger SIGPIPE if we are still writing object's to its standard input.
> We therefore ignore SIGPIPE so that the fetch process is not terminated.

I removed the "signal(SIGPIPE, SIG_IGN)", but the test suite still passes.
IOW, there is no test case that has the configuration that you describe
here. Would you please add such a test (perhaps in t5502)? It would also
help me verify the patch works as intended on Windows.

> Signed-off-by: Johan Herland <johan@herland.net>
> Improved-by: Johannes Sixt <j.sixt@viscovery.net>

Please make this <j6t@kdbg.org> despite the email address I'm using right now.

> Improved-by: Alex Riesen <raa.lkml@gmail.com>
> Tested-by: Peter Krefting <peter@softwolves.pp.se>

> +	for (ref = ref_map; ref; ref = ref->next) {
> +		if (write_in_full(revlist.in, sha1_to_hex(ref->old_sha1), 40) < 0 ||
> +		    write_in_full(revlist.in, "\n", 1) < 0) {
> +			err = errno;
> +			if (err != EPIPE && err != EINVAL)
> +				error("failed write to rev-list");
> +			break;
> +		}
> +	}
> +
> +	if (close(revlist.in)) {
> +		err = errno;
> +		error("failed to close rev-list's stdin");
> +	}
> +	return finish_command(&revlist) || err;

The call site of quickfetch() is not interested in the errno, only on
whether the return value is non-zero: You can just assign -1 to err
(that's our convention for failure). OTOH, it would be helpful to include
strerror(errno) in the error message.

Shouldn't you reset signal(SIGPIPE) to its previous value?

-- Hannes

  reply	other threads:[~2009-07-09 12:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-18 13:10 msysgit git-submodule: "Unable to fetch in submodule path ..." Peter Krefting
2009-06-22 12:46 ` Peter Krefting
2009-07-08 13:58   ` [PATCH] quickfetch(): Prevent overflow of the rev-list command line Johan Herland
2009-07-08 15:12     ` Johannes Sixt
2009-07-08 16:01       ` Johan Herland
2009-07-08 17:22         ` Junio C Hamano
2009-07-09  8:43           ` Johan Herland
2009-07-09  8:49             ` Alex Riesen
2009-07-09  8:51             ` Johannes Sixt
2009-07-09  9:07               ` Johan Herland
2009-07-09  9:15                 ` Johannes Sixt
2009-07-09  9:34                   ` Johan Herland
2009-07-09 12:22                     ` Johannes Sixt [this message]
2009-07-09 13:52                       ` [PATCH v3] " Johan Herland
2009-07-09 14:21                         ` Johannes Sixt
2009-07-09 14:32                           ` Jeff King
2009-07-09 14:49                             ` [PATCH v4] " Johan Herland
2009-07-09 16:20                               ` Johannes Sixt
2009-07-09 23:52                                 ` [PATCH v5] " Johan Herland
2009-07-11  6:55                                   ` Junio C Hamano
2009-07-11 10:58                                     ` Johan Herland
2009-07-09 14:42                           ` [PATCH v3] " Johan Herland
2009-07-09 14:56                             ` Johannes Sixt
2009-07-09 15:32                               ` Johan Herland
2009-07-09 16:14                                 ` Johannes Sixt
2009-07-09  8:01         ` [PATCH] " Alex Riesen
2009-07-09  8:37           ` Johan Herland
2009-07-09  8:43             ` Alex Riesen

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=4A55E100.9010700@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johan@herland.net \
    --cc=peter@softwolves.pp.se \
    --cc=raa.lkml@gmail.com \
    --cc=spearce@spearce.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).