Recovering a corrupted script
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Recovering a corrupted script
Hello,
I made an error on my scientific calculator script, I wanted to load some values on booting, so I decided to use on openStack message. Bad idea!
I couldn't open the script anymore, it always crashed the C++ runtime enviroment.
So I opened it with a simple text editor and I removed manually the openStack script part.
Now LiveCode says that file is corrupted, probably LiveCode add a signature or byte check in the file, because I didn't change the binary part, so it isn't really corrupted.
How can I recover the file?
I made an error on my scientific calculator script, I wanted to load some values on booting, so I decided to use on openStack message. Bad idea!
I couldn't open the script anymore, it always crashed the C++ runtime enviroment.
So I opened it with a simple text editor and I removed manually the openStack script part.
Now LiveCode says that file is corrupted, probably LiveCode add a signature or byte check in the file, because I didn't change the binary part, so it isn't really corrupted.
How can I recover the file?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Recovering a corrupted script
Hi Max,
In the Development dropdown select Suspend Development Tools before opening your stack.
I think, not sure what "it always crashed the C++ runtime enviroment" means
Simon
In the Development dropdown select Suspend Development Tools before opening your stack.
I think, not sure what "it always crashed the C++ runtime enviroment" means

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Recovering a corrupted script
Simon, it ask me for a backup file, where are backup files?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Recovering a corrupted script
Hi Max,

As a result the stack is now corrupted and useless.
Do you have a backup of that file?
To suppress all messages, "openstack" in your case, and open that namely stack, enter this into the messagebox:
lock messages;go stack "Path/to/your/stack.livecode"
This way all the scripts will NOT trigger and you can fix your error(s).
Best
Klaus
well, you opened, modified and saved a BINARY file with a simple TextEditor!MaxV wrote:So I opened it with a simple text editor and I removed manually the openStack script part.
Now LiveCode says that file is corrupted, probably LiveCode add a signature or byte check in the file, because I didn't change the binary part, so it isn't really corrupted.

As a result the stack is now corrupted and useless.
Do you have a backup of that file?
To suppress all messages, "openstack" in your case, and open that namely stack, enter this into the messagebox:
lock messages;go stack "Path/to/your/stack.livecode"
This way all the scripts will NOT trigger and you can fix your error(s).
Best
Klaus
Re: Recovering a corrupted script
Klaus,
I couldn't open anymore my script, it crashed all livecode IDE every time. (all IDE collapsed saying runtime c++ error)
So I had to remove the guilty text part.
Is there any recover tool?
I couldn't open anymore my script, it crashed all livecode IDE every time. (all IDE collapsed saying runtime c++ error)
So I had to remove the guilty text part.
Is there any recover tool?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Recovering a corrupted script
You corrupted the stack by editing it with a TextEditor, no matter why you did this, but you cannot use this stack anymore.
And not, there are no recover tools, I'm afraid.
And not, there are no recover tools, I'm afraid.
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Recovering a corrupted script
If this problem occurred with LC 6.0.1, it may be an engine bug that was fixed with LC 6.0.2. That will at least prevent the issue from happening again.
For recovery, if you didn't save the stack while it showed the corrupted script it's probably still in good shape, and likely can be opened in 6.0.2 to resume working as normal.
If you had saved the stack while the script was displaying as corrupted, that script has then been replaced with the corrupted data, and unfortunately I don't believe there's a way to recover it.
I should note here that one of the reasons I've enjoyed LC for so many years is that file corruption is unusually rare. I've only personally experience file corruption myself once since 1997, and have only heard of fewer than half a dozen true cases of file corruption in that span. The way LS writes to disk - as a complete file rather than paging, and with an automatic backup until the write is done and the format verified - generally avoids the sort of corruption issues that have plagued so many other programs over the years, from HyperCard to FileMaker and more.
So while it's disappointing to lose work to corruption, I think you'll find that it's not only a very rare occurrence, but also the sort of thing that the engine team will jump on immediately once they receive a recipe for how the corruption occurred, as was the case with the script corruption I discovered in 6.0.1.
For recovery, if you didn't save the stack while it showed the corrupted script it's probably still in good shape, and likely can be opened in 6.0.2 to resume working as normal.
If you had saved the stack while the script was displaying as corrupted, that script has then been replaced with the corrupted data, and unfortunately I don't believe there's a way to recover it.
I should note here that one of the reasons I've enjoyed LC for so many years is that file corruption is unusually rare. I've only personally experience file corruption myself once since 1997, and have only heard of fewer than half a dozen true cases of file corruption in that span. The way LS writes to disk - as a complete file rather than paging, and with an automatic backup until the write is done and the format verified - generally avoids the sort of corruption issues that have plagued so many other programs over the years, from HyperCard to FileMaker and more.
So while it's disappointing to lose work to corruption, I think you'll find that it's not only a very rare occurrence, but also the sort of thing that the engine team will jump on immediately once they receive a recipe for how the corruption occurred, as was the case with the script corruption I discovered in 6.0.1.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Recovering a corrupted script
Richard,
sometimes it really helps if you read all posts before you answer

