9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] pipefile with regular file
@ 2000-08-01 14:30 Stephen Harris
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Harris @ 2000-08-01 14:30 UTC (permalink / raw)
  To: 9fans

Pipefile is great, it's simple and I like how it uses namespace ability
of Plan9 to give us a read "stream filter" which later apps don't need 
to even know about.

But I am having a problem with reads on a filtered regular file not ever 
hitting EOF:

(this is from memory:)
pipefile -r 'tr a-z A-Z' myfile

cat myfile
(uppercase text to the terminal, but no prompt)

I had to kill the cat with <del> :-o
Same thing if I redirect the cat to a file, have to kill it with <del>.

I thought it would go like:
	i ) tr eventually hits EOF
	ii) tr exits as last writer on internal pipe (data1) supplying 
	   data to be read by clients (cat) reading myfile
	iii) cat reads the remaining data if any and then hits EOF (there
	     being no more writers), and exits.
	
Anybody see why that's not happening, or does it work for you?

Steve

Everything you do from now on will be more fun - Windows 95 installation







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

* Re: [9fans] pipefile with regular file
@ 2000-08-02  2:29 rob pike
  0 siblings, 0 replies; 2+ messages in thread
From: rob pike @ 2000-08-02  2:29 UTC (permalink / raw)
  To: 9fans

> But I am having a problem with reads on a filtered regular file not ever 
> hitting EOF:

The kernel has a ref on the other end of the pipe because it's still
available to be opened and used again.  You'll never see EOF.

There were a couple of missing calls to close in the code I sent, but
even if you close everything in sight, you'll never see EOF. There's a
twisty maze of circular dependencies holding the structure up.

As I said in the beginning, this trick is suitable for continuous
files such as devices, but not for regular files.

-rob



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

end of thread, other threads:[~2000-08-02  2:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-01 14:30 [9fans] pipefile with regular file Stephen Harris
2000-08-02  2:29 rob pike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).