9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Re: echo -n
@ 2006-11-21  9:01 Fco. J. Ballesteros
  2006-11-21 15:23 ` Dave Lukes
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Fco. J. Ballesteros @ 2006-11-21  9:01 UTC (permalink / raw)
  To: 9fans

:  I think Plan 9 got it completely right. Being able to push a 0-byte
:  write through the kernel is mighty handy. I got quite annoyed with
:  Unix at various points over the years as I watched "optimizations"
:  gobble up my attempts to get a 0 byte write through the kernel.

Do you remember why you wanted to push a 0-byte write?

thanks


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

* Re: [9fans] Re: echo -n
  2006-11-21  9:01 [9fans] Re: echo -n Fco. J. Ballesteros
@ 2006-11-21 15:23 ` Dave Lukes
  2006-11-21 15:37 ` ron minnich
  2006-11-24  4:06 ` Lyndon Nerenberg
  2 siblings, 0 replies; 16+ messages in thread
From: Dave Lukes @ 2006-11-21 15:23 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

My .25¢:
    echo -n
does precisely nothing,
so if you want that effect as an rc command, then why not use, for example:
     . /dev/null
instead?

>  Do you remember why you wanted to push a 0-byte write?

How else can you write tapemarks on a half-inch magtape?

Also, "push a 0-byte write" is the wrong way to think about it:
it's "send a 0-length chunk".
In the case of boundaryless media, it's nugatory; In the case of 
boundaryful media, it's useful.

To be honest, I don't care if no-one can think of an application for it.
To me it makes perfect sense, whereas the alternative doesn't:
1) write boundary preservation is definitely useful, and I've heard 
no-one say otherwise.
   Therefore you have to chose to either refuse or ignore 0-length 
records (which?) as a special case
   or you do as is done now and treat them like any other chunk.

2) it's impossible to reassemble write boundaries if they're lost:
   the converse is untrue.
   i.e. you can simulate a boundaryless system easily with a boundaryful 
system,
   but not vice-versa.

To me, either of the above is sufficient reason to leave things as they are.

DaveL




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

* Re: [9fans] Re: echo -n
  2006-11-21  9:01 [9fans] Re: echo -n Fco. J. Ballesteros
  2006-11-21 15:23 ` Dave Lukes
@ 2006-11-21 15:37 ` ron minnich
  2006-11-21 15:54   ` erik quanstrom
                     ` (2 more replies)
  2006-11-24  4:06 ` Lyndon Nerenberg
  2 siblings, 3 replies; 16+ messages in thread
From: ron minnich @ 2006-11-21 15:37 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 11/21/06, Fco. J. Ballesteros <nemo@lsub.org> wrote:
> :  I think Plan 9 got it completely right. Being able to push a 0-byte
> :  write through the kernel is mighty handy. I got quite annoyed with
> :  Unix at various points over the years as I watched "optimizations"
> :  gobble up my attempts to get a 0 byte write through the kernel.
>
> Do you remember why you wanted to push a 0-byte write?


it's usually io or networking.

many of the wacky networks I have dealt with have at times needed a
0-byte write; we got the effect via ioctl, since the kernel gobbled up
0-byte writes, the kernel of course knowing much better than you what
you were trying to do, e.g. Linux.

there is of course the need to write a blank punch card with a 0-byte
write, assuming you can find a card punch. And as david mentioned, in
a real case, tape marks.

but, seriously, it's the general issue that you need to tell something
(program, io device, network, whatever) that you don't have anything
to say, which is not the same as saying nothing.

ron


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

* Re: [9fans] Re: echo -n
  2006-11-21 15:37 ` ron minnich
