zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: SIGPIPE (Re: ZSH history not saved anymore)
Date: Mon, 29 Sep 2014 09:45:51 +0100	[thread overview]
Message-ID: <20140929094551.5d0256f6@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <140928131627.ZM4749@torch.brasslantern.com>

On Sun, 28 Sep 2014 13:16:27 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Sep 28,  7:18pm, Peter Stephenson wrote:
> }
> } So in the first case I presume we're exiting (silently) on SIGPIPE.  That
> } should be just a question of checking if SIGPIPE is trapped and if it isn't
> } setting the handler to the default in entersubsh().  There's some partial
> } prior art for this.
> 
> It gets a little stranger - this is again before the patch:
> 
> torch% TRAPPIPE() { : }                                              
> torch% (sleep 5; echo hello; print -u2 $sysparams[pid] continued after PIPE) |
> (exit)
> TRAPPIPE: write error: broken pipe
> echo: write error: broken pipe
> zsh: write error: broken pipe
> 3579 continued after PIPE
> 
> 
> Why did TRAPPIPE() receive a SIGPIPE?  And then:

I think we're looking at this in execcmd() or similar chunks.

		/* It's a builtin */
		if (forked)
		    closem(FDT_INTERNAL);
		lastval = execbuiltin(args, (Builtin) hn);
		fflush(stdout);
		if (save[1] == -2) {
		    if (ferror(stdout)) {
			zwarn("write error: %e", errno);
			clearerr(stdout);
		    }
		} else
		    clearerr(stdout);

so it doesn't necessarily mean there's a signal, just that there's a
broken pipe.  Maybe the fflush() is enough to trigger setting errno
again if it failed to write the first time?

pws


  reply	other threads:[~2014-09-29  8:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87mw9qdp7s.fsf@thinkpad-t440p.tsdh.org>
     [not found] ` <20140924200710.2f764272@pws-pc.ntlworld.com>
     [not found]   ` <8738bg2n1v.fsf@thinkpad-t440p.tsdh.org>
     [not found]     ` <140926000448.ZM30835@torch.brasslantern.com>
     [not found]       ` <878ul6lrw9.fsf@thinkpad-t440p.tsdh.org>
     [not found]         ` <CABx2=D9xdeJ0qDNayUG0astemFEtK13SLpA3j8UQT5EqHW_PmA@mail.gmail.com>
     [not found]           ` <87y4t66td0.fsf@thinkpad-t440p.tsdh.org>
     [not found]             ` <CABx2=D-chwqBDZLTk8OqeUDqxvnYUQFFKWbiw7h3ZgUGtSb_CQ@mail.gmail.com>
     [not found]               ` <871tqxqyil.fsf@thinkpad-t440p.tsdh.org>
2014-09-27 17:53                 ` Bart Schaefer
2014-09-27 20:40                   ` Peter Stephenson
2014-09-27 23:55                     ` Bart Schaefer
2014-09-28 18:04                       ` Bart Schaefer
2014-09-28 18:18                         ` Peter Stephenson
2014-09-28 20:16                           ` Bart Schaefer
2014-09-29  8:45                             ` Peter Stephenson [this message]
2014-09-29 15:29                               ` Bart Schaefer

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=20140929094551.5d0256f6@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).