Bug 32540 - SIGPIPE not ignored causing SEGV
SIGPIPE not ignored causing SEGV
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
6.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-03-21 11:58 EST by Martine Braham-Moses
Modified: 2016-11-24 10:25 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-12-15 09:30:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Martine Braham-Moses 2001-03-21 11:58:10 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; Computer 
Associates International v2.501a)


In my c program, that using a C-API connects to a database, I issue a 
signal(SIGPIPE, SIG_IGN); then connect to the database do nothing with the 
database and start a infinite loop. In another window I issue kill -13 pid 
and I get a SEGV and core dump.  If I ignore other signals none of them 
cause a SEGV except SIGSEGV and SIGPIPE.

Reproducible: Always
Steps to Reproduce:
1. Compile the program
2. run the program
3. issue a ps -a and get the pid
4. issue a kill -13 pid
	

Actual Results:  Segmentation fault (core dump).

Expected Results:  Nothing should have happened it was supposed to ignore 
the signal.

Here is the program:

#include "codqlhdr.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

#define TIME 5

int main()
{
    odbSessH sh;
    odbStatus rc;
    odbMMProp mmProp;
    char	*envfile = getenv("JAS_ENVFILE");
    char msg[128];
    char t;
    long msglen;
    long errorcode;

    /*IGNORE SIGPIPE*/
    signal(SIGPIPE,SIG_IGN);
 
    /* SESSION START */
    printf("make keep sleeping for %d(s) \n",TIME);
    sleep(TIME);
    
    printf("\n======START SESSION!!======\n");
    rc = odbSesStart(&sh,NULL,NULL,NULL,NULL);

    if(rc != ODB_NORMAL) {
        printf("It was not able to connect to the Jasmine server at 
LINE31.\n");
        odbGetError(sh,&errorcode,msg,128,&msglen);
        printf("Detail information(%s).\n",msg);
        exit(1);
    }
    
    /* loop eternally */
    for(;;);

    return(0);
}
Comment 1 Olivier Baudron 2001-03-22 13:28:33 EST
I tried to reproduce the bug but could not compile your program without the API.
Nonetheless, I may give you 2 suggestions:
1) Move getenv() outside the declarations
2) Make sure, you include signal.h
Comment 2 Martine Braham-Moses 2001-03-26 11:14:19 EST
I realize you would not be able to reproduce exactly without the api which I 
can't provide.  Can you try connecting to any database?  Also I did as you 
suggested and its better, just a segmentation fault without the core dump.
Comment 3 Alan Cox 2002-12-15 09:30:50 EST
Without the "odb" this seems to work. I would assume odb is unblocking SIGPIPE
for internal use and not handling it correctly

Note You need to log in before you can comment on or make changes to this bug.