OCaml Forge

Detail: [#829] Ctrl-C interrupt uninstall -> corrupt setup.log

Bugs: Browse | Download .csv | Monitor

[#829] Ctrl-C interrupt uninstall -> corrupt setup.log

Date:
2010-12-14 13:01
Priority:
3
State:
Open
Submitted by:
ygrek (ygrek)
Assigned to:
Sylvain Le Gall (gildor-admin)
Product:
OASIS
Due in version:
None
Resolution:
None
Severity:
normal
Version:
0.2.0
Component:
OASIS
Operating System:
Linux
 
URL:
Summary:
Ctrl-C interrupt uninstall -> corrupt setup.log

Detailed description
Pressing Ctrl-C during uninstall leads to half-written line in setup.log and at the next invocation setup.ml complains :
E: Malformed log file '.../setup.log' at line 254

Better write to temporary file and rename to setup.log when finished.

Followup

Message
Date: 2010-12-14 17:00
Sender: Sylvain Le Gall

Humm, the problem is that you probably hit Ctrl-C during BaseLog.unregister. This function filter the whole setup.log rewriting it...

If you interrupt it in the middle, you will lose half of the registered events...
Date: 2010-12-14 16:52
Sender: ygrek

Probably you can explicitely flush output channel after every line - this way corrupt log is possible only on power loss - and no need to mess with temp files and signal handlers at all.
Date: 2010-12-14 13:40
Sender: Sylvain Le Gall

On a second thought, I can combine temporary file + interrupt handler to be 100% safe in fact.

Setup
interrupt handler
create temporary

Do
do something with temporary

Teardown
remove temporary
restore interrupt handler and call initial behavior if it has been triggered
Date: 2010-12-14 13:29
Sender: Sylvain Le Gall

I don't like to play with temporary files, they can be hard to remove (i.e. maintain the system clean).

Maybe I can setup an interrupt handler (e.g. Sys.signal Sys.sigint) to recover of this kind of error?

It would be probably reuseable for setup.data...

Attached Files:

Changes:

Field Old Value Date By
assigned_tonone2010-12-14 13:29gildor-admin