[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AIX sysval failure
From: |
Eric Blake |
Subject: |
Re: AIX sysval failure |
Date: |
Wed, 25 Feb 2009 23:21:45 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Gary V. Vaughan <gary <at> gnu.org> writes:
> > What is sysval after this run?
> >
> > $ echo 'changequote([,])syscmd([echo "meh" && kill -9 $$ ||
> > echo "oops: $?"])sysval' | ./src/m4
>
> Oh yeah. D'uh, should've thought of that myself!
>
> % echo 'changequote([,])syscmd([echo "meh" && kill -9 $$ ||
> echo "oops: $?"])sysval' | ./src/m4
> meh
> 127
What if you replace the || with ; in the syscmd? Or how about:
echo 'changequote([,])syscmd([sh -c '\''kill -9 $$'\'';
st=$?; echo $st; exit $st])sysval' | ./src/m4
Also, do you have anything like strace or truss, that can see what syscalls
were in play during syscmd's use of system()?
Maybe this slimmed down program is helpful as a debugging aid:
$ cat foo.c
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <sys/wait.h>
int main (int argc, char **argv)
{
int r = system (argc == 1 ? "kill -9 $$" : argv[1]);
printf ("%04x %d\n", r, errno);
if (fork ())
{
wait (&r);
printf ("%04x %d\n", r, errno);
}
else
{
execlp ("sh", "sh", "-c",
argc == 1 ? "kill -9 $$" : argv[1], (char*) 0);
}
return 0;
}
$ ./foo false
0100 0
0100 0
$ ./foo
0009 0
0009 0
On my system, the lower 7 bits represent signals, the upper 8 represent normal
return (on some platforms, this setup is swapped). The intent of the m4 test
is to find some portable way to cause sysval's child process to exit with a
signal (since we document that sysval distinguishes signals from normal exit,
similar to Solaris m4), hence the attempt to use 'kill -9 $$' since that is
unblockable. I'm starting to wonder if AIX system() is massaging the return
value from wait(); maybe the gnulib 'execute' module is worthwhile.
Similar questions apply to popen() for esyscmd.
--
Eric Blake
- snapshot 3 in preparation for 1.4.13, Eric Blake, 2009/02/23
- Re: snapshot 3 in preparation for 1.4.13, Gary V. Vaughan, 2009/02/23
- ungetc failures (was: snapshot 3 in preparation for 1.4.13), Eric Blake, 2009/02/24
- Solaris 8 mbrtowc failure (was: snapshot 3 in preparation for 1.4.13), Eric Blake, 2009/02/24
- AIX sysval failure (was: snapshot 3 in preparation for 1.4.13), Eric Blake, 2009/02/24
- Re: AIX sysval failure (was: snapshot 3 in preparation for 1.4.13), Gary V. Vaughan, 2009/02/25
- Re: AIX sysval failure, Eric Blake, 2009/02/25
- Re: AIX sysval failure, Gary V. Vaughan, 2009/02/25
- Re: AIX sysval failure,
Eric Blake <=
- Re: AIX sysval failure, Gary V. Vaughan, 2009/02/26
- Re: AIX sysval failure, Eric Blake, 2009/02/26
HP-UX 11.31 strtod failure (was: snapshot 3 in preparation for 1.4.13), Eric Blake, 2009/02/24
HP-UX 11.23 stdint failure (was: snapshot 3 in preparation for 1.4.13), Eric Blake, 2009/02/24
Re: HP-UX 11.23 stdint failure, Eric Blake, 2009/02/25