Follow-up Comment #13, bug #51181 (project wget):
I can only reproduce it with fork before execve *and* when using the "timeout"
command:
#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>
int main() {
char *args[] = {
"timeout", "-k", "26s", "25s",
"wget", "-O", "test.html", "http://example.com", NULL
};
int pid = fork();
if (pid < 0) {
perror("fork");
return 1;
} else if (pid == 0) {
execvp(args[0], args);
perror("execvp");
return 1;
} else {
wait(NULL);
perror("wait");
}
return 0;
}
It appears that "timeout" is creating a new process group:
977 if (foreground_pgrp != -1 && foreground_pgrp != getpgrp ())
(gdb) p foreground_pgrp
$4 = 12905 # pidof wrapper
(gdb) p (int)getpgrp()
$5 = 12906 # pidof timeout
Suggested workarounds:
- Use "timeout --foreground" or,
- Add the "-o-" option to "wget" to force logging to stdout.
Given the special behavior of "timeout", isn't this "working as intended"?
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51181>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/