Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » Application crashes and OS instability can overwrite the currently edited file with junk
Application crashes and OS instability can overwrite the currently edited file with junk [message #54567] Sat, 15 August 2020 05:04 Go to next message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 219
Registered: June 2011
Experienced Member
Haven't tested on windows but I've found under linux that a file open for editing in theide will be overwritten with junk if you have a spontaneous reboot or particularly bad app crash.
Re: Application crashes and OS instability can overwrite the currently edited file with junk [message #54595 is a reply to message #54567] Wed, 19 August 2020 09:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
jjacksonRIAB wrote on Sat, 15 August 2020 05:04
Haven't tested on windows but I've found under linux that a file open for editing in theide will be overwritten with junk if you have a spontaneous reboot or particularly bad app crash.


I am not quite sure it even might be our fault...

FYI, files in TheIDE are not quite "open". They are loaded from filesystem as whole into memory and then saved into filesystem again whole. TheIDE actually always only has single file "loaded" and saves it when switching to another file or even if you just move focus from TheIDE to another application.

If you see junk, then probably your filesystem got corrupted.

Mirek
Re: Application crashes and OS instability can overwrite the currently edited file with junk [message #54603 is a reply to message #54595] Wed, 19 August 2020 13:49 Go to previous messageGo to next message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 219
Registered: June 2011
Experienced Member
It's definitely not your fault. I have a bad PSU that causes spontaneous reboots and I haven't been able to replace it. That said, it is anomalous that this corruption only seems to happen to files in theide and nowhere else so it made me wonder if there are ways to reduce the likelihood of data loss in less than ideal situations. It's also happened where I lost a file when I caused a runtime error that ended in a crash of just theide. Are theide and an app under development somehow sharing memory?
Re: Application crashes and OS instability can overwrite the currently edited file with junk [message #54605 is a reply to message #54595] Wed, 19 August 2020 14:43 Go to previous messageGo to next message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 219
Registered: June 2011
Experienced Member
I suppose what I'm getting at is this: if you write a bad application and run it does theide fork a child process that could access the parent's memory (in this case, the currently open file) and overwrite it with junk which would then be written to the filesystem once theide has focus again?
Re: Application crashes and OS instability can overwrite the currently edited file with junk [message #54606 is a reply to message #54605] Wed, 19 August 2020 16:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
jjacksonRIAB wrote on Wed, 19 August 2020 14:43
I suppose what I'm getting at is this: if you write a bad application and run it does theide fork a child process that could access the parent's memory (in this case, the currently open file) and overwrite it with junk which would then be written to the filesystem once theide has focus again?


Well, as I have tried to explain previous post, it is quite unlikely that the file is even open (now reading the post, I guess I have not stated that clearly. But the file is open only when loading and saving). And there is no memory sharing between theide and child process.

The only thing that comes to mind is that when you launch app from theide, the path to main package is passed in the environment. That is to support GetDataFile function, which is really handy for testing. So maybe the bad app can know the folder where source files are...

Mirek
Re: Application crashes and OS instability can overwrite the currently edited file with junk [message #54607 is a reply to message #54606] Wed, 19 August 2020 16:35 Go to previous messageGo to next message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 219
Registered: June 2011
Experienced Member
I get what you're saying. I suppose I should be clearer myself. We agree that the file's likely not open... but the file's data is still in the editor. And you said the file is saved when focus changes. Well running the app would change the focus, causing a save, would it not?

I suppose it's not worth arguing if as you say it's not forked with memory sharing, but the scenario I was describing:

* you run badapp
* new child process is created, it shares memory with theide
* child process is badly behaved and modifies parent memory (by that, I mean it changes the text in the editor itself, the array backing it, not any open file)
* theide sees the focus has changed to the new process, opens the file and saves the mangled contents of the editor back to the file

So all I meant to suggest is that the contents of the editor are being overwritten, not the file directly.
Re: Application crashes and OS instability can overwrite the currently edited file with junk [message #54616 is a reply to message #54607] Fri, 21 August 2020 09:43 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
jjacksonRIAB wrote on Wed, 19 August 2020 16:35
I get what you're saying. I suppose I should be clearer myself. We agree that the file's likely not open... but the file's data is still in the editor. And you said the file is saved when focus changes. Well running the app would change the focus, causing a save, would it not?

I suppose it's not worth arguing if as you say it's not forked with memory sharing, but the scenario I was describing:

* you run badapp
* new child process is created, it shares memory with theide
* child process is badly behaved and modifies parent memory (by that, I mean it changes the text in the editor itself, the array backing it, not any open file)
* theide sees the focus has changed to the new process, opens the file and saves the mangled contents of the editor back to the file

So all I meant to suggest is that the contents of the editor are being overwritten, not the file directly.


Understood. Well, in all of my programming years I have learned to never say "100% impossible", so let us just say "99.9999% impossible" Smile
Previous Topic: Can U++ TheIDE be used with cxxtest ?
Next Topic: [SOLVED] Skipping package building/linking when certain configuration is on
Goto Forum:
  


Current Time: Fri Mar 29 16:45:30 CET 2024

Total time taken to generate the page: 0.01771 seconds