Bug 65055 - stat on fifo always returns st_size=0, but worked in previous versions
Summary: stat on fifo always returns st_size=0, but worked in previous versions
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 7.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-05-16 20:12 UTC by Doug Bolling
Modified: 2016-10-03 09:18 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-06-27 22:25:22 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 65055 0 master MERGED spec: Clean up the initscripts requirement 2016-10-03 09:18:59 UTC

Description Doug Bolling 2002-05-16 20:12:41 UTC
Description of Problem:

Executing fstat on a named pipe (fifo) always returns 0 when running Linux 
version 2.4.7-10 ( RedHat 7.2 ).  Under Linux version 2.2.17-14 ( RedHat 7.0 ), 
the same fstat always returned the correct number of unread bytes in the fifo.

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

kernel version 2.4.7-10

How Reproducible:

Here is the source code necessary to reproduce

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int main( int ac, char * av[] )
{
        struct stat     s;

        sleep( 5 );

        fstat( 0, &s);
        printf( "bytes:%u\n", s.st_size );
}


Steps to Reproduce:
1.  Compile the above source using "gcc -o <filename> <filename>.c"
2.  At a linux prompt, enter %> echo "12345" | ./<filename>
3.  It should print 'bytes:6' when working properly.  
Actual Results:

bytes:0

Expected Results:

bytes:6

Additional Information:

You can also change the string length in the echo to get different values when 
running on the older version of linux mentioned above.  

Bug #60395 actually described the same problem, but provided a bogus 
explanation as to the cause of the problem.  The information we get from this 
test program is that the stat always returns correct sizes on previous versions 
of Linux, not random values as the developer stated in bug #60395.  If the 
statements in bug #60395 are supposed to be accurate, how in the world do you 
get the number of unread bytes in the fifo before doing the actual read???


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