Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 191493 - watch -n doesn't handle large integers properly
watch -n doesn't handle large integers properly
Product: Fedora
Classification: Fedora
Component: procps (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Karel Zak
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2006-05-12 09:32 EDT by Stephen Kratzer
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-06-21 13:31:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to watch.c (734 bytes, patch)
2006-05-12 09:32 EDT, Stephen Kratzer
no flags Details | Diff

  None (edit)
Description Stephen Kratzer 2006-05-12 09:32:43 EDT
Created attachment 128937 [details]
Patch to watch.c
Comment 1 Stephen Kratzer 2006-05-12 09:32:43 EDT
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:


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
Comment 2 Karel Zak 2006-06-01 06:40:57 EDT
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);
Comment 3 Fedora Update System 2006-06-01 10:27:26 EDT
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.
Comment 4 Albert Cahalan 2006-06-02 00:56:00 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.