[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#436497: should avoid using timers in progress bar



Joey Hess wrote:
> Package: cdebconf
> Version: 0.119
> Severity: normal
> 
> See #436340. clock-setup started a progress bar, set the time back by N
> seconds, stepped the progress bar by one, and it hung for N seconds.
> 
> It seems that this is because newt_progress_set uses a timer to make
> newtFormRun return 1 millisecond after updating the form. But I guess
> that newt's code code doesn't detect clock skew, and hangs until 1
> millisecond after the timer was initially set up.
> 
> Is this a bug in newt or in cdebconf?

I think it's newt, see the comment I just mailed to 436340.  

newt/form.c:newtFormRun() computes the select() parameter so that the
absolute time of the new timeout is equal to the absolute time of the
previous timeout, plus form->timer.  This breaks when the clock jumps
around.

It could instead ensure that the length of the timeout is never more
than form->timer, or just notice and handle the case where the
gettimeofday(&now,0) call returns a time earlier than lastTimeout.

-jim



Reply to: