zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: "sh" job control
  1999-09-30 14:24 PATCH: "sh" job control Clint Adams
@ 1999-09-30 14:08 ` Peter Stephenson
  1999-09-30 14:53   ` Zefram
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Stephenson @ 1999-09-30 14:08 UTC (permalink / raw)
  To: zsh-workers

Clint Adams wrote:
> Most other shells seem to default to exiting right away when told to
> exit while there are jobs in the job table.  zsh provided no way for
> silence (other than disowning all jobs or setopt nomonitor)
> 
> The following patch introduces an option "shjobcontrol" (bad name?)
> which skips the checkjobs() call.

It's probably because zsh doesn't set nohup by default. As it's set
by default in sh mode, this seems a reasonable combination.  Here's some
documentation.  Maybe the name could be improved but it's hard to think of
anything short.

--- Doc/Zsh/options.yo~	Wed Sep 22 14:59:48 1999
+++ Doc/Zsh/options.yo	Thu Sep 30 16:04:18 1999
@@ -1003,6 +1003,14 @@
 tt(INTERACTIVE) option is explicitly set on the command line.
 The value of this option cannot be changed anywhere other than the command line.
 )
+pindex(SH_JOB_CONTROL)
+cindex(exiting, checking jobs when)
+cindex(logging out, checking jobs when)
+item(tt(SH_JOB_CONTROL) <C> <K> <S>)(
+Don't report the status of background and suspended jobs when exiting a
+shell with job control.  This is best used in combination with tt(NO_HUP),
+else such jobs will be killed automatically.
+)
 pindex(SINGLE_LINE_ZLE)
 cindex(editor, single line mode)
 item(tt(SINGLE_LINE_ZLE) (tt(-M)) <K>)(


-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


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

* PATCH: "sh" job control
@ 1999-09-30 14:24 Clint Adams
  1999-09-30 14:08 ` Peter Stephenson
  0 siblings, 1 reply; 9+ messages in thread
From: Clint Adams @ 1999-09-30 14:24 UTC (permalink / raw)
  To: zsh-workers

Most other shells seem to default to exiting right away when told to
exit while there are jobs in the job table.  zsh provided no way for
silence (other than disowning all jobs or setopt nomonitor)

The following patch introduces an option "shjobcontrol" (bad name?)
which skips the checkjobs() call.


diff -c --recursive Src.old/builtin.c Src/builtin.c
*** Src.old/builtin.c	Tue Sep 21 05:25:31 1999
--- Src/builtin.c	Thu Sep 30 10:03:53 1999
***************
*** 3152,3158 ****
      HEAPALLOC {
  	if (isset(MONITOR) && !stopmsg && !from_signal) {
  	    scanjobs();    /* check if jobs need printing           */
! 	    checkjobs();   /* check if any jobs are running/stopped */
  	    if (stopmsg) {
  		stopmsg = 2;
  		LASTALLOC_RETURN;
--- 3152,3159 ----
      HEAPALLOC {
  	if (isset(MONITOR) && !stopmsg && !from_signal) {
  	    scanjobs();    /* check if jobs need printing           */
! 	    if (unset(SHJOBCONTROL))
! 	        checkjobs();   /* check if any jobs are running/stopped */
  	    if (stopmsg) {
  		stopmsg = 2;
  		LASTALLOC_RETURN;
diff -c --recursive Src.old/options.c Src/options.c
*** Src.old/options.c	Wed Sep 22 08:59:48 1999
--- Src/options.c	Thu Sep 30 10:14:49 1999
***************
*** 186,191 ****
--- 186,192 ----
  {NULL, "shinstdin",	      OPT_SPECIAL,		 SHINSTDIN},
  {NULL, "shoptionletters",     OPT_EMULATE|OPT_BOURNE,	 SHOPTIONLETTERS},
  {NULL, "shortloops",	      OPT_ALL,			 SHORTLOOPS},
+ {NULL, "shjobcontrol",	      OPT_EMULATE|OPT_NONZSH,	 SHJOBCONTROL},
  {NULL, "shwordsplit",	      OPT_EMULATE|OPT_BOURNE,	 SHWORDSPLIT},
  {NULL, "singlecommand",	      OPT_SPECIAL,		 SINGLECOMMAND},
  {NULL, "singlelinezle",	      OPT_KSH,			 SINGLELINEZLE},
diff -c --recursive Src.old/zsh.h Src/zsh.h
*** Src.old/zsh.h	Wed Sep 22 08:59:48 1999
--- Src/zsh.h	Thu Sep 30 10:07:34 1999
***************
*** 1359,1364 ****
--- 1359,1365 ----
      SHINSTDIN,
      SHOPTIONLETTERS,
      SHORTLOOPS,
+     SHJOBCONTROL,
      SHWORDSPLIT,
      SINGLECOMMAND,
      SINGLELINEZLE,


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

* Re: PATCH: "sh" job control
  1999-09-30 14:53   ` Zefram
@ 1999-09-30 14:44     ` Peter Stephenson
  1999-09-30 15:27       ` Clint Adams
  1999-09-30 15:07     ` Clint Adams
  1 sibling, 1 reply; 9+ messages in thread
From: Peter Stephenson @ 1999-09-30 14:44 UTC (permalink / raw)
  To: Zsh hackers list

Zefram wrote:
> Peter Stephenson wrote:
> >Clint Adams wrote:
> >> The following patch introduces an option "shjobcontrol" (bad name?)
> >> which skips the checkjobs() call.
> 
> I think CHECK_JOBS (with the opposite sense) would be a better name.

That would mean it has the same sense as HUP, which is logical.

> >It's probably because zsh doesn't set nohup by default. As it's set
> >by default in sh mode, this seems a reasonable combination.
> 
> What does POSIX say about it?

I can't see anything in the Single UNIX Specification, anyway.  The nohup
description refers to the sh description, but doesn't seem to specify it
one way or another.

By the way, looking at the standard, I discovered the following are
supposed to work.

% echo $(
echo # a comment)
)
% echo $(
cat <<\eof
a here doc with )
eof
)

That would basically mean recursively parsing the $(...) straight away,
which could be quite a lot of work.  I'm delighted to find it doesn't work
with HPUX 10.20's POSIX sh, either.

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


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

* Re: PATCH: "sh" job control
  1999-09-30 14:08 ` Peter Stephenson
@ 1999-09-30 14:53   ` Zefram
  1999-09-30 14:44     ` Peter Stephenson
  1999-09-30 15:07     ` Clint Adams
  0 siblings, 2 replies; 9+ messages in thread
From: Zefram @ 1999-09-30 14:53 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

Peter Stephenson wrote:
>Clint Adams wrote:
>> The following patch introduces an option "shjobcontrol" (bad name?)
>> which skips the checkjobs() call.

I think CHECK_JOBS (with the opposite sense) would be a better name.

Btw, you put SH_JOB_CONTROL out of alphabetical sequence.

>It's probably because zsh doesn't set nohup by default. As it's set
>by default in sh mode, this seems a reasonable combination.

What does POSIX say about it?

-zefram


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

* Re: PATCH: "sh" job control
  1999-09-30 15:27       ` Clint Adams
@ 1999-09-30 14:57         ` Peter Stephenson
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Stephenson @ 1999-09-30 14:57 UTC (permalink / raw)
  To: Zsh hackers list

Clint Adams wrote:
> Is 'emulate sh' aiming for SUS or POSIX compliance?

POSIX, really, but I don't have access to that.  Zoltan did quite a lot of
work on it some time ago.

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


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

* Re: PATCH: "sh" job control
  1999-09-30 14:53   ` Zefram
  1999-09-30 14:44     ` Peter Stephenson
@ 1999-09-30 15:07     ` Clint Adams
  1999-10-01  1:41       ` POSIX (Was: PATCH: "sh" job control) Geoff Wing
  1 sibling, 1 reply; 9+ messages in thread
From: Clint Adams @ 1999-09-30 15:07 UTC (permalink / raw)
  To: Zefram; +Cc: Peter Stephenson, zsh-workers

> I think CHECK_JOBS (with the opposite sense) would be a better name.

I think that's reasonable.

> Btw, you put SH_JOB_CONTROL out of alphabetical sequence.

Ah, yes.  I was mentally inserting spaces between the words.

> What does POSIX say about it?

I don't know, but while we're on the subject, can anyone
confirm or deny that bash's implementation of the 'command'
builtin (command [-pVv] ...) is POSIX?


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

* Re: PATCH: "sh" job control
  1999-09-30 14:44     ` Peter Stephenson
@ 1999-09-30 15:27       ` Clint Adams
  1999-09-30 14:57         ` Peter Stephenson
  0 siblings, 1 reply; 9+ messages in thread
From: Clint Adams @ 1999-09-30 15:27 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

> I can't see anything in the Single UNIX Specification, anyway.  The nohup
> description refers to the sh description, but doesn't seem to specify it
> one way or another.

Is 'emulate sh' aiming for SUS or POSIX compliance?


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

* POSIX (Was: PATCH: "sh" job control)
  1999-09-30 15:07     ` Clint Adams
@ 1999-10-01  1:41       ` Geoff Wing
  1999-10-01  6:23         ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: Geoff Wing @ 1999-10-01  1:41 UTC (permalink / raw)
  To: zsh-workers

Clint Adams <schizo@debian.org> typed:
:> I think CHECK_JOBS (with the opposite sense) would be a better name.
:I think that's reasonable.
:> Btw, you put SH_JOB_CONTROL out of alphabetical sequence.

:Ah, yes.  I was mentally inserting spaces between the words.
:> What does POSIX say about it?

On the topic of POSIX:
% touch asdasd; chmod 755 asdasd
% ./asdasd ; echo $?
zsh: exec format error: ./asdasd
1	# <-- POSIX says 126
% ./foobar
zsh: no such file or directory: ./foobar
1	# <-- POSIX says 127

:I don't know, but while we're on the subject, can anyone
:confirm or deny that bash's implementation of the 'command'
:builtin (command [-pVv] ...) is POSIX?

POSIX with (User Portability Utilities Option) says ``command [-pvV] ...''
Paraphrasing:
-p: Use a default PATH that is guaranteed to find all standard utilities.
-v: Write string to stdout of pathname or command that will be used by the
    shell, in the current shell execution environment....
-V: Write string to stdout that indicates how the name given in the
    command_name operand will be interpreted by the shell, in the
    current shell execution environment....
When the -v option is specified, standard output shall be formatted as:
  "%s\n", <pathname or command>
When the -V option is specified, standard output shall be formatted as:
  "%s\n", <unspecified>

Regards'
-- 
Geoff Wing : <gcw@pobox.com>     Work URL: http://www.primenet.com.au/
Rxvt Stuff : <gcw@rxvt.org>      Ego URL : http://pobox.com/~gcw/
Zsh Stuff  : <gcw@zsh.org>       Phone   : (Australia) 0413 431 874


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

* Re: POSIX (Was: PATCH: "sh" job control)
  1999-10-01  1:41       ` POSIX (Was: PATCH: "sh" job control) Geoff Wing
@ 1999-10-01  6:23         ` Bart Schaefer
  0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 1999-10-01  6:23 UTC (permalink / raw)
  To: zsh-workers

On Oct 1,  1:41am, Geoff Wing wrote:
} Subject: POSIX (Was: PATCH: "sh" job control)
}
} On the topic of POSIX:
} % touch asdasd; chmod 755 asdasd
} % ./asdasd ; echo $?
} zsh: exec format error: ./asdasd
} 1	# <-- POSIX says 126
} % ./foobar
} zsh: no such file or directory: ./foobar
} 1	# <-- POSIX says 127

On my RedHat 5.2 system, bash says:

$ ./asdasd ; echo $?
0
$ ./foobar ; echo $?
bash: ./foobar: No such file or directory
126

So I don't think I'm going to complain too loudly about zsh.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

end of thread, other threads:[~1999-10-01  6:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-30 14:24 PATCH: "sh" job control Clint Adams
1999-09-30 14:08 ` Peter Stephenson
1999-09-30 14:53   ` Zefram
1999-09-30 14:44     ` Peter Stephenson
1999-09-30 15:27       ` Clint Adams
1999-09-30 14:57         ` Peter Stephenson
1999-09-30 15:07     ` Clint Adams
1999-10-01  1:41       ` POSIX (Was: PATCH: "sh" job control) Geoff Wing
1999-10-01  6:23         ` Bart Schaefer

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