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

Re: non-interactive set -m



Eric Blake wrote:
> POSIX requires that 'set -m'/'set -o monitor' be switchable on the fly

Unfortunately I have limited time even for fixing real bugs in the
shell, which was not originally designed to be a POSIX shell and is not
your best bet if POSIX compatibility is your bottom line, and we have
very few volunteers for fixing stuff in the core shell.  So arguments of
this kind on their own tend to fall a bit flat in these parts, for
purely practical reasons (we're not actually against providing POSIX
compatibility, of course).

"It'll work if you change *this*" is a much more enticing argument...

> And your claim that MONITOR
> cannot be changed on the fly is false: zsh already handles this for
> interactive shells

You're right---there's another test of the same kind there (i.e. that
we're interactive).  This removes it.  Let me know if you run up against
more, or if there's some hidden interaction with the
interactive/non-interactive mode (I wouldn't bet against it).

I think the code that does the run-time switching is a late addition,
but I haven't checked the history.

Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.101
diff -u -r1.101 init.c
--- Src/init.c	1 Jul 2009 15:07:33 -0000	1.101
+++ Src/init.c	8 Jul 2009 13:36:58 -0000
@@ -486,7 +486,7 @@
      * process group leader.
      */
     mypid = (zlong)getpid();
-    if (opts[MONITOR] && interact && (SHTTY != -1)) {
+    if (opts[MONITOR] && (SHTTY != -1)) {
 	origpgrp = GETPGRP();
         acquire_pgrp(); /* might also clear opts[MONITOR] */
     } else
Index: Src/options.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/options.c,v
retrieving revision 1.48
diff -u -r1.48 options.c
--- Src/options.c	3 Mar 2009 17:26:08 -0000	1.48
+++ Src/options.c	8 Jul 2009 13:36:58 -0000
@@ -730,7 +730,7 @@
     } else if (!force && optno == MONITOR && value) {
 	if (opts[optno] == value)
 	    return 0;
-	if (interact && (SHTTY != -1)) {
+	if (SHTTY != -1) {
 	    origpgrp = GETPGRP();
 	    acquire_pgrp();
 	} else


-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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