git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Bart Trojanowski <bart@jukie.net>
Subject: Re: [RFC/PATCH] avoid SIGPIPE warnings for aliases
Date: Thu, 10 Jan 2013 05:49:30 -0500	[thread overview]
Message-ID: <20130110104930.GA21993@sigill.intra.peff.net> (raw)
In-Reply-To: <7vehhu3u2y.fsf@alter.siamese.dyndns.org>

On Wed, Jan 09, 2013 at 01:49:41PM -0800, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > But we still say "error: ... died of signal 13", because that comes from
> > inside wait_or_whine. So it is a separate issue whether or not
> > wait_or_whine should be silent on SIGPIPE (we already are on SIGINT and
> > SIGQUIT, as of some recent patches).
> >
> > The upside is that it is noise in this case that we would no longer see.
> > The downside is that we may be losing a clue when debugging server
> > problems, which do not expect to die from SIGPIPE.  Should it be an
> > optional run-command flag?
> 
> Do we know if we are upstream of a pager that reads from us through
> a pipe (I think we should, especially in a case where we are the one
> who processed the "git -p $alias" option)?  Is there any other case
> where we would want to ignore child's death by SIGPIPE?  If the
> answers are yes and no, then perhaps we can ask pager_in_use() to
> decide this?

The answer to the first is unfortunately no. Consider an alias like
"[alias]foo = !git log" (which yes, you could implement as just "log",
but there are cases where you want to manipulate the environment and we
do not allow it).

Your process tree for running "git foo" looks like:

  git foo               (A)
    git log             (B)
      less              (C)

The user hits 'q', which kills process C. Process B then dies due to
SIGPIPE, and process A sees that the alias command died due to a signal.
But process A has no clue that a pager is in effect; only process B,
which spawned the pager, can know that. So A cannot see death-by-SIGPIPE
and make a decision on whether a pager was in use.

If anything, it is process B's responsibility to say "Oops, I was killed
by SIGPIPE. But that's OK, it's not a big deal to me". Which it could do
by installing a SIGPIPE handler that just calls exit(0).

-Peff

  parent reply	other threads:[~2013-01-10 10:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-04 12:47 [RFC/PATCH] avoid SIGPIPE warnings for aliases Jeff King
2013-01-04 16:55 ` Johannes Sixt
2013-01-04 21:25   ` Jeff King
2013-01-04 22:20 ` Junio C Hamano
2013-01-05 14:03   ` Jeff King
2013-01-05 14:49     ` [PATCH] run-command: encode signal death as a positive integer Jeff King
2013-01-05 19:50       ` Johannes Sixt
2013-01-05 22:19       ` Jonathan Nieder
2013-01-05 23:12         ` Jeff King
2013-01-05 23:58           ` Jonathan Nieder
2013-01-06  7:05       ` Junio C Hamano
2013-01-09 20:48 ` [RFC/PATCH] avoid SIGPIPE warnings for aliases Junio C Hamano
2013-01-09 20:51   ` Jeff King
2013-01-09 21:49     ` Junio C Hamano
2013-01-10  0:18       ` Jonathan Nieder
2013-01-10  0:39         ` Junio C Hamano
2013-01-10 11:26         ` Jeff King
2013-01-10 20:22           ` Junio C Hamano
2013-01-10 21:39             ` Jeff King
2013-01-10 21:52             ` Johannes Sixt
2013-01-10 22:51               ` Junio C Hamano
2013-01-10 10:49       ` Jeff King [this message]
2014-07-21  6:45 ` mimimimi

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130110104930.GA21993@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bart@jukie.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).