Huh? No the behavior of the pipe itself is perfect! Date blocked on the pipe 
*before getting the time* so it could sit there for days and still report 
current time when the pipe is finally read. 

It's just that something on the mono/laddiealpha/tsdos train doesn't like the 
file it's reading changing size while its being read. Which was not an issue 
the pdd protocol ever imagined.

Willard
Sent from Samsung tablet

-------- Original message --------
From Russell Davis <[email protected]> 
Date: 01/09/2017  2:25 PM  (GMT-07:00) 
To Model 100 Discussion <[email protected]> 
Subject Re: [M100] THAT didn't work... ;-) 
 
if you want to be able to write to a named pipe before your reader is created 
you have to open the named pipe as read/write using an extra step e.g.

---
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $ mkfifo foo
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $ exec 3<>./foo
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $ date > ./foo &
[1] 2561
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $ date
Mon  9 Jan 21:21:53 UTC 2017
[1]+  Done                    date > ./foo
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $ cat ./foo
Mon  9 Jan 21:21:49 UTC 2017
^C
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $ rm foo
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $ mkfifo foo
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $ date > ./foo &
[1] 2567
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $ date
Mon  9 Jan 21:22:34 UTC 2017
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $ cat ./foo
Mon  9 Jan 21:22:43 UTC 2017
[1]+  Done                    date > ./foo
pi@glooston:~/GnuCOBOL/open-cobol-code/branches/gnu-cobol-2.0 $

----
although that brings up another problem in that ^C needed to kill the reader 
unless you background the reader.

bst rgrds
Russell
On 1/9/2017 4:04 PM, Willard Goosey wrote:
So I tried a clever trick and it didn't work.

(This is NOT a bug report about any of the named programs, as it's a
weird edge case.)

So UNIX (and therefore Linux) has these things called "named
pipes". They're like files, except that they're strictly buffers --
you write something to one and it's only there until it's read.

galvatron:~$ mkfifo foo
galvatron:~$ date > foo &
[1] 395
galvatron:~$ date
Mon Jan  9 13:52:21 MST 2017
galvatron:~$ cat foo
Mon Jan  9 13:52:23 MST 2017
[1]+  Done                    date >foo
galvatron:~$ 

So, interestingly, note that the date written to the named pipe "foo"
wasn't written until it was read!

Just as an experiment, I created ~/root/DATE.DO as a named pipe and
redirected date(1) into it... Then tried to read it from tsdos via the
laddiealpha PDD server.

The result: M100 visits Cold Start City. 

Not really surprising, something probably got confused by the fact
that the named pipe is reported as a 0-length file.

Would be an easy way to sync the M100's time to a laddiealpha server,
but it's not to be. 

Willard

Reply via email to