Bug#401547: tryto -n1 often reports that child crashed even if it didn't

2006-12-05 Thread Gerrit Pape
tags 401547 + patch
quit

On Mon, Dec 04, 2006 at 02:54:51PM +0100, Andras Korn wrote:
 tryto -n1 true reports child crashed, giving up.

Hi Andras, yes, thanks for reporting; this patch should fix it.

Regards, Gerrit.
diff -ur admin~/socklog-2.1.0/src/tryto.c admin/socklog-2.1.0/src/tryto.c
--- admin~/socklog-2.1.0/src/tryto.c2006-03-06 13:00:06.0 +
+++ admin/socklog-2.1.0/src/tryto.c 2006-12-05 08:51:51.115464544 +
@@ -237,7 +237,7 @@
   }
   break;
 }
-if (rc == 0) break;
+if (rc == 0) _exit(0);
 if (verbose) strerr_warn2(WARNING, child crashed., 0);
 if (lseek(0, 0, SEEK_SET) != 0)
if (verbose) strerr_warn2(WARNING,
@@ -246,7 +246,7 @@
 sleep(1);
   }
 
-  if (processor  (rc != 0)) {
+  if (processor) {
 for (;;) {
   int r;
   char *s;


Bug#401547: tryto -n1 often reports that child crashed even if it didn't

2006-12-04 Thread Andras Korn
Package: socklog
Version: 2.1.0-4
Severity: normal

Hi,

tryto -n1 true reports child crashed, giving up.

strace:

execve(/usr/bin/tryto, [tryto, -n, 1, true], [/* 15 vars */]) = 0
brk(0)  = 0x8051000
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7f39000
access(/etc/ld.so.preload, R_OK)  = -1 ENOENT (No such file or directory)
open(/etc/ld.so.cache, O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=62219, ...}) = 0
mmap2(NULL, 62219, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f29000
close(3)= 0
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
open(/lib/libc.so.6, O_RDONLY)= 3
read(3, 
\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20Z\1\0004\0\0\0D\304\21\0\0\0\0\0004\0
 \0\n\0(\0=\0[EMAIL 
PROTECTED]@\1\0\0\5\0\0\0\4\0\0\0\3\0\0\0\200\10\21\0\200\10\21\0\200\10\21\0\23\0\0\0\23\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0005\200\21\0005\200\21\0\5\0\0\0\0\20\0\0\1\0\0\0\300\217\21\0\300\237\21\0\300\237\21\0\274)\0\0\274U\0\0\6\0\0...,
 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1166796, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7f28000
mmap2(NULL, 1176956, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0xb7e08000
mmap2(0xb7f21000, 16384, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x118) = 0xb7f21000
mmap2(0xb7f25000, 9596, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7f25000
close(3)= 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7e07000
set_thread_area({entry_number:-1 - 6, base_addr:0xb7e076b0, limit:1048575, 
seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, 
useable:1}) = 0
mprotect(0xb7f21000, 8192, PROT_READ)   = 0
munmap(0xb7f29000, 62219)   = 0
pipe([3, 4])= 0
fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
fcntl64(4, F_SETFD, FD_CLOEXEC) = 0
fcntl64(3, F_GETFL) = 0 (flags O_RDONLY)
fcntl64(3, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
fcntl64(4, F_GETFL) = 0x1 (flags O_WRONLY)
fcntl64(4, F_SETFL, O_WRONLY|O_NONBLOCK) = 0
fcntl64(0, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(0, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
rt_sigprocmask(SIG_BLOCK, [PIPE], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], NULL, 8) = 0
rt_sigaction(SIGCHLD, {0x80488bd, [], 0}, NULL, 8) = 0
gettimeofday({1165239934, 22273}, NULL) = 0
pipe([5, 6])= 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0xb7e076f8) = 5574
close(5)= 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], NULL, 8) = 0
poll([{fd=3, events=POLLIN}, {fd=0, events=POLLIN}], 2, 180020) = -1 EINTR 
(Interrupted system call)
--- SIGCHLD (Child exited) @ 0 (0) ---
write(4, \0, 1)   = 1
sigreturn() = ? (mask now [PIPE])
rt_sigprocmask(SIG_BLOCK, [CHLD], NULL, 8) = 0
read(3, \0, 1)= 1
read(3, 0xbfc50c47, 1)  = -1 EAGAIN (Resource temporarily 
unavailable)
gettimeofday({1165239934, 27679}, NULL) = 0
waitpid(-1, [{WIFEXITED(s)  WEXITSTATUS(s) == 0}], WNOHANG) = 5574
close(6)= 0
write(2, tryto: fatal: child crashed, giving up.\n, 40) = 40
exit_group(0)   = ?

strace of the child:

rt_sigprocmask(SIG_UNBLOCK, [PIPE], NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], NULL, 8) = 0
rt_sigaction(SIGCHLD, {SIG_DFL}, NULL, 8) = 0
close(6)= 0
fcntl64(5, F_GETFL) = 0 (flags O_RDONLY)
close(0)= 0
fcntl64(5, F_DUPFD, 0)  = 0
close(5)= 0
execve(/root/bin/true, [true], [/* 15 vars */]) = -1 ENOENT (No such file 
or directory)
execve(/usr/local/bin/true, [true], [/* 15 vars */]) = -1 ENOENT (No such 
file or directory)
execve(/usr/bin/true, [true], [/* 15 vars */]) = -1 ENOENT (No such file or 
directory)
execve(/bin/true, [true], [/* 15 vars */]) = 0
brk(0)  = 0x804c000
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7fb4000
access(/etc/ld.so.preload, R_OK)  = -1 ENOENT (No such file or directory)
open(/etc/ld.so.cache, O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=62219, ...}) = 0
mmap2(NULL, 62219, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7fa4000
close(3)= 0
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
open(/lib/libc.so.6, O_RDONLY)= 3
read(3,