zsh-workers
 help / color / mirror / code / Atom feed
* Possible redirection bug in zsh 5x
@ 2016-03-06 17:22 Kynn Jones
  2016-03-06 18:59 ` Kynn Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Kynn Jones @ 2016-03-06 17:22 UTC (permalink / raw)
  To: zsh-workers

(NB: I originally posted something very close to the message below as
a unix.stackexchange.com question, but it got no answers.  I took this
as confirmation that this may indeed be a bug.)

---

The following command produces different outputs in zsh v. 4.x and 5.x:

    {
      (
        printf "X\nY\n"
        printf "WARNING: foo\nWARNING: bar\n" >&2
        printf "1\n2\n"
      ) 2>&1 >&3 | grep -v foo >&2
    } 3>&1

(This code is supposed to illustrate how to selectively suppress some
of the output sent to stderr by a program; in this case, the warning
`foo` is being suppressed selectively, while the warning `bar` is
allowed to go through; note that in the end, `stderr` and `stdout`
streams remain separate.)

On v 4.x the output I see at the terminal is as desired/expected:

    X
    Y
    1
    2
    WARNING: bar

(You may see a different ordering of the `WARNING: bar` line relative
to the other ones.)

[NB: as pointed out in a comment to my unix.stackexchange.com
question, both bash and dash also produce the output shown above.]

On v 5.0.7 (Debian) and 5.1.1 (Darwin), however, what I see at the
terminal is this:

    X
    Y
    1
    2
    WARNING: bar
    X
    Y
    1
    2

IOW, the lines that should be sent to `stdout` appear twice.

I figure there are three possibilities:

  1. this is a bug in v. 5.x (in which case my question is: is there a
workaround?)
  2. I have not properly configured my v. 5.x zsh (in which case my
question is: how should I configure my v. 5.x zsh to get the desired
behavior?);
  3. [very unlikely, in light of the results for bash and dash] there
is a bug in v. 4.x, but not in v. 5.x, that masked a bug in my code
(in which case my question is: how could I fix my code to get the
desired behavior in v 5.x?)

Thank you in advance,

kj


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

* Re: Possible redirection bug in zsh 5x
  2016-03-06 17:22 Possible redirection bug in zsh 5x Kynn Jones
@ 2016-03-06 18:59 ` Kynn Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Kynn Jones @ 2016-03-06 18:59 UTC (permalink / raw)
  To: zsh-workers

Please, disregard my earlier message.

On Sun, Mar 6, 2016 at 12:22 PM, Kynn Jones <kynnjo@gmail.com> wrote:

> I figure there are three possibilities:
>
>   1. this is a bug in v. 5.x (in which case my question is: is there a
> workaround?)
>   2. I have not properly configured my v. 5.x zsh (in which case my
> question is: how should I configure my v. 5.x zsh to get the desired
> behavior?);
>   3. [very unlikely, in light of the results for bash and dash] there
> is a bug in v. 4.x, but not in v. 5.x, that masked a bug in my code
> (in which case my question is: how could I fix my code to get the
> desired behavior in v 5.x?)

I learned from an answer to my unix.stackexchange.com question that
the reason for the behavior I observed is that I have the multios
option enabled.

Sorry for the false alarm.

Thanks,

kj


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

end of thread, other threads:[~2016-03-06 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-06 17:22 Possible redirection bug in zsh 5x Kynn Jones
2016-03-06 18:59 ` Kynn Jones

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