Bug 65055 - stat on fifo always returns st_size=0, but worked in previous versions
stat on fifo always returns st_size=0, but worked in previous versions
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Arjan van de Ven
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-05-16 16:12 EDT by Doug Bolling
Modified: 2016-10-03 05:18 EDT (History)
2 users (show)

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

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 65055 master MERGED spec: Clean up the initscripts requirement 2016-10-03 05:18 EDT

  None (edit)
Description Doug Bolling 2002-05-16 16:12:41 EDT
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:


Expected Results:


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.