[Pkg-zsh-devel] Bug#660630: Bug#660630: zsh: suspend (^Z) behavior while a function is running is unclear

Axel Beckert abe at debian.org
Mon Feb 20 13:37:51 UTC 2012


Hi,

just some _opinion_ on this issue.

Vincent Lefevre wrote:
> With zsh, the whole function is suspended.

That's actually what I would expect from any shell function I call
from the commandline. Everything else causes undetermined behaviour
and is annoying. (Or said otherwise: Yet another reason to use zsh.
It's a feature, not a bug! :-)

> The effect is that zsh is forked (this is not documented, though can
> be guessed), thus $d will not be set in the main shell (Step 5:
> nothing is displayed).

That's annoying indeed. Ran into that with another shell, too, IIRC
bash.

> With bash, dash, mksh and pdksh, only the emacs process is suspended.

Nevertheless bash and dash definitely differ here with regards to
forking. I remember that I once had a shell script which should set
some variable inside a { } block (no more sure if some function or a
while loop).

While bash started a subshell and couldn't return any variable, dash
didn't and it worked with dash but not bash. (Usually things are the
other way round. :-)

I looked up the POSIX definition and it came out that it is not
defined, if a subshell/fork should be used or not, i.e. if you use
such stuff you get undefined behaviour. Unfortunately.

		Regards, Axel
-- 
 ,''`.  |  Axel Beckert <abe at debian.org>, http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE
  `-    |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5





More information about the Pkg-zsh-devel mailing list