Best
Klaus
sometimes it really helps if you read all posts before you answer

So I opened it (the STACK) with a simple text editor and I removed manually the openStack script part.

Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Recovering a corrupted script
Thanks, Klaus, but that still leaves us with the mystery of how the corruption occurred, and how to prevent it going forward.
If this happened in 6.0.1, I'd still be interested in learning more about how it happened, since I spent considerable time trying to come up with a concise recipe and couldn't; ultimately the recipe I submitted had far more steps than I would have preferred.
And if it happened with an earlier version, the fix in 6.0.2 may or may not resolve the problem going forward.
So while I'm glad the script was recovered, I'm still not sure why the IDE wouldn't open the stack or how we can prevent this from happening again.
If this happened in 6.0.1, I'd still be interested in learning more about how it happened, since I spent considerable time trying to come up with a concise recipe and couldn't; ultimately the recipe I submitted had far more steps than I would have preferred.
And if it happened with an earlier version, the fix in 6.0.2 may or may not resolve the problem going forward.
So while I'm glad the script was recovered, I'm still not sure why the IDE wouldn't open the stack or how we can prevent this from happening again.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Recovering a corrupted script
Hi Richard,
1. Max had a handler in the OPENSTACK script that caused an error!
2. So he opened that stack with a TextEditor and deleted that hanlder of the TEXT IN the TextEditor!?
3. Then he obviously SAVED that stack also IN the TextEditor.
THAT IS how the corruption occurred! Livecode NOT involved!
Get the picture now?
Best
Klaus
hmmmm....FourthWorld wrote:Thanks, Klaus, but that still leaves us with the mystery of how the corruption occurred, and how to prevent it going forward.
1. Max had a handler in the OPENSTACK script that caused an error!
2. So he opened that stack with a TextEditor and deleted that hanlder of the TEXT IN the TextEditor!?
3. Then he obviously SAVED that stack also IN the TextEditor.
THAT IS how the corruption occurred! Livecode NOT involved!
Get the picture now?

Best
Klaus
Re: Recovering a corrupted script
Wait a minute, however the original livecode file could not be opened anymore:
My first impression of livecode file format is like a binary array.
Where are livecode file specification?
- I'm on Windows
- I doubled click on my script
- a warning window said me: "C++ runtime error, contact RunRev"
- I tried to comment comment some lines in file with the original livecode inside the OpenStack message with a text editor, and I succeded to open it with LiveCode 6.0.1
- however I didn't comment all lines inside the OpeStack and the IDE crashed again when I saved
- I double click on my script
- a warning window said me: "C++ runtime error, contact RunRev"
- I tried to remove the on OpenStack part of my script with a text editor
- I get corrupted file when I try to open it
My first impression of livecode file format is like a binary array.
Where are livecode file specification?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Recovering a corrupted script
Hi Max,
That's the way to go with these kind of problems (script error preventing correct opening of stack)

Best
Klaus
Did you try to open the stack NOT by doubleclicking on the desktop but as I described in my earlier post?MaxV wrote:Wait a minute, however the original livecode file could not be opened anymore:
- I'm on Windows
- I doubled click on my script
That's the way to go with these kind of problems (script error preventing correct opening of stack)
No idea, at least it is a BINARY format which you wrecked by modifying and saving it in a TEXT editorMaxV wrote:My first impression of livecode file format is like a binary array.

Don't know, you better ask RunRev, if they provide this specifications (at all).MaxV wrote:Where are livecode file specification?
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Recovering a corrupted script
What did the folks at RunRev say when you contacted them?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Recovering a corrupted script
Hi Richard,
LOTS of work in the moment?
Take a break
Best
Klaus
LOTS of work in the moment?
Take a break

Best
Klaus
Re: Recovering a corrupted script
As an aside, if you don't want messages sent when you open the stack, click the Messages icon in the toolbar. If it is bolded, it means no messages will occur. This is a short way to do what Klaus suggested, it's the same as putting "lock messages" into the message box, but you don't need to type anything.
You are correct that a checksum is stored and if you change the stack outside of LiveCode it will be corrupted and can't be opened. The next time, lock the messages and open your stack from inside LiveCode as Klaus said. That usually works.
Also, back up your work.
You are correct that a checksum is stored and if you change the stack outside of LiveCode it will be corrupted and can't be opened. The next time, lock the messages and open your stack from inside LiveCode as Klaus said. That usually works.
Also, back up your work.

Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com