Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Strange parameter visibility



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.



Messages sorted by: Reverse Date, Date, Thread, Author