[Tutor] Corrupt file(s) likelihood and prevention?

DL Neil PyTutor at danceswithmice.info
Fri Jan 31 18:20:11 EST 2020


On 31/01/20 4:56 PM, boB Stepp wrote:
> I just finished reading a thread on the main list that got a little
> testy.  The part that is piquing my interest was some discussion of
> data files perhaps getting corrupted.  I have wondered about this off
> and on.  First what is the likelihood nowadays of a file becoming
> corrupted, and, second, what steps should one take to prevent/minimize
> this from happening?  I notice that one of the applications I work
> with at my job apparently uses checksums to detect when one of its
> files gets modified from outside of the application.


Hi boB,
(I haven't looked at it again, since posting yesterday) Yes the thread 
did seem to become argumentative - unnecessarily (IMHO) because the 
'right answer' only exists in the OP's mind, not any of 'us'/ours. 
However...)

To put this question into the context of the original post, the issue 
was not so much the likelihood of a file becoming corrupt, per-se; it 
was a question of whether the mechanism of (one of) the proposed 
'solutions' exposed the user to an higher, or perhaps less-obvious, risk 
of corruption.

One idea was to keep a dynamic list within a (disk) file. As the program 
ran, this list would be extended and/or altered to record progress/success.

  - when a file is opened (+a or +w) it must be closed properly.

  - the OP specified being able to interrupt operation using Ctrl+c.

Put those two together and the risk becomes 'obvious' (to those with the 
experience/expertise to see it).

Some mitigation was offered.

As an alternative, using an RDBMS was suggested. This was disputed.

The other alternative (me causing 'trouble' again), was to query the 
need to use such a blunt instrument (Ctrl+c) to 'exit'.


So, if I've interpreted your interest correctly, the pertinent part of 
that (perhaps less apparent in your question) is: what can we do about 
the risk  of corruption, when files which may have been updated, have 
not been/cannot be, closed properly?


"Here be dragons!"
(and by that I don't mean that Alan is about to take you on a hike 
around Snowdonia/Wales...)
-- 
Regards =dn


More information about the Tutor mailing list