Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Sep 1995 16:31:30 +0900
From:      Toshihiro Kanda <candy@fct.kgc.co.jp>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/751: crontab(1): `crontab -e' exits on SIGINT
Message-ID:  <199509280731.QAA03741@xxx.fct.kgc.co.jp>
Resent-Message-ID: <199509280750.AAA06711@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         751
>Category:       bin
>Synopsis:       crontab(1): `crontab -e' exits on SIGINT
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 28 00:50:01 PDT 1995
>Last-Modified:
>Originator:     Toshihiro Kanda
>Organization:
candy@fct.kgc.co.jp (Toshihiro Kanda)
>Release:        FreeBSD 2.0.5-RELEASE i386
>Environment:

$ uname -rms
FreeBSD 2.0.5-RELEASE i386

>Description:

When `crontab -e' invokes vi, ctl-C kills crontab but vi.  Then
vi is left alone and things go strange.

>How-To-Repeat:

Assuming /bin/sh syntax oriented shell...
$ EDITOR=/usr/bin/vi crontab -e
then type ctl-C.

>Fix:

Crontab exec's ``/bin/sh -c /usr/bin/vi tmp'', and sh seems exit
by SIGINT.  I wonder if crontab exec's vi directly.  At least it
seems to fix this problem.


*** crontab.c.orig	Tue May 30 12:47:04 1995
--- crontab.c	Thu Sep 28 16:08:25 1995
***************
*** 404,411 ****
--- 404,414 ----
  				ProgramName);
  			exit(ERROR_EXIT);
  		}
+ 		/*
  		sprintf(q, "%s %s", editor, Filename);
  		execlp(_PATH_BSHELL, _PATH_BSHELL, "-c", q, NULL);
+ 		*/
+ 		execlp(editor, editor, Filename, NULL);
  		perror(editor);
  		exit(ERROR_EXIT);
  		/*NOTREACHED*/
***************
*** 415,421 ****
--- 418,433 ----
  	}
  
  	/* parent */
+ 	{
+ 	void (*f[4])();
+ 	f[0] = signal(SIGHUP, SIG_IGN);
+ 	f[1] = signal(SIGINT, SIG_IGN);
+ 	f[2] = signal(SIGTERM, SIG_IGN);
  	xpid = wait(&waiter);
+ 	signal(SIGHUP, f[0]);
+ 	signal(SIGINT, f[1]);
+ 	signal(SIGTERM, f[2]);
+ 	}
  	if (xpid != pid) {
  		fprintf(stderr, "%s: wrong PID (%d != %d) from \"%s\"\n",
  			ProgramName, xpid, pid, editor);
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509280731.QAA03741>