zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 0/1] Run final pipeline command in a subshell in sh mode
@ 2019-11-24 23:41 brian m. carlson
  2019-11-24 23:41 ` [PATCH 1/1] exec: run " brian m. carlson
  2019-12-07 19:23 ` [PATCH 0/1] Run " brian m. carlson
  0 siblings, 2 replies; 3+ messages in thread
From: brian m. carlson @ 2019-11-24 23:41 UTC (permalink / raw)
  To: zsh-workers

POSIX sh implementations run each command in a pipeline in a subshell,
although zsh (and AT&T ksh) do not: instead, they run the final command
in the main shell.

zsh is starting to be used in some cases as /bin/sh, such as on macOS
Catalina.  Whether this is a good idea or not, it makes sense to emulate
the POSIX behavior as much as possible when emulating sh, since that's
the least surprising behavior.  This patch does exactly that.

With this patch, using "zsh --emulate sh" passes all but one test of the
Git testsuite.  The remaining failure is due to zsh preserving NUL bytes
in the output of command substitutions, which is permitted by POSIX; I
will be sending a patch to fix that bug in the Git testsuite.

I will admit that some of the tests included look bizarre, such as
piping to an assignment, but I felt it was important to hit as many
cases as possible.

I'm not subscribed to the list, so please CC me with any comments, and
I'll try to address them promptly.  If you'd like me to include a
changelog entry, please say so, and I'm happy to include one.

brian m. carlson (1):
  exec: run final pipeline command in a subshell in sh mode

 Src/exec.c           | 10 ++++++----
 Test/B07emulate.ztst | 22 ++++++++++++++++++++++
 2 files changed, 28 insertions(+), 4 deletions(-)


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

end of thread, other threads:[~2019-12-07 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-24 23:41 [PATCH 0/1] Run final pipeline command in a subshell in sh mode brian m. carlson
2019-11-24 23:41 ` [PATCH 1/1] exec: run " brian m. carlson
2019-12-07 19:23 ` [PATCH 0/1] Run " brian m. carlson

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