Created attachment 128937 [details] Patch to watch.c
Description of problem: Passing integers larger than 4294 (ULONG_MAX / 1000000 on a 32-bit machine) to watch -n will cause unexpected behavior. Version-Release number of selected component (if applicable): 3.2.5, 3.2.6 How reproducible: Always Steps to Reproduce: 1. issue command: watch -n 4295 "echo . >> test.out" 2. wait 10 seconds 3. ctrl-c Actual results: The echo command is executed at rapid intervals, and the test.out file is filled with lines of ".\n" Expected results: The echo command should be executed every 4295 seconds or whatever interval in seconds as passed to the -n flag Additional info: Package: procps Version: 3.2.6 Kernel: 2.6.16-1.2096_FC4 C Library: glibc-2.3.6-3
Thanks for your report. Your solution is not backward compatible, I think better will be use same solution like in the top command: - usleep(interval * 1000000); + + tv.tv_sec = (long) interval; + tv.tv_usec = (interval - (int) interval) * 1000000; + select(0, NULL, NULL, NULL, &tv);
procps-3.2.6-3.4 has been pushed for fc5, which should resolve this issue. If these problems are still present in this version, then please make note of it in this bug report.
I'd like to know why such a value is being used. Would it hurt to cap the value at 4000? That is over an hour.