Martijn van Oosterhout <kleptog@svana.org> writes:
> But the effect would change still, even with readline enabled. If
> readline is compiled in and you press control-C, our handler is still
> called. Currently, we siglongjmp out of readline() and start again. If
> you only set a flag like proposed, we won't break out of the readline
> call. readline will clear any partial state, but that's it.

I had interpreted the readline documentation to mean that readline would
discard a partially typed line upon catching SIGINT.  Experimentation
shows that this is not so, at least not with the version of readline I
use here.  It does catch the signal and reset some internal state, but
the partially typed line is NOT discarded.  Grumble.

So I think this patch's basic approach is right: we need to set a flag
to allow the longjmp only when we are inside readline or fgets.  (I
looked a bit at the readline sources, and it does seem designed to block
signals when it's doing something it doesn't want interrupted, so we'll
assume it's doing it correctly.)

I'll work on reviewing and applying the patch.  I don't much like the
side-effects on the /scripts directory though ... there must be a better
way than that.  Is it sane to declare the flag variable in print.c?

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to