Re: How to remove a single line from a flat file



On May 18, 7:10 am, Neil Madden <n...@xxxxxxxxxxxxx> wrote:

I think you are contradicted by the quoted history of this thread (above):


Now, now, no need to argue over what I thought or meant. I'm sitting
right here - feel free to ask me, in private or public, what I meant.
I'll try, yet again, to explain.

There are several states that critical files (like passwords or other
types of access control or resource listing files) can be in.

1. Fully existent. Think a quiet period when no changes are occurring
to the list of users and passwords.

2. Not present - in some of the previous discussions, this would be
the case if one did the move of password to some temporary name.

3. Incomplete - again, this would be the case from the earlier
examples, where one moved the file and then rewrote it.

4. Inconsistent - this state applies to the last example, where one
creates a temporary file then does a move of the temporary file to the
authority file. So, how can there be inconsistent state here? Let's
play "imagine this"...

Application 1 opens a file and starts reading through, looking for
information.
Application 2 creates a temporary file, consisting of new,
replacement, or remaining records after a deletion.
Application 1 continues reading
Application 2 completes the creation of the replacement file and does
the move.

Application 1 is reading a file that doesn't exist any longer,
essentially. I don't believe that it is going to see the new file - it
didn't open it. So it is only going to see what was in the original
file, which must be in cache or something.

This is where it would really be useful to have fully functional file
locking, so that at the time of opening a file, one opens it with
locking that says "someone is reading this file" or "someone is
writing this file". If someone is writing the file at the time someone
wants to read it, then likely one would wait. If someone is reading
the file at the time someone else is reading it, no problem, let it
happen. If someone is reading the file when someone wants to move the
temporary file into place, then I guess one would wait, or, perhaps,
some sort of "override lock" mechanism might be put into place that
would signal the reader "hey, something has changed - you've lost your
lock, you need to start over somehow ".

J Average Developer is going to look at this thread and say "boy, that
old guy is certainly paranoid". And I say "yup, young whippersnapper.
After programming for developers for 30 years ... and in particular
doing maintenance fixes for most of that time on the same code base,
you'd find you became paranoid as well."


.



Relevant Pages

  • Re: Put your wish list for SP3 for Office 2003 here
    ... > reading. ... > After furious head scratching, boe asked: ... minutes to repair when it opens next time? ...
    (microsoft.public.office.misc)
  • Re: convenient way to read text file multiple times without reopening it
    ... deleted or modified while you are reading it, you will have to take some ... I said implicit locking is needed for that example to work. ... program opens it for writing and proceeds to make changes. ... but not when I create InputStreamReader from that FileInputStream. ...
    (comp.lang.java.programmer)
  • Re: double read on network files
    ... I thought I might manage the impact by tweaking buffersize. ... Decreasing buffersize to 1024, and reading the ... In addition to reading the data twice, it's also opening and closing the ... It just doubles the amount of superfluous opens and closes. ...
    (comp.lang.tcl)
  • RE: Turn off reading layout when opening attachments
    ... setting or something in outlook, but I can't see any where to change it. ... it opens in reading view. ... attachments from automatically opening in reading layout. ...
    (microsoft.public.word.docmanagement)
  • Re: how to read a file newly generated in real time?
    ... it with write-only permissions and only changes that once it's ... One of those could be that the other program opens the file ... the file exists and it's permitted to open the file for reading. ... to obtain further informations) to determine why fopendid fail, ...
    (comp.lang.c)