If hugs catches a fatal signal, it will say "Unexpected signal", and
exit, so you don't see which signal it was. It would be nicer if it
reraised the signal, so that the shell can see it, and do what it
would do if the signal was not catched.

Doing this also solves another problem I have with my linux system:
when I have hugs --with-readline and send it a fatal signal with kill,
the terminal will no longer echo. This does not happen when I send it
a signal that is not catched. Strangely, it does also not happen when
hugs produces the signal itself, with my favourite ":s -p%s%s%s".
Of course, I shouldn't send strange signals to hugs, but still this
observation suggests that the whole panic signal handler might need a
reconsideration. After all, besides printing "Unexpected signal"
all it does is calling everybody(EXIT), which does nothing but
normalTerminal, and exactly that is not working (for me, at least).

There is so much to consider with all those machines hugs runs on, so
I don't really suggest abandoning panic, but reraising the signal
really might be a good thing.

I don't know what to do if the signal handlers have type
int sighandler(void), so I still have exit(1) in that case.
I hope this patch is portable:

*** machdep.c.org       Mon Aug  4 16:02:28 1997
--- machdep.c   Mon Aug  4 16:02:31 1997
***************
*** 791,797 ****
  static sigHandler(panic) {              /* exit in a panic, on receipt of  */
      everybody(EXIT);                    /* an unexpected signal            */
      fprintf(stderr,"\nUnexpected signal\n");
!     exit(1);
      sigResume;/*NOTREACHED*/
  }
  
--- 791,797 ----
  static sigHandler(panic) {              /* exit in a panic, on receipt of  */
      everybody(EXIT);                    /* an unexpected signal            */
      fprintf(stderr,"\nUnexpected signal\n");
!     sigReraise;
      sigResume;/*NOTREACHED*/
  }
  
*** prelude.h.org       Mon Aug  4 15:58:50 1997
--- prelude.h   Mon Aug  4 16:17:53 1997
***************
*** 294,304 ****
--- 294,306 ----
  # define sigProto(nm) void nm Args((int))
  # define sigRaise(nm) nm(1)
  # define sigHandler(nm)       void nm(sig_arg) int sig_arg;
+ # define sigReraise   signal(sig_arg,SIG_DFL); kill(getpid(),sig_arg)
  # define sigResume    return
  #else
  # define sigProto(nm) int nm Args((Void))
  # define sigRaise(nm) nm()
  # define sigHandler(nm)       int nm(Void)
+ # define sigReraise   exit(1)               /* can we do better here? */
  # define sigResume    return 1
  #endif
  



Christian Sievers

Reply via email to