zsh-users
 help / color / mirror / code / Atom feed
* Strange behavior of $jobstates
@ 2018-11-13  4:46 Manabu Matsui
  2018-11-13  7:53 ` dana
  0 siblings, 1 reply; 5+ messages in thread
From: Manabu Matsui @ 2018-11-13  4:46 UTC (permalink / raw)
  To: zsh-users

I found a strange behavior of $jobstates. When I pipe the output of
echo $ jobstates,
its output is empty. This has occurred for zsh 5.6.2 (x86_64-apple-darwin18.0.0)
installed on my mac with homebrew.

% sleep 30
sleep 30
^Z
zsh: suspended  sleep 30
% echo $jobstates
suspended:+:16815=suspended
% echo $jobstates | cat

% echo $jobstates
suspended:+:16815=suspended

This does not occur for zsh 5.4.2 (x86_64-ubuntu-linux-gnu) on ubuntu.

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

* Re: Strange behavior of $jobstates
  2018-11-13  4:46 Strange behavior of $jobstates Manabu Matsui
@ 2018-11-13  7:53 ` dana
  2018-11-14  1:43   ` Manabu Matsui
  0 siblings, 1 reply; 5+ messages in thread
From: dana @ 2018-11-13  7:53 UTC (permalink / raw)
  To: Manabu Matsui; +Cc: zsh-users

On 12 Nov 2018, at 22:46, Manabu Matsui <manabu.matsui@gmail.com> wrote:
>I found a strange behavior of $jobstates. When I pipe the output of
>echo $ jobstates,
>its output is empty.

The difference is the result of faf0035e53 (workers/42702). I guess anything
that previously used information from the current (soon-to-be-parent) shell,
like $jobstates and $sysparams[pid], would be affected that way. Seems
consistent with how the change was described, but i'm not sure

dana


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

* Re: Strange behavior of $jobstates
  2018-11-13  7:53 ` dana
@ 2018-11-14  1:43   ` Manabu Matsui
  2018-11-14  9:27     ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Manabu Matsui @ 2018-11-14  1:43 UTC (permalink / raw)
  To: zsh-users

On 13 Nov 2018, at 16:53, dana <dana@dana.is> wrote:
> The difference is the result of faf0035e53 (workers/42702). I guess anything
> that previously used information from the current (soon-to-be-parent) shell,
> like $jobstates and $sysparams[pid], would be affected that way. Seems
> consistent with how the change was described, but i'm not sure

Thank you for your answer.

Does this mean that the parameter expansion processing is changed from
the parent process before fork to the child process after fork?

As a result of this change, the operation of the parameter expansion
having a side effect also has changed. Is this intended?

Before this change (zsh 5.4.2 (x86_64-ubuntu-linux-gnu)):
% a=1
% echo ${a::=2}|cat
2
% echo $a
2

After this change (zsh 5.6.2 (x86_64-apple-darwin18.0.0)):
% a=1
% echo ${a::=2}|cat
2
% echo $a
1

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

* Re: Strange behavior of $jobstates
  2018-11-14  1:43   ` Manabu Matsui
@ 2018-11-14  9:27     ` Peter Stephenson
  2018-11-15  0:45       ` Manabu Matsui
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2018-11-14  9:27 UTC (permalink / raw)
  To: zsh-users

On Wed, 2018-11-14 at 10:43 +0900, Manabu Matsui wrote:
> As a result of this change, the operation of the parameter expansion
> having a side effect also has changed. Is this intended?
> 
> Before this change (zsh 5.4.2 (x86_64-ubuntu-linux-gnu)):
> % a=1
> % echo ${a::=2}|cat
> 2
> % echo $a
> 2
> 
> After this change (zsh 5.6.2 (x86_64-apple-darwin18.0.0)):
> % a=1
> % echo ${a::=2}|cat
> 2
> % echo $a
> 1

Yes, the change is correct.  Setting a parameter in the left hand side
of the pipeline shouild not affect anything outside the pipeline.

Although the standard doesn't specify which side of the pipeline is run
in a forked copy, in zsh it's always the left hand side, so the fact
that effects were escaping from there was a bug.

pws


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

* Re: Strange behavior of $jobstates
  2018-11-14  9:27     ` Peter Stephenson
@ 2018-11-15  0:45       ` Manabu Matsui
  0 siblings, 0 replies; 5+ messages in thread
From: Manabu Matsui @ 2018-11-15  0:45 UTC (permalink / raw)
  To: zsh-users

On Wed, 14 Nov 2018 09:27:15 +0000, Peter Stephenson
<p.stephenson@samsung.com> wrote:

> Yes, the change is correct.  Setting a parameter in the left hand side
> of the pipeline shouild not affect anything outside the pipeline.
>
> Although the standard doesn't specify which side of the pipeline is run
> in a forked copy, in zsh it's always the left hand side, so the fact
> that effects were escaping from there was a bug.

I

Thank you for the easy-to-understand explanation. t was difficult for
me to understand with ChangeLog description alone.

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

end of thread, other threads:[~2018-11-15  0:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-13  4:46 Strange behavior of $jobstates Manabu Matsui
2018-11-13  7:53 ` dana
2018-11-14  1:43   ` Manabu Matsui
2018-11-14  9:27     ` Peter Stephenson
2018-11-15  0:45       ` Manabu Matsui

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