autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting zsh into POSIX mode


From: Eric Blake
Subject: Re: getting zsh into POSIX mode
Date: Mon, 13 Jul 2009 22:21:45 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 7/9/2009 6:13 AM:
> In looking at it further, one of the differences is that zsh enables
> notify mode (set -b) by default, although POSIX states that notify mode
> should default to off (set +b).  'emulate sh' does not change the current
> state of the notify option, but 'emulate -R sh' forces it to off.
> Generally, notify does not affect non-interactive script behavior, since
> it only matters when monitor (set -m) is enabled, and that is off by
> default for non-interactive use.  But for parallel testsuites, we really
> DO want to have notify disabled so that we don't have to deal with
> asynchronous outputs to stderr as test groups complete.

Done as follows.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpcB9kACgkQ84KuGfSFAYCW9wCff/LFclUfuQ0PwE1fCgKrsmdh
1NoAn0Sgcv9LeWb4fM14nIRzR+B2lFbh
=g34L
-----END PGP SIGNATURE-----
>From d8db042ad03bd140212c528077f9b5589da91d49 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 13 Jul 2009 12:54:19 -0600
Subject: [PATCH] Disable asynchronous job notification for parallel tests.

* lib/autotest/general.m4 (AT_INIT) <Driver loop>: Turn off notify
mode, since zsh leaves it on after 'emulate sh'.
* doc/autoconf.texi (Limitations of Builtins) <set>: Document that
job control options are not portable.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog               |    6 ++++++
 doc/autoconf.texi       |   29 +++++++++++++++++++++++++++++
 lib/autotest/general.m4 |    3 ++-
 3 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 37b7b15..26ddce0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-07-13  Eric Blake  <address@hidden>

+       Disable asynchronous job notification for parallel tests.
+       * lib/autotest/general.m4 (AT_INIT) <Driver loop>: Turn off notify
+       mode, since zsh leaves it on after 'emulate sh'.
+       * doc/autoconf.texi (Limitations of Builtins) <set>: Document that
+       job control options are not portable.
+
        Guarantee that exit status trumps output matching.
        * doc/autoconf.texi (Writing Testsuites) <AT_CHECK>: Document this
        better.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index a4aed6f..cd2a65d 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -16257,6 +16257,35 @@ Limitations of Builtins
 @samp{set -e}, it is better to append @samp{|| AS_EXIT} to any
 statement where it is desirable to abort on failure.

address@hidden @command{set -b}
address@hidden @command{set -m}
+Job control is not provided by all shells, so the use of @samp{set -m}
+or @samp{set -b} must be done with care.  When using @command{zsh} in
+native mode, asynchronous notification (@samp{set -b}) is enabled by
+default, and using @samp{emulate sh} to switch to Posix mode does not
+clear this setting (although asynchronous notification has no impact
+unless job monitoring is also enabled).  Also, @command{zsh} 4.3.10 and
+earlier have a bug where job control can be manipulated in interactive
+shells, but not in subshells or scripts.  Furthermore, some shells, like
address@hidden, fail to treat subshells as interactive, even though the
+parent shell was.
+
address@hidden
+$ @kbd{echo $ZSH_VERSION}
+4.3.10
+$ @kbd{set -m; echo $?}
+0
+$ @kbd{zsh -c 'set -m; echo $?'}
+set: can't change option: -m
+$ @kbd{(set -m); echo $?}
+set: can't change option: -m
+1
+$ @kbd{pdksh -ci 'echo $-; (echo $-)'}
+cim
+c
address@hidden example
+
+
 @item @command{shift}
 @c ------------------
 @prindex @command{shift}
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index b9beb0e..cf88b99 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1250,7 +1250,8 @@ dnl shell to start each parallel task as its own shell 
job, thus as a new
 dnl process group leader.  We then send the signal to all new process groups.

 dnl Do we have job control?
-if (set -m && set +m) >/dev/null 2>&1; then
+if (set -m && set +m && set +b) >/dev/null 2>&1; then
+  set +b
   at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=-
 else
   at_job_control_on=: at_job_control_off=: at_job_group=
-- 
1.6.3.3.334.g916e1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]