🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #17579

Re: trn, sh -c and interrupts-- bug or misfeature?

#17579
From: Olaf Titz
Date: Thu, 16 Nov 1995 00:00
38 lines
2589 bytes
john hood <cgull@smoke.marlboro.vt.us> wrote:
> with /bin/sh on DEC OSF/1 v1.3 and 2.0 (i don't know about later
> versions), and every variant of the Almquist shell I've used on Linux,
> NetBSD and FreeBSD, a SIGINT from the keyboard will kill the shell, or
> at least cause it to to exit, while it's waiting for a child in 'sh -c
> command'.  every other shell i've tried, except for a fairly antique
> bash, ignores the signal.
> this causes considerable annoyance in trn, which uses sh -c to get
> Pnews started.  When you hit ^G in emacs or ^C in vi, you have a
> problem...sadly, there is no simple, general workaround/fix for trn.

I've got bitten by the same problem long ago, when I used trn and
emacs under Linux with one of the first semi-usable "bash"s.

It is a shell bug. A shell that doesn't ignore SIGINT when spawning a
subprocess is broken. Rationale: as a shell implementer, you don't know
what the subprocesses your shell is spawning will do with SIGINT.
Emacs is a nice example in that its reaction to Ctrl-G (which goes via
SIGINT) is context-dependent. It does not always mean "exit" (in fact,
never except for the panic exit mode). So there is no reason to assume
that the subprocess will actually exit or do anything else in response
to SIGINT, and the only reaction that makes sense is "ignore".

This holds for the normal case (interactive commands) as well as for
the -c mode. Apparently, some shells get this right in interactive
mode (otherwise the users would complain very soon ;-) but -c mode
uses a different piece of program that has this overlooked.

In short: tell your vendors their shells are broken.

olaf
-- 
___        Olaf.Titz@inka.de or @{stud,informatik}.uni-karlsruhe.de       ____
__ o           <URL:http://www.inka.de/~bigred/>     <IRC:praetorius>
__/<_              >> Just as long as the wheels keep on turning round
_)>(_)______________ I will live for the groove 'til the sun goes down << ____

Technical Details
Message-ID: <di5rtk.mgo@bigred.inka.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.unix.shell.mbox.zip!not-for-mail
References: <48c54t$qe3@sundog.tiac.net>

Show Full Headers
Complete Article Headers
Message-ID: <di5rtk.mgo@bigred.inka.de>
Subject: Re: trn, sh -c and interrupts-- bug or misfeature?
Date: Thu, 16 Nov 1995 00:00:00 +0000
From: Olaf Titz <olaf@bigred.inka.de>
References: <48c54t$qe3@sundog.tiac.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.unix.shell.mbox.zip!not-for-mail
X-Deja-AN: 119507358
Organization: private Linux site, southern Germany
Newsgroups: comp.unix.shell,news.software.readers