incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <>
Subject [jira] Created: (STDCXX-419) [AIX] shell daemon trap handler not evaluated for SIGHUP
Date Fri, 18 May 2007 20:29:16 GMT
[AIX] shell daemon trap handler not evaluated for SIGHUP

                 Key: STDCXX-419
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
    Affects Versions: 4.1.2
         Environment: AIX 5.2, 5.3
            Reporter: Martin Sebor

PMR 02346,K78,000

The test case below is expected to run to completion and write to stdout the contents of the
file t.out (i.e., "in handler..."). It behaves as expected on HP-UX, Linux, and Solaris but
on AIX it fails to create the t.out file, indicating that the shell signal handler is not

Since the behavior is the same regardless of the shell I suspect it's a bug in the OS.

$ cat ~/tmp/t.c; rm -f t.out; xlc ~/tmp/t.c && cat t.out
#include <signal.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

const char script[] = {
   "trap \"echo in handler... >t.out\" HUP EXIT\n"
   "sleep 1000\n"

int main ()
    FILE *fp;
    pid_t pid;

    if (0 == (fp = fopen ("", "w"))) return 1;
    fputs (script, fp);

    fclose (fp);
    chmod ("", S_IRWXU);

    if (0 > (pid = fork ()))
        return 2;

    if (0 < pid) {
        sleep (1);
        kill (-pid, SIGHUP);
        return 0;

    if (-1 == setsid ()) return 3;

    execl ("./", (char*)0);
    return 4;
cat: 0652-050 Cannot open t.out.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message