@ 2006-11-21 15:54   ` erik quanstrom
  2006-11-21 16:35   ` Brantley Coile
  2006-11-21 16:49   ` Bakul Shah
  2 siblings, 0 replies; 16+ messages in thread
From: erik quanstrom @ 2006-11-21 15:54 UTC (permalink / raw)
  To: 9fans

of course it goes without saying that an honorable fellow like
yourself wouldn't be appropriating punch cards that way.

;-)
- erik

On Tue Nov 21 10:38:17 EST 2006, rminnich@gmail.com wrote:
> there is of course the need to write a blank punch card with a 0-byte
> write, assuming you can find a card punch. And as david mentioned, in
> a real case, tape marks.


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

* Re: [9fans] Re: echo -n
  2006-11-21 15:37 ` ron minnich
  2006-11-21 15:54   ` erik quanstrom
@ 2006-11-21 16:35   ` Brantley Coile
  2006-11-21 16:49   ` Bakul Shah
  2 siblings, 0 replies; 16+ messages in thread
From: Brantley Coile @ 2006-11-21 16:35 UTC (permalink / raw)
  To: 9fans

> it's usually io or networking.

like runing wc on a remote machine.  You have
to send an end-of-file to wc's input without
taking down the connection.  Otherwise you never
see the counts.



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

* Re: [9fans] Re: echo -n
  2006-11-21 15:37 ` ron minnich
  2006-11-21 15:54   ` erik quanstrom
  2006-11-21 16:35   ` Brantley Coile
@ 2006-11-21 16:49   ` Bakul Shah
  2 siblings, 0 replies; 16+ messages in thread
From: Bakul Shah @ 2006-11-21 16:49 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> > :  I think Plan 9 got it completely right. Being able to push a 0-byte
> > :  write through the kernel is mighty handy. I got quite annoyed with
> > :  Unix at various points over the years as I watched "optimizations"
> > :  gobble up my attempts to get a 0 byte write through the kernel.

Reminds me of OSes where you couldn't have a 0 length file.
Their designers couldn't imagine why anyone would perform
such a despicable act.

> but, seriously, it's the general issue that you need to tell something
> (program, io device, network, whatever) that you don't have anything
> to say, which is not the same as saying nothing.

I am waiting for someone to write a book with the title
"zero one two...0xffffffff: Facts and Explorations of Computer Science".


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

* Re: [9fans] Re: echo -n
  2006-11-21  9:01 [9fans] Re: echo -n Fco. J. Ballesteros
  2006-11-21 15:23 ` Dave Lukes
  2006-11-21 15:37 ` ron minnich
@ 2006-11-24  4:06 ` Lyndon Nerenberg
  2 siblings, 0 replies; 16+ messages in thread
From: Lyndon Nerenberg @ 2006-11-24  4:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Nov 21, 2006, at 1:01 AM, Fco. J. Ballesteros wrote:

> Do you remember why you wanted to push a 0-byte write?

Look at what FTP has to do with out-of-band messages to abort a
transfer.


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

* Re: [9fans] Re: echo -n
  2006-11-24  4:17           ` Lyndon Nerenberg
@ 2006-11-24 16:24             ` Bruce Ellis
  0 siblings, 0 replies; 16+ messages in thread
From: Bruce Ellis @ 2006-11-24 16:24 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

0 is a number ... a fine and useful one.  if you want to ignore echo
then SYSCALL(1) will do exactly what you want.

brucee

On 11/24/06, Lyndon Nerenberg <lyndon@orthanc.ca> wrote:
> On Nov 21, 2006, at 5:32 PM, dmr@plan9.bell-labs.com wrote:
>
> > 8th edition streams began to transmit them
> > over pipes (or networks).
>
> Since this thread started I've been nagged by the memory of UUCP's
> 'e' protocol.  If my brain hasn't completely cached out, 'e' used the
> ability of Datakit to preserve 0-length messages as an inband
> delimiter, vs. the 't' protocols use of explicit protocol field
> length counters.  (Or was it 'x' that used null read/write ops ... ?)
>
> --lyndon
>


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

