469,909 Members | 1,805 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,909 developers. It's quick & easy.

mbx repair script

I'm looking for a Python script to repair the mbx header
for a mail file where only the header is corrupted.

Thanks,
Alan Isaac
Jul 19 '05 #1
2 1801
In article <gMUbe.2502$iZ1.2213@trnddc03>,
"David Isaac" <ai*****@verizon.net> wrote:
I'm looking for a Python script to repair the mbx header
for a mail file where only the header is corrupted.


"Repair" and "corrupted" covers a lot of territory.

In the simplest case, a Python script would just be
a nuisance. All mbx files start with a 2048 byte
header, and a valid header can be copied to another
file and still be valid. For example, if the damaged
file still has 2048 bytes of header,

1. Find or create another mbx file "spud".
2. Copy header: $ dd if=spud count=4 > newbx
3. Copy old file: $ dd if=oldbx skip=4 >> newbx
4. change ownership and permission to match oldbx.

This approach isn't perfect - for example, it doesn't
preserve user flag information, but then, user flags
can be messed up by common IMAP4 operations like copying
a message from one folder to another. It assumes you
know where message data actually starts in the file,
but I think you'd need to know that in any event.

If the damage is really just that someone edited the
file in vi and you need to restore the NUL characters,
you could probably write something. Again, you have
to be able to recognize the start of message data
(or rather, the first MBX message header line.) If
the NULs are gone, this is probably preceded by a
series of CRLF ('\r\n'.) Keep track of how much has
been written to the output file, and at this point,
write '\0'*(2048 - n).

Donn Cave, do**@u.washington.edu
Jul 19 '05 #2

"Donn Cave" <do**@u.washington.edu> wrote in message
news:do************************@gnus01.u.washingto n.edu...
All mbx files start with a 2048 byte
header, and a valid header can be copied to another
file and still be valid. For example, if the damaged
file still has 2048 bytes of header,

1. Find or create another mbx file "spud".
2. Copy header: $ dd if=spud count=4 > newbx
3. Copy old file: $ dd if=oldbx skip=4 >> newbx
4. change ownership and permission to match oldbx.

This did not work for me.
Should it?
I thought the header contained information tightly tied
to the rest of the content (to speed search etc) so that
e.g., byte counts could matter.

Can you point me to documentation of the mbx format?

Thanks,
Alan Isaac
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by SheldonMopes | last post: by
reply views Thread by Microsoft | last post: by
4 posts views Thread by Peteroid | last post: by
4 posts views Thread by zufie | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.