public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* problems in kernel 2.4.20  stat() seems to return always size zero for any fifo (named pipe)
@ 2003-03-06 18:22 jds
  2003-03-06 19:21 ` Richard B. Johnson
  0 siblings, 1 reply; 3+ messages in thread
From: jds @ 2003-03-06 18:22 UTC (permalink / raw)
  To: linux-kernel


 Hi:

I have a problem using stat() with kernel 2.4.20
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.

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

In Kernel 2.4.18-X the RedHat work perfect, e inclusive in 2.4.20-X the Redhat
  beta 8.0.94

Helpme please.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: problems in kernel 2.4.20  stat() seems to return always size zero for any fifo (named pipe)
  2003-03-06 18:22 problems in kernel 2.4.20 stat() seems to return always size zero for any fifo (named pipe) jds
@ 2003-03-06 19:21 ` Richard B. Johnson
  2003-03-07 18:58   ` jds
  0 siblings, 1 reply; 3+ messages in thread
From: Richard B. Johnson @ 2003-03-06 19:21 UTC (permalink / raw)
  To: jds; +Cc: linux-kernel

On Thu, 6 Mar 2003, jds wrote:

> 
>  Hi:
> 
> I have a problem using stat() with kernel 2.4.20
> 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.
> 
> How reproducible:
> Always
[SNIPPED...]

Have you ever tried this before? I'm not aware that stat
or lstat is supposed to return the byte-count of a pipe
of FIFO. It certainly doesn't on my Sun SunOS 5.5.1 or
Linux 2.4.18. In fact, the Sun prevents ^Z when reading
the FIFO interactively so your script won't test it.

The second echo "abcd" >xx blocks so the pipe never
accepts anything anyway, there are never any "bytes-
in-the-pipe" that should be visible anyway. You can't
write to a pipe until a reader is reading, and if the
reader is suspended, there is no requirement for writing
to be buffered, i.e., a write to be accepted for such
a pipe.

Pipes do not work like you propose and, if they ever did,
that was the bug.

> Expected Results:  prw-rw-r--    1 kostadin kostadin        5 Feb 21 13:54 xx
> 
> In Kernel 2.4.18-X the RedHat work perfect,
> e inclusive in 2.4.20-X the Redhat
>   beta 8.0.94
>

Linux 2.4.18 does not accept writes to a pipe when a reader is
not actively reading. As such, a byte-count cannot exist.

If you have a program that expects a byte-count from a FIFO,
the program is broken. FIFOs must have readers before any
writes are accepted.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: problems in kernel 2.4.20  stat() seems to return always size zero for any fifo (named pipe)
  2003-03-06 19:21 ` Richard B. Johnson
@ 2003-03-07 18:58   ` jds
  0 siblings, 0 replies; 3+ messages in thread
From: jds @ 2003-03-07 18:58 UTC (permalink / raw)
  To: root; +Cc: linux-kernel

In fact, do you have any idea of what's wrong?
I tryed to fix this in diferent ways but it doesn't seem to work.

Do you have any sugestion?



 



---------- Original Message ----------
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: jds <jds@soltis.cc>
Sent: Thu, 6 Mar 2003 14:21:49 -0500 (EST)
Subject: Re: problems in kernel 2.4.20  stat() seems to return always size
zero for any fifo (named pipe)

> On Thu, 6 Mar 2003, jds wrote:
> 
> > 
> >  Hi:
> > 
> > I have a problem using stat() with kernel 2.4.20
> > 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.
> > 
> > How reproducible:
> > Always
> [SNIPPED...]
> 
> Have you ever tried this before? I'm not aware that stat
> or lstat is supposed to return the byte-count of a pipe
> of FIFO. It certainly doesn't on my Sun SunOS 5.5.1 or
> Linux 2.4.18. In fact, the Sun prevents ^Z when reading
> the FIFO interactively so your script won't test it.
> 
> The second echo "abcd" >xx blocks so the pipe never
> accepts anything anyway, there are never any "bytes-
> in-the-pipe" that should be visible anyway. You can't
> write to a pipe until a reader is reading, and if the
> reader is suspended, there is no requirement for writing
> to be buffered, i.e., a write to be accepted for such
> a pipe.
> 
> Pipes do not work like you propose and, if they ever did,
> that was the bug.
> 
> > Expected Results:  prw-rw-r--    1 kostadin kostadin        5 Feb 21 13:54 xx
> > 
> > In Kernel 2.4.18-X the RedHat work perfect,
> > e inclusive in 2.4.20-X the Redhat
> >   beta 8.0.94
> >
> 
> Linux 2.4.18 does not accept writes to a pipe when a reader is
> not actively reading. As such, a byte-count cannot exist.
> 
> If you have a program that expects a byte-count from a FIFO,
> the program is broken. FIFOs must have readers before any
> writes are accepted.
> 
> Cheers,
> Dick Johnson
> Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
> Why is the government concerned about the lunatic fringe? Think 
> about it.
------- End of Original Message -------


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-07 18:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-06 18:22 problems in kernel 2.4.20 stat() seems to return always size zero for any fifo (named pipe) jds
2003-03-06 19:21 ` Richard B. Johnson
2003-03-07 18:58   ` jds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox