Bug 619664

Summary: [CentOS 5.5] select()'s timeout breaks POSIX spec
Product: Red Hat Enterprise Linux 5 Reporter: Sam Trenholme <strenholme.usenet>
Component: kernelAssignee: Red Hat Kernel Manager <kernel-mgr>
Status: CLOSED WORKSFORME QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: low    
Version: 5.5   
Target Milestone: rc   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-27 11:30:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Sam Trenholme 2010-07-30 05:59:05 UTC
Description of problem:

The select() system call takes twice as long to timeout as it should.

Version-Release number of selected component (if applicable):

CentOS 5.5 (regression; CentOS 5.4 is fine)

How reproducible:

Always reproducible.

Steps to Reproduce:
1. cat > select.delay.c << EOF
/* Tiny program to show CentOS 5.5 bug. Public domain */

#include <sys/select.h>
#include <stdio.h>

main() {
        struct timeval tv;
        tv.tv_sec = 1;
        tv.tv_usec = 0;
        return 0;
2. cc -o select.delay select.delay.c
3. time ./select.delay
Actual results:

Numbers along these lines:

real 0m2.002s
user 0m0.000s
sys 0m0.005s

Expected results:

Numbers like this:

real 0m1.098s
user 0m0.000s
sys 0m0.000s

Additional info:

This is a bug because the POSIX specification for "select()" at http://www.opengroup.org/onlinepubs/000095399/functions/select.html states that "the timeout period is given in seconds and microseconds" and the POSIX specification for "time.h" at http://www.opengroup.org/onlinepubs/009695399/basedefs/time.h.html points out the tv_sec is seconds, e.g. "time_t tv_sec Seconds".

Comment 1 Sam Trenholme 2010-07-30 06:00:08 UTC
Originally submitted at http://bugs.centos.org/view.php?id=4465 and instructed to go upstream.  So, here I am.

Comment 2 Jes Sorensen 2013-02-27 11:30:30 UTC
Upstream means going to the linux-kernel mailing list - Red Hat is not
upstream for this.

Please try the mailing list.

Comment 3 Sam Trenholme 2013-03-16 23:12:26 UTC
For what it is worth, this bug has been fixed in CentOS 5.9.

Comment 4 Sam Trenholme 2013-03-16 23:13:09 UTC
Closing as "works for me"