Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-05
06:54 • Ticket [218537ffff] Configure test for vfork signal bug doesn't work on Sola... artifact: 248f9d40bd user: dgp
2000-10-26
08:24 • Closed ticket [218537ffff]. artifact: 7a2ae4c5a3 user: welch
01:01 • New ticket [218537ffff]. artifact: dfe4d44731 user: nobody

Configure test for vfork signal bug doesn't work on Solaris

Closed / Fixed218537ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:01:54
OriginalBugID: 942 Bug
Version: 8.1a2
SubmitDate: '1998-12-10'
LastModified: '1999-12-11'
Severity: MED
Status: Released
Submitter: welch
ChangedBy: hobbs
RelatedBugIDs: 2228 1312
OS: Solaris
OSVersion: intel
FixedDate: '1999-12-11'
FixedInVersion: 8.3b1
ClosedDate: '2000-10-25'


On Sun, 6 Dec 1998, Brent Welch wrote:

> Hmm - configure uses this program to detect the problem situation:
    [...]

> If this program exits with status of 1, the bug is present and
> vfork is mapped to fork.  Can you test this on both your Solaris
> Intel and Solaris Sparc platforms and see what happens for you?
    [...]

I get a SIGSEGV on Solaris Sparc (with a non-zero exit status).  On
Solaris Intel, the test passes (zero exit status).  I imagine both
answers are wrong.  I tried it with both the native C compiler and
gcc.  At the end of this message is pasted transcripts of the two
sessions.  Some other possibly relevant info:

 o The Solaris Sparc box I'm using is a 4-processor SMP machine.
 o The Solaris Intel is a single processor Pentium.
 o When I have the vfork() problem on Solaris Intel, I'm using Posix
   style signalling.  I noticed that the test you sent uses SYSV style
   signals.

Here's a stack traceback of the core dump, plus an attempt to
single-step it (whereupon it worked with exit status of zero):

GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.5.1"...
(gdb) run
Starting program: /home/isely/junk/sigtest 

Program received signal SIGSEGV, Segmentation fault.
0x0 in ?? ()
(gdb) where
#0  0x0 in ?? ()
#1  <signal handler called>
#2  0xef739628 in vfork ()
#3  0x109f8 in main () at sigtest.c:14
(gdb) 
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/isely/junk/sigtest 

Breakpoint 1, main () at sigtest.c:13
(gdb) next
(gdb) next
(gdb) next
(gdb) next
(gdb) next

Program exited normally.
(gdb) 

Here's the transcripts with exit status:

isely@ithink$ uname -a
SunOS ithink 5.5.1 Generic_103640-21 sun4u sparc sun4u
isely@ithink$ cat sigtest.c
#include <stdio.h>
#include <signal.h>
#include <sys/wait.h>
int gotSignal = 0;
sigProc(sig)
    int sig;
{
    gotSignal = 1;
}
main()
{
    int pid, sts;
    (void) signal(SIGCHLD, sigProc);
    pid = vfork();
    if (pid <  0) {
        exit(1);
    } else if (pid == 0) {
        (void) signal(SIGCHLD, SIG_DFL);
        _exit(0);
    } else {
        (void) wait(&sts);
    }
    exit((gotSignal) ? 0 : 1);

}
isely@ithink$ cc -g -o sigtest sigtest.c
"sigtest.c", line 13: warning: argument #2 is incompatible with prototype:
prototype: pointer to function(int) returning void : "/usr/include/signal.h", line 37
argument : pointer to function(int) returning int
isely@ithink$ echo $?
0
isely@ithink$ ./sigtest
Segmentation Fault(coredump)
isely@ithink$ echo $?
139
isely@ithink$ gcc -g -o sigtest sigtest.c
sigtest.c: In function `main':
sigtest.c:13: warning: passing arg 2 of `signal' from incompatible pointer type
isely@ithink$ echo $?
0
isely@ithink$ ./sigtest
Segmentation Fault(coredump)
isely@ithink$ echo $?
139
isely@ithink$ gcc -v
Reading specs from /home/chris24/tools/lib/gcc-lib/sparc-sun-solaris2.5.1/2.8.1/specs
gcc version 2.8.1
isely@ithink$ 

isely@ibuildx86$ uname -a
SunOS ibuildx86 5.6 Generic_105182-09 i86pc i386 i86pc
isely@ibuildx86$ cat sigtest.c
#include <stdio.h>
#include <signal.h>
#include <sys/wait.h>
int gotSignal = 0;
sigProc(sig)
    int sig;
{
    gotSignal = 1;
}
main()
{
    int pid, sts;
    (void) signal(SIGCHLD, sigProc);
    pid = vfork();
    if (pid <  0) {
        exit(1);
    } else if (pid == 0) {
        (void) signal(SIGCHLD, SIG_DFL);
        _exit(0);
    } else {
        (void) wait(&sts);
    }
    exit((gotSignal) ? 0 : 1);

}
isely@ibuildx86$ cc -g -o sigtest sigtest.c
"sigtest.c", line 13: warning: argument #2 is incompatible with prototype:
prototype: pointer to function(int) returning void : "/usr/include/signal.h", line 40
argument : pointer to function(int) returning int
isely@ibuildx86$ ./sigtest
isely@ibuildx86$ echo $?
0
isely@ibuildx86$ gcc -g -o sigtest sigtest.c
sigtest.c: In function `main':
sigtest.c:13: warning: passing arg 2 of `signal' from incompatible pointer type
isely@ibuildx86$ echo $?
0
isely@ibuildx86$ ./sigtest
isely@ibuildx86$ echo $?
0
isely@ibuildx86$ gcc -v
Reading specs from /home/chris24/tools-i386/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/specs
gcc version 2.8.1
isely@ibuildx86$ 



We also need to make vfork to fork if you are using Tcl threads.
-----
This is a bug in the configure script that incorrectly determines which fork* system call to use.
The choice is made based on detection of a system bug, or if the shell is being built with threads.
Brent has been working on this bug.  03/23/1999 17:46 - surles -
--
Also reportedly a problem in tclPipe.c (2228)
and for SCO with LWP (1312) 
-- 09/20/1999 hobbs
In 8.3, we know longer make any checks for vfork, as we won't use
it.  Modern VM systems handle fork just as efficiently, and this
solves a lot of the noted config problems with vfork. 
-- 12/11/1999 hobbs
welch Closed ticket [218537ffff]. [History diff]2000-10-26 08:24:13
dgp Ticket [218537ffff]: 3 changes [History diff]2001-04-05 06:54:26
Log in (anonymous is fine) to add a comment.