[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Power outage corrupted World.mcl file
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Power outage corrupted World.mcl file

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Yasik   Ukraine  (14 posts)  [Biography] bio
Date Thu 19 May 2016 06:52 PM (UTC)

An hour ago we had a power outage and sadly my UPS did not work it out well.
After I turned PC back on and MUSH tried to load world.mcl file - error message appeared saying "File does not have a valid MUSHClient XML signature", followed by another info box "Unexpected file format".
Looking in file itself (View in FAR) gave me creeps - the world.mcl was empty, completely, but FAR still showed its size 600k+ (as it should be, I have a lot of coding/scripting done, its fine).
Backuped version of world.mcl is too old to use, and without my triggers/scripts its pretty much unplayable.

At the moment of outage I was editing some triggers - corresponding menu window was opened.

Any hints how to recover the world.mcl content?
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 19 May 2016 08:02 PM (UTC)

Amended on Thu 19 May 2016 08:03 PM (UTC) by Nick Gammon

If you still have 600k of data but it "looks" empty then the first few bytes may have been corrupted by the power failure.

I suggest using an editor that can handle binary files (possibly UltraEdit) and see if you can view the file contents. You may be able to get past the corrupted header and see the bulk of your file. It should be (reasonably) human-readable XML format.

It might be wise to immediately make a copy of the file before doing anything in case you make things worse. For example, if you open it, and then save it, it might truncate it back to zero bytes.

A world file normally looks something like this at the start:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Sunday, October 19, 2008, 1:58 PM -->
<!-- MuClient version 4.37 -->
<!-- Written by Nick Gammon -->
<!-- Home Page: http://www.mushclient.com/ -->
   date_saved="2008-10-19 13:58:27"

The ideal thing would be if the first byte was corrupted to a binary zero, so putting the "<" back should fix it.

Again, if you try making changes save them under another file name, in case that change doesn't work.

If I may suggest, for the future, have automatic backups of the world file (say, with the date/time appended) in a script run from a timer. Even if it only runs once each time you start the client, that could save you a lot of grief.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Yasik   Ukraine  (14 posts)  [Biography] bio
Date Reply #2 on Thu 19 May 2016 08:35 PM (UTC)
Thanks for quick answer!

I copied to "backup" copy immediately.

Then opened with Notepad++, it shows "NUL" everywhere, definitely not readable for humans.

Then tried to put a < before those NUL's, saved and tried to open in MUSH - not working, same error messages.

Then ran some "undelete" software I could find in google (recuva, ntfsundelete, winundelete) - either nothing found, or shows 1 file (which is another world's set of triggers (Aardwolf) - but AA do not requires alot of coding/scripting on our side, so I "lost" only 1 trigger I made recently - and easily made it anew).

I wonder what happens whe we "save" changes made to triggers with Ctrl+S?
I mean, MUSH keeps world.mcl file opened all the time during MUSH executable runs, or loads in memory from disk when we enter menu? Maybe MUSH failed to "close" the world.mcl file "properly" and WinXP still considers it as "waiting for writing" since it is opened?
Or MUSH "saves/closes" the world.mcl file when we close any "Options" windows?
Not sure I understand the deep process correctly, though.
It may be at operating system level or hdd hardware/controller, no?

Idea of automatic backup is great, I will implement it immediately.
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Fri 20 May 2016 04:17 AM (UTC)
No, it doesn't keep the world file open. It is opened for reading when you load it. It is then closed. The data is copied into memory (from the XML format) and used entirely in-memory.

When you save with Ctrl+S the world file is overwritten during the save. I suppose if the power went off exactly when it was being saved then you might have got a directory entry for the new copy, but nothing written to it.

I'm a bit surprised the undelete didn't work. There is nothing in the writing process that erases the file before rewriting it.

You might want to read my post about using Git to backup your world files:



Or MUSH "saves/closes" the world.mcl file when we close any "Options" windows?

No, only when the entire world file is saved. Until then it is all just in memory.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (1,744 posts)  [Biography] bio   Global Moderator
Date Reply #4 on Fri 20 May 2016 06:21 AM (UTC)
There is also already a plugin called Automatic_Backup.xml that will do daily world file backups for you. I'd look into that.

[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]