[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] pressed Ctrl-\ and got segmentation fault
From: |
Moritz Wilhelmy |
Subject: |
Re: [Chicken-users] pressed Ctrl-\ and got segmentation fault |
Date: |
Sun, 23 Jun 2013 14:14:54 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.8 (Windows/20060417) |
On 21.06.2013 22:34, John Cowan wrote:
> I can confirm that on 32-bit Linux. On Cygwin, however, typing ^\ does
> trigger a SIGSEGV with dumped core (except that it doesn't actually dump
> core because the Windows kernel can't do that). Both systems are running
> version 4.8.2 (rev ea02c9a), and there is no .csirc file. Readline is
> not involved: the config line says "manyargs dload ptables" only.
Right.
$ cat
^\
Segmentation fault (core dumped)
But:
$ cat test.c
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
void sighandler(int sig)
{
printf("Caught signal: %d\n", sig);
}
main()
{
struct sigaction s;
memset(&s, 0, sizeof(s));
s.sa_handler = sighandler;
sigaction(SIGSEGV, &s, 0);
sigaction(SIGQUIT, &s, 0);
while (1)
sleep(1);
return 0;
}
$ ./test &
[2] 3720
$ kill -QUIT %2
Caught signal: 3
$ kill -SEGV %2
Caught signal: 11
$ ./test
^\
Caught signal: 3
If you comment out sigaction(SIGQUIT, &s, 0); it prints
Segmentation fault (core dumped)
although it is actually killed by SIGQUIT, not SIGSEGV.
This leads me to believe that something inside Cygwin just prints the
wrong string for some reason, like for instance Windows or Cygwin
returning a bogus value for WTERMSIG in the wait-syscall the shell
makes, and that this is not a Chicken bug.
However, this puzzles me:
$ find >/dev/null
^\
Quit (core dumped)
$ cat >/dev/null
^\
Segmentation fault (core dumped)
$ cat /dev/zero >/dev/null
^\
Quit (core dumped)
So it might be that processes which are killed while doing I/O print
"Quit" and "Segmentation fault" otherwise.
Best regards,
Moritz
Re: [Chicken-users] pressed Ctrl-\ and got segmentation fault, Christian Kellermann, 2013/06/21