[AIX] shell daemon trap handler not evaluated for SIGHUP
--------------------------------------------------------
Key: STDCXX-419
URL: https://issues.apache.org/jira/browse/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
evaluated.
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[] = {
"#!/bin/sh\n"
"trap \"echo in handler... >t.out\" HUP EXIT\n"
"sleep 1000\n"
};
int main ()
{
FILE *fp;
pid_t pid;
if (0 == (fp = fopen ("t.sh", "w"))) return 1;
fputs (script, fp);
fclose (fp);
chmod ("t.sh", S_IRWXU);
if (0 > (pid = fork ()))
return 2;
if (0 < pid) {
sleep (1);
kill (-pid, SIGHUP);
return 0;
}
if (-1 == setsid ()) return 3;
execl ("./t.sh", (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.
|