* Re: [9fans] Re: echo -n
  2006-11-22  1:32         ` dmr
@ 2006-11-24  4:17           ` Lyndon Nerenberg
  2006-11-24 16:24             ` Bruce Ellis
  0 siblings, 1 reply; 16+ messages in thread
From: Lyndon Nerenberg @ 2006-11-24  4:17 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Nov 21, 2006, at 5:32 PM, dmr@plan9.bell-labs.com wrote:

> 8th edition streams began to transmit them
> over pipes (or networks).

Since this thread started I've been nagged by the memory of UUCP's
'e' protocol.  If my brain hasn't completely cached out, 'e' used the
ability of Datakit to preserve 0-length messages as an inband
delimiter, vs. the 't' protocols use of explicit protocol field
length counters.  (Or was it 'x' that used null read/write ops ... ?)

--lyndon


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

* Re: [9fans] Re: echo -n
  2006-11-21  2:32       ` ron minnich
  2006-11-21 17:36         ` Andrew Lynch
@ 2006-11-22  1:32         ` dmr
  2006-11-24  4:17           ` Lyndon Nerenberg
  1 sibling, 1 reply; 16+ messages in thread
From: dmr @ 2006-11-22  1:32 UTC (permalink / raw)
  To: 9fans

  > This whole discussion has been coming up for years. I can't remember
  > the first time I saw it but it was definitely over a quarter century
  > ago.

Indeed.  7th edition and earlier did ignore 0-length
writes.  8th edition streams began to transmit them
over pipes (or networks).  I recall there were two
problems associated with this; one I forget, the other
was that nroff (for some input) would sometimes
generate one for no good reason, so
  nroff thing.ms | whatever
would terminate prematurely.  It was simplest to
fix nroff.

	Dennis


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

* Re: [9fans] Re: echo -n
  2006-11-21 18:31                 ` Axel Belinfante
@ 2006-11-21 18:53                   ` Skip Tavakkolian
  0 siblings, 0 replies; 16+ messages in thread
From: Skip Tavakkolian @ 2006-11-21 18:53 UTC (permalink / raw)
  To: 9fans

the BUGS section of echo man page should say something
like "echo -n produces a lot of output on 9fans".



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

* Re: [9fans] Re: echo -n
  2006-11-21 18:23               ` andrey mirtchovski
@ 2006-11-21 18:31                 ` Axel Belinfante
  2006-11-21 18:53                   ` Skip Tavakkolian
  0 siblings, 1 reply; 16+ messages in thread
From: Axel Belinfante @ 2006-11-21 18:31 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> > http://9fans.net/archive/2001/09/54 is what you mean, I think.
> >
>
> thank you!

no thanks, it could very well _not_ be what you were looking for -
I realized a few minutes after posting... at least that's when I
recalled something that fitted the description better, but where that is???



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

* Re: [9fans] Re: echo -n
  2006-11-21 17:35           ` andrey mirtchovski
@ 2006-11-21 18:13             ` Axel Belinfante
  2006-11-21 18:23               ` andrey mirtchovski
  0 siblings, 1 reply; 16+ messages in thread
From: Axel Belinfante @ 2006-11-21 18:13 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

http://9fans.net/archive/2001/09/54 is what you mean, I think.

> "the parable of glenda and the multitudes"? this is stuck in my head
> as the expanded version but i have not been able to find it...


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

* Re: [9fans] Re: echo -n
  2006-11-21  2:32       ` ron minnich
