dpkg s-s-d --retry --pidfile changes
Hi everyone,
In debian/changelog for dpkg-1.14.16.3:
| * Fix timeout computations for start-stop-daemon --retry option. This has
| not worked properly for a long time (maybe never), but came to light
| due to #460903's fix. Closes: #462104
In utils/start-stop-daemon.c (the ! are mine):
|static void
|tmul(struct timeval *a, int b)
|{
| a->tv_sec *= b;
! fprintf(stderr, "%d, %ld\n", b, a->tv_usec);
! assert(a->tv_usec<2000000./b);
| a->tv_usec *= b;
! assert(a->tv_usec<2000000);
| if (a->tv_usec >= 1000000) {
| ++a->tv_sec;
| a->tv_usec -= 1000000;
| }
! assert(a->tv_usec<1000000);
|}
I wonder whether that "if()" should be a "while()" since b (aka ratio) is
initialized to 1 and incremented (although the comments state that it is
initialized to 2).
Indeed, I was able to make it abort in a few runs by sending sigstop
at strategic places:
|kill(0, SIGSTOP);
|xgettimeofday(&after);
$ sleep 300 & echo $! >./pidfile
[...]
$ fg
./start-stop-daemon --verbose --retry 10 --pidfile ./pidfile --stop --name sleep --signal CONT
3, 896334
start-stop-daemon: start-stop-daemon.c:235: tmul: Assertion `a->tv_usec<2000000./b' failed.
Aborted
Justin
Reply to: