Date: Thu, 28 May 1998 23:35:36 +0200 (MET DST)
   From: "Per Boussard, ERA/T/ED" <[EMAIL PROTECTED]>

   Also, it's more interesting to look at what is
   not said here, you probably do 'echo -n "">file', and the
   interesting part is the ">", which causes the shell to do a
   open/write/close.
   
In the shell command `echo -n "" > file' the shell does an open with
truncation, echo does a write, and the system does an automatic close
when echo exits.  The shell does no writes at all.  This is, however a
typo in my original; I meant to write `echo -n "" >> file' which
avoids the truncation and is a closer analogue.

   Opening the file makes it show on the other afs-client immediately. Using
   truss we see

   erapbou@mackabee:perltest> truss -t open perl -e 'open (F,">x")'
   [..deleted..]
   open("x", O_WRONLY|O_CREAT|O_TRUNC, 0666)       = 3

   This shows that the file is created and the status of the directory is
   changed, so the server tells the other clients that are interested in that
   directory. Then, when you write data into the file, that isn't sent to the
   other clients until you close the file. 

Perhaps the original questioner needs to specify the question more
carefully.  I was assuming it was an open of an existing file, with no
O_TRUNC.  As you interpreted the question, opens with O_TRUNC|O_CREAT
of new files, I agree that the results are as you describe.





Reply via email to