-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dave Anderson a écrit :
It's probably worth figuring out why the popen() command failed?
The function printing the error message is here in cmdline.c:
int
shell_command(char *cmd)
{
FILE *pipe;
char buf[BUFSIZE];
if ((pipe = popen(cmd, "r")) == NULL) {
error(INFO, "cannot open pipe: %s\n", cmd);
pc->redirect &= ~REDIRECT_SHELL_COMMAND;
pc->redirect |= REDIRECT_FAILURE;
return REDIRECT_FAILURE;
}
I didn't bother to gather/display the errno information in the function above
since it's irrelevant if there's a memory allocation issue. From the popen()
man page:
RETURN VALUE
The popen() function returns NULL if the fork(2) or pipe(2) calls fail,
or if it cannot allocate memory.
The pclose() function returns -1 if wait4() returns an error, or some
other error is detected.
ERRORS
The popen() function does not set errno if memory allocation fails. If
the underlying fork() or pipe() fails, errno is set appropriately. If
the type argument is invalid, and this condition is detected, errno is
set to EINVAL.
Also, does "echo" alone maybe use the shell's built-in echo instead of
/bin/echo?
Did you force it by using "/bin/echo" in the script's comand lines instead
of
just "echo"?
I added the /bin/echo in there thinking that it was the cause, but I
might be wrong. I'm starting to realize that I may have been to quick in
chasing for help and did not do enough searching first (getting near end
of day here in France).
BTW, you can also try removing the ! from in front of the "echo" commands in
the input file, because the crash utility will just pass the remaining string
to system() instead of popen(). But I would guess that system() would fail
for the same reason as popen().
I just tested using the echo command from crash but the redirection to a
file doesn't work. But there is maybe other ways of achieving what I
want to do.
I'll do more work on this and come back with what I find. The most
important thing is that I got it mostly running on SLES11 (and will test
SLES10 tomorrow).
Kind Regards,
...Louis
P.S. Is there a team's IRC room somewhere or you just go by emails
(which I would understand, given the level of interruption I get from
chatrooms) ?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org/
iEYEARECAAYFAkrEyTwACgkQDvqokHrhnCzQDgCgtklo73WSdYzpIEbBgEdYAKFt
cEUAmQFBjNXfb47BqFVZDp+MxrucRY2q
=p9hl
-----END PGP SIGNATURE-----