zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: Re: Strange parameter visibility
Date: Thu, 29 Sep 2016 14:28:21 -0700	[thread overview]
Message-ID: <160929142821.ZM16694@torch.brasslantern.com> (raw)
In-Reply-To: <20160929180301.5d1930d0@pwslap01u.europe.root.pri>

On Sep 29,  6:03pm, Peter Stephenson wrote:
} Subject: Re: Strange parameter visibility
}
} This appears to be harder.
} 
} % unset x
} % : ${x:=2} | echo $x
} 2
} 
} In this case, we don't know at the point where we start the pipeline
} whether we're going to be in the current shell or not.

Hrm.  But:

% y=3 : ${z:=2} | echo $y $z

% 

Why do we know *there* that we should fork before expanding ${z:=2},
when we don't know in the absence of the y=3 prefix?  Or is something
completely different happening, e.g., save_params() / restore_params()
that I was looking at before?

Under what circumstances is it possible to do anything useful with a
pipe without forking the left side?

I tried reducing the test that you changed in 39502 to looking at
nothing but (how & Z_SYNC) and the only Test/* to fail are the ones
looking at $pipestatus and setopt pipefail -- and as it happens I
can make the pipefail test fail by using /bin/true and /bin/false
in place of the builtin true and false, so there may be something
deeper wrong there anyway.

==========
 0
 1
 1
-2
+1
Test ./E01options.ztst failed: output differs from expected as
shown above for:
  (setopt pipefail
  /bin/true | /bin/true | /bin/true
  print $?
  /bin/true | /bin/false | /bin/true
  print $?
  exit 2 | /bin/false | /bin/true
  print $?
  /bin/false | exit 2 | /bin/true
  print $?)
Was testing: PIPE_FAIL option
==========

I can also make the $pipestatus test fail (one time in the 2048 loops
it performs) by using "exit 2" instead of "return 2" on the left sides
of the pipelines.  (Test/A05execution.ztst)

However, I get those failures on only one of the two hosts where I tried.
So these likely are still some kind of race condition.

} If the command is external we want to keep the current code (not sure
} where this gets hairy otherwise but it does).

Whether the command is external doesn't seem to matter, unless you mean
the command on the right-hand side of the pipe.

} Other cases people find are likely to be similar to this one.

Indeed.


  reply	other threads:[~2016-09-29 21:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20160917181339eucas1p24d214aa618aa96b5a8ddfbf351598da6@eucas1p2.samsung.com>
     [not found] ` <87bmzmtmzq.fsf@alfa.kjonca>
     [not found]   ` <831b307a-a00f-1df7-5136-17fcb769ccaf@gmx.com>
     [not found]     ` <CAH+w=7YtacLo6aY9gT5V27xYbh-wz0Tot1kbPxBiWN1ZXpavRA@mail.gmail.com>
2016-09-18  4:55       ` Bart Schaefer
2016-09-29 16:24   ` Peter Stephenson
2016-09-29 17:03     ` Peter Stephenson
2016-09-29 21:28       ` Bart Schaefer [this message]
2016-09-29 21:36         ` Bart Schaefer
2016-09-30  8:50         ` Peter Stephenson
2016-09-30  9:36           ` Peter Stephenson
2016-09-30 13:50             ` Peter Stephenson
2016-09-30 19:06               ` 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=160929142821.ZM16694@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).