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
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.
2.4.9-31 will return some random value instead of 0
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