Bug 191493 - watch -n doesn't handle large integers properly
Summary: watch -n doesn't handle large integers properly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: procps
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-05-12 13:32 UTC by Stephen Kratzer
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-06-21 17:31:18 UTC
Type: ---
Embargoed:


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

Description Stephen Kratzer 2006-05-12 13:32:43 UTC
Created attachment 128937 [details]
Patch to watch.c

Comment 1 Stephen Kratzer 2006-05-12 13:32:43 UTC
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

Comment 2 Karel Zak 2006-06-01 10:40:57 UTC
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 14:27:26 UTC
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 04:56:00 UTC
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.