Re: Question about Ctrl-C and less

From: mark(at)mark(dot)mielke(dot)cc
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Kevin Brown <kevin(at)sysexperts(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Question about Ctrl-C and less
Date: 2005-10-21 12:48:31
Message-ID: 20051021124831.GA13752@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 21, 2005 at 01:53:32PM +0200, Martijn van Oosterhout wrote:
> On Thu, Oct 20, 2005 at 08:11:14PM -0400, mark(at)mark(dot)mielke(dot)cc wrote:
> > I disagree that psql should make *any* assumptions about what SIGINT
> > means to the child process. Consider less again, and Control-C used
> > to abort a search. You are suggesting that Control-C should not only
> > abort the search, but should also cut off the input from less. Less
> > won't die. Less will just see a terminated input stream. What has been
> > gained from this? Is this intuitive behaviour?
> I must say I agree with the idea that Ctrl-C shouldn't stop the stream
> from psql, but I'm willing to let it slide because a lot of other
> programs work this way. I imagine asking it to be configurable will
> meet even more resistance.

Which other ones? I can't think of one. The ones that don't handle
SIGINT, or that are not designed for this scenario certainly don't count -
as that is how psql works right now without the patch. Of the remaining
programs that are designed to work with an application such as less, which
ones purposefully close the input stream to less, and continue running?

I think 0.

> > I think the only reasonable behaviour is to ignore SIGINT within the
> > parent, until the child exits. I don't see why other behaviours are
> > even being considered. To me, it points at a misunderstanding of the
> > problem.
> I've been playing with a version of psql which on Ctrl-C doesn't
> longjmp() but politely frees everything, waits for the pager and then
> back to the main loop with the message "Interrupted". But now we have
> another behaviour change: How to abort the gets() when you don't have
> readline?
> Doing it with a flag is a lot more susceptable to subtle behaviour
> changes, but I'll see if I can make it work.

SIG_IGN is the easiest, and the most effective. Certainly the easiest
to maintain, and the least intrusive to the core.

I don't understand.

Cheers,
mark

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2005-10-21 13:40:26 Re: [GENERAL] 'a' == 'a '
Previous Message Simon Riggs 2005-10-21 12:17:10 Re: Seeing context switch storm with 10/13 snapshot of