@ 2006-11-21 17:36         ` Andrew Lynch
  2006-11-21 17:35           ` andrey mirtchovski
  2006-11-22  1:32         ` dmr
  1 sibling, 1 reply; 16+ messages in thread
From: Andrew Lynch @ 2006-11-21 17:36 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 21.11.2006, at 03:32, ron minnich wrote:

> This whole discussion has been coming up for years. I can't remember
> the first time I saw it but it was definitely over a quarter century
> ago. I think at some point we figured the issue was roughly akin to
> the difference between the empty string and the null string -- where
> EOF is the null string, and 0 bytes of data is the empty string --
> which you can't actually distinguish via read. I'm NOT saying this is
> exactly it, but I think it provides an analogy and a  way to think
> about it.


I'm surprised nobody has mentioned Doug McIlroy's "The UNIX and the
Echo"(*) yet.
An amusing fable about the problem of saying nothing vs. not saying
anything.
I believe I saw an expanded version of it somewhere on the web many
years ago.

Andrew.

(*) The UNIX Programming Environment
Brian W. Kernighan & Rob Pike
Prentice-Hall, 1984



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

* Re: [9fans] Re: echo -n
  2006-11-21  1:23     ` [9fans] Re: echo -n arisawa
@ 2006-11-21  2:32       ` ron minnich
  2006-11-21 17:36         ` Andrew Lynch
  2006-11-22  1:32         ` dmr
  0 siblings, 2 replies; 16+ messages in thread
From: ron minnich @ 2006-11-21  2:32 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

This whole discussion has been coming up for years. I can't remember
the first time I saw it but it was definitely over a quarter century
ago. I think at some point we figured the issue was roughly akin to
the difference between the empty string and the null string -- where
EOF is the null string, and 0 bytes of data is the empty string --
which you can't actually distinguish via read. I'm NOT saying this is
exactly it, but I think it provides an analogy and a  way to think
about it.

I think Plan 9 got it completely right. Being able to push a 0-byte
write through the kernel is mighty handy. I got quite annoyed with
Unix at various points over the years as I watched "optimizations"
gobble up my attempts to get a 0 byte write through the kernel.

Score one more for Plan 9 -- it lets you do what you want to do.

I hope people enjoyed this discussion more than the up-arrow thread.

thanks

ron


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

* [9fans] Re: echo -n
  2006-11-21  0:27   ` ron minnich
@ 2006-11-21  1:23     ` arisawa
  2006-11-21  2:32       ` ron minnich
  0 siblings, 1 reply; 16+ messages in thread
From: arisawa @ 2006-11-21  1:23 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Thanks all for following to my question.

Just my impression ...
If 0 byte writing is a message other than EOF, then we should have
some mechanism that enables to distinguish between 0 byte read and
true EOF.
However introducing a new mechanism to system call is a great surgery.

Coming back to my original question:
	0 byte write using echo -n
What is intended by this operation?
Let  "ECHO" be another "echo" that does not write 0 byte to stdout.
How to distinguish these two commands?
Using the command in rc script to pipe will make the difference.
Are there any other cases that make difference?

If the difference is only in pipe, then we should consider:
is it a legitimate method to let the other end close the pipe?



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

end of thread, other threads:[~2006-11-24 16:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-21  9:01 [9fans] Re: echo -n Fco. J. Ballesteros
2006-11-21 15:23 ` Dave Lukes
2006-11-21 15:37 ` ron minnich
2006-11-21 15:54   ` erik quanstrom
2006-11-21 16:35   ` Brantley Coile
2006-11-21 16:49   ` Bakul Shah
2006-11-24  4:06 ` Lyndon Nerenberg
  -- strict thread matches above, loose matches on Subject: below --
2006-11-20 19:15 [9fans] v9fs mounting in linux erik quanstrom
2006-11-20 22:35 ` Paul Lalonde
2006-11-21  0:27   ` ron minnich
2006-11-21  1:23     ` [9fans] Re: echo -n arisawa
2006-11-21  2:32       ` ron minnich
2006-11-21 17:36         ` Andrew Lynch
2006-11-21 17:35           ` andrey mirtchovski
2006-11-21 18:13             ` Axel Belinfante
2006-11-21 18:23               ` andrey mirtchovski
2006-11-21 18:31                 ` Axel Belinfante
2006-11-21 18:53                   ` Skip Tavakkolian
2006-11-22  1:32         ` dmr
2006-11-24  4:17           ` Lyndon Nerenberg
2006-11-24 16:24             ` Bruce Ellis

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).