From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <08cc4ae9d4a860824f3ddbbbd856db4a@vitanuova.com> Date: Tue, 15 Aug 2006 19:20:28 +0100 From: rog@vitanuova.com To: 9fans@cse.psu.edu Subject: Re: [9fans] acme crash recovery In-Reply-To: <09dd2f54ac4e761c7b3fa19388d756e1@plan9.bell-labs.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 9feee958-ead1-11e9-9d60-3106f5b1d025 > acme, like sam, keeps a log of changes in /tmp/*acme. I believe that > such a file contains enough to reconstruct acme's state when (or > shortly before) it crashed, but I don't know of an automated means of > doing so. i've done this, with mixed results, on a couple of occasions. it's almost always more hassle than it's worth. for a start acme doesn't keep all its state in the /tmp/*acme files, only that which has been flushed out of memory. i looked into this, but can't now remember what the criteria are. anyway, the temp file doesn't hold all the metadata necessary for its reconstruction - it's just used as an external adjunct to main memory. so you tend to get old and new versions of fragments of text in different parts of the file. also, it's worth noting that the characters in the file are held as two-byte runes (local endian). luckily they're all two-byte aligned, otherwise things would be even harder. i modified strings(1) to dump rune-based strings with no length restriction. this provides a start, but more often than not the text you're looking for is not in the file. the most successful technique was when my mouse was unplugged (plugging it in did not cause it to start working again). typing enough text in the current window caused the text to be flushed to the temp file, enabling its retrieval from another terminal, assuming you're using a remote fs. acme does dump when it catches a note, but depending on the circumstances sometimes just truncates the dump file, which can erase whatever stuff you already had! a couple of changes i've long contemplated: - if you restored acme from a given dump file, it should dump to the same file. - dumping should be "safe" - i.e. it should create the file under another name and dump to it before moving the original out of the way, moving the new file to the dump file and finally removing the original. less chance of erasing precious data this way. - an option to get acme to do an automatic dump every so often. (e.g. to acme.backup.dump) but i'm also aware that these changes might be anathema to purists...