zsh-users
 help / color / mirror / code / Atom feed
From: Yuri D'Elia <wavexx@users.sourceforge.net>
To: zsh-users@zsh.org
Subject: Re: precmd: write error: interrupted
Date: Thu, 25 Apr 2013 21:38:13 +0200	[thread overview]
Message-ID: <klc0n1$34u$1@ger.gmane.org> (raw)
In-Reply-To: <130425111646.ZM17258@torch.brasslantern.com>

On 04/25/2013 08:16 PM, Bart Schaefer wrote:
> On Apr 25,  6:47pm, Yuri D'Elia wrote:
> }
> } I still have the error, as I didn't find any way to silence it (braces
> } around print do not work?!).
>
> That's curious, but try using parentheses to force a fork and redirect
> the stderr of the subshell.

This, of course, works. But I wouldn't want to fork here just to ignore 
the error message.

> } I have no idea which write is actually failing in that function (I
> } suppose it's some "fputs" in bin_print).
>
> strace should be able to show you what bytes are being written, which
> would narrow it down.

not really, apart from the "write error:" which I already knew. But 
there are only two possible points in bin_print, and I'm using the 
"unformatted" case.

> } 2) Why "precmd() { { print "HELLO" }>&- 2>&-; } doesn't suppress the
> } error in this case?
>
> It's not the same error.  Try 2>/dev/null instead of 2>&- ... with the
> stderr closed, you're actually getting a second error from outside the
> braces, about not being able to write the first error from inside!

You are right. I pasted one of my numerous trials in an attempt to 
exploit the EBADF errno.

But anyway:

precmd() { { print x } 2>/dev/null }

still doesn't suppress the error.

By looking at bin_print, zwarnnam is used.

In the "normal output case" (Src/builtin.c:6310) there's an explicit 
test for >&- redirection of stdout, and that's it. I see nothing in 
zwarnnam except for the noerrs global that would allow error redirection 
to work in lists.

Maybe there's a builtin to force "noerrs" instead?


  parent reply	other threads:[~2013-04-25 19:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-25 16:47 Yuri D'Elia
2013-04-25 17:44 ` Yuri D'Elia
2013-04-25 18:27   ` Bart Schaefer
2013-04-25 18:16 ` Bart Schaefer
2013-04-25 18:38   ` Peter Stephenson
2013-04-25 22:18     ` Bart Schaefer
2013-04-26  0:52       ` Bart Schaefer
2013-04-25 19:38   ` Yuri D'Elia [this message]
2013-04-26  0:53     ` Bart Schaefer
2013-04-25 20:05   ` Yuri D'Elia
2013-04-25 20:58     ` Yuri D'Elia
2013-04-26 15:08     ` Bart Schaefer
     [not found]     ` <130426080805.ZM18619__18102.73175729$1366989065$gmane$org@torch.brasslantern.com>
2013-04-26 17:59       ` Yuri D'Elia

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='klc0n1$34u$1@ger.gmane.org' \
    --to=wavexx@users.sourceforge.net \
    --cc=zsh-users@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).