zsh-workers
 help / color / mirror / code / Atom feed
* broken pipe with prompt -h
@ 2002-06-29 11:34 Adam Spiers
  2002-06-29 17:17 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Spiers @ 2002-06-29 11:34 UTC (permalink / raw)
  To: zsh workers mailing list

In attempts to counter my previous foolishness for initially making
'8bit' the default display mode for my adam2 prompt, and then swapping
it around so that 'plain' is the default, I've found myself wanting to
check from within my .zshrc which version of adam2 is available in the
installed zsh:

  $ prompt -h adam2 | grep -q 8bit

However, due to some signal-trapping related funniness, if grep finds
a match early enough, set_prompt gets a SIGPIPE:

  $ prompt -h adam2 | grep -q plain
  set_prompt:52: write error: broken pipe
  set_prompt:53: write error: broken pipe

I tried to fix this with a

  trap '' PIPE

just after the 'setopt localtraps' in set_prompt and in various other
places, but it only occasionally works, which is very curious.  Can
anyone please tell me the correct fix?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: broken pipe with prompt -h
  2002-06-29 11:34 broken pipe with prompt -h Adam Spiers
@ 2002-06-29 17:17 ` Bart Schaefer
  2002-07-03 17:08   ` Adam Spiers
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2002-06-29 17:17 UTC (permalink / raw)
  To: Adam Spiers, zsh-workers

On Jun 29, 12:34pm, Adam Spiers wrote:
} Subject: broken pipe with prompt -h
}
}   $ prompt -h adam2 | grep -q plain
}   set_prompt:52: write error: broken pipe
}   set_prompt:53: write error: broken pipe

This is a result of the changes in zsh-workers/16503 to cause bin_print()
to report write errors.  There was a follow-on patch in 16556 to suppress
the errors when stdout is closed.  EPIPE might be another error worthy of
suppression.

} I tried to fix this with a
} 
}   trap '' PIPE
} 
} just after the 'setopt localtraps' in set_prompt and in various other
} places, but it only occasionally works, which is very curious.

Trapping SIGPIPE doesn't prevent errno from being set to EPIPE on the
write failure, it just prevents the process from getting signaled when
the EPIPE occurs.

} Can anyone please tell me the correct fix?

Other than redirecting stderr, I don't think there is one.  It'd be the
right idea to do	trap 'ERRNO=0' PIPE	but ERRNO is read-only.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: broken pipe with prompt -h
  2002-06-29 17:17 ` Bart Schaefer
@ 2002-07-03 17:08   ` Adam Spiers
  2002-07-03 19:21     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Adam Spiers @ 2002-07-03 17:08 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer (schaefer@brasslantern.com) wrote:
> On Jun 29, 12:34pm, Adam Spiers wrote:
> } Subject: broken pipe with prompt -h
> }
> }   $ prompt -h adam2 | grep -q plain
> }   set_prompt:52: write error: broken pipe
> }   set_prompt:53: write error: broken pipe
> 
> This is a result of the changes in zsh-workers/16503 to cause bin_print()
> to report write errors.  There was a follow-on patch in 16556 to suppress
> the errors when stdout is closed.  EPIPE might be another error worthy of
> suppression.

Ahah.

> } Can anyone please tell me the correct fix?
> 
> Other than redirecting stderr, I don't think there is one.  It'd be the
> right idea to do	trap 'ERRNO=0' PIPE	but ERRNO is read-only.

I just upgraded from RedHat 7.3's rpm of 4.0.4 to 4.1.0-dev-5 and the
warning's gone.  Was that supposed to happen?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: broken pipe with prompt -h
  2002-07-03 17:08   ` Adam Spiers
@ 2002-07-03 19:21     ` Bart Schaefer
  2002-07-04 12:12       ` Adam Spiers
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2002-07-03 19:21 UTC (permalink / raw)
  To: Adam Spiers, zsh-workers

On Jul 3,  6:08pm, Adam Spiers wrote:
} Subject: Re: broken pipe with prompt -h
}
} Bart Schaefer (schaefer@brasslantern.com) wrote:
} > 
} > This is a result of the changes in zsh-workers/16503 to cause bin_print()
} > to report write errors.  There was a follow-on patch in 16556 to suppress
} > the errors when stdout is closed.  EPIPE might be another error worthy of
} > suppression.
} 
} I just upgraded from RedHat 7.3's rpm of 4.0.4 to 4.1.0-dev-5 and the
} warning's gone.  Was that supposed to happen?

I don't know.  Based on looking at a CVS diff of 4.0.4 --> current, I'm
surprised RedHat's version gave the error at all.  They may have applied
some patches?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: broken pipe with prompt -h
  2002-07-03 19:21     ` Bart Schaefer
@ 2002-07-04 12:12       ` Adam Spiers
  0 siblings, 0 replies; 5+ messages in thread
From: Adam Spiers @ 2002-07-04 12:12 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer (schaefer@brasslantern.com) wrote:
> On Jul 3,  6:08pm, Adam Spiers wrote:
> } Subject: Re: broken pipe with prompt -h
> }
> } Bart Schaefer (schaefer@brasslantern.com) wrote:
> } > 
> } > This is a result of the changes in zsh-workers/16503 to cause bin_print()
> } > to report write errors.  There was a follow-on patch in 16556 to suppress
> } > the errors when stdout is closed.  EPIPE might be another error worthy of
> } > suppression.
> } 
> } I just upgraded from RedHat 7.3's rpm of 4.0.4 to 4.1.0-dev-5 and the
> } warning's gone.  Was that supposed to happen?
> 
> I don't know.  Based on looking at a CVS diff of 4.0.4 --> current, I'm
> surprised RedHat's version gave the error at all.  They may have applied
> some patches?

Nope, no patches.  Here's the source tree in question if it's any use:

a96a467d332071cad162b0b010f0d19e  cvs/redhat/SOURCES/zsh-4.0.4.tar.bz2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-07-04 12:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-29 11:34 broken pipe with prompt -h Adam Spiers
2002-06-29 17:17 ` Bart Schaefer
2002-07-03 17:08   ` Adam Spiers
2002-07-03 19:21     ` Bart Schaefer
2002-07-04 12:12       ` Adam Spiers

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