Bug 60395 - stat() seems to return always size zero for any fifo (named pipe)
Summary: stat() seems to return always size zero for any fifo (named pipe)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 7.2
Hardware: i686
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-02-27 12:50 UTC by Pedro Pascual
Modified: 2007-04-18 16:40 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2002-02-27 12:55:37 UTC
Embargoed:


Attachments (Terms of Use)

Description Pedro Pascual 2002-02-27 12:50:07 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020205

Description of problem:
I have a problem using stat() with kernel 2.4.9-21.
The size of ANY fifo is always 0.
There is no backward compatibility.
Probably it is a kernel bug in this particular version.
The problem shows up when using the ls, stat commands.


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


How reproducible:
Always

Steps to Reproduce:
1. mkfifo xx
2. cat > xx &
3. cat < xx
4. ^Z
5. echo "abcd" > xx

	

Actual Results:  prw-rw-r--    1 kostadin kostadin        0 Feb 21 13:54 xx


Expected Results:  prw-rw-r--    1 kostadin kostadin        5 Feb 21 13:54 xx


Additional info:

The expected results is what you get with previous kernels like 2.4.3-12

Comment 1 Arjan van de Ven 2002-02-27 12:55:32 UTC
stat() on a fifo is undefined as per POSIX and SUS standards. The value it had
before was random, and due to a very serious kernel bug actually looked like
something real.

If you have software that depends on this you REALLY need to fix the software.
REALLY.

We can try to make it return a value that looks like something real again,
maybe. But this "meaning" is actually without meaning since it depends on the
current internal implementation on fifo's and that implementation will change
soon.

Comment 2 Arjan van de Ven 2002-02-28 09:41:43 UTC
2.4.9-31 will return some random value instead of 0

Comment 3 Doug Bolling 2002-05-16 19:39:14 UTC
On Linux version 2.2.17-14 (RedHat 7.0), the stat always returned the actual 
number of unread bytes in the fifo (not a random value).  We are now running 
Linux version 2.4.7-10 (RedHat 7.2) and the stat always returns a size of 
zero.  If your explanation of the problem is accurate, how do we go about 
getting the number of unread bytes in the fifo before we do any reads on the 
fifo?

Doug


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