Bug 68070 - Add a CRC on config files throu kconfigbackend
Summary: Add a CRC on config files throu kconfigbackend
Status: RESOLVED NOT A BUG
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-12 21:58 UTC by douard
Modified: 2013-07-24 20:10 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
My kdeglobals INIFile after corruption (5.12 KB, text/plain)
2004-05-27 13:12 UTC, Luca Greco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description douard 2003-11-12 21:58:07 UTC
Version:            (using KDE KDE 3.1.93)
Installed from:    Compiled From Sources

I've noticed, as a long time KDE user, that a crash of a KDE app, or a harddrive space shortage, or any other reason, may make some of the config files in the .kde/share/config dir of the user being corrupted. This may prevent KDE to start correctly next time, or only one app, or whatever. I have also lost my address book once or twice, I had not backed up... Which is annoying.

So I guess that it could be nice to have 2 features :

- a CRC stamp in every config file created by a KDE app (as soon as it make use of the standard kconfig api), so the file is rejected is it detected as corrupted, when calculated CRC does not correspond to the CRC included in the file (and so, calculated at creatio time). This may prevent KDE to crash at startup time, which can occur some times dur to corrupted config files.
- have a 1-level automatic backup system, as emacs does with its # files (vi too, I know).  
Both these easily implemented features may dramatically improve usability for the simple user. With theses, if kconfigbackend detects a corrupted file, it can try to load the last backup file, which is far better than just crashing the app... 

David
Comment 1 Waldo Bastian 2003-11-18 17:44:42 UTC
If the user edits the file manually the CRC will be incorrect.
Comment 2 douard 2003-11-18 18:16:36 UTC
Yes, that may be a problem. Maybe there should be a little tool for regenerating the CRC stamp in a config file... With a comment, at the beginnig of every config file, telling the command to execute after a manually modification on the file, no user should be "surprised" by this feature. Every config file could look like this :

---------------------------------------------------------------------------------------------
## This configuration file is marked. If you modify it, you should run the following
## command : "kstamp $filemane" after any manual modification, or it will be 
## ignored by the application
##
## MD5SUM="XXXXXXX"

[Item 1]
foo=bar
...

---------------------------------------------------------------------------------------------

I think the md5 sum should be run on the active part of the file only. So comments and blank lines do not interfere in md5 sum.
I put double # in order to easily detect the "header" part of the file that should be overrided by kstamp.

David
Comment 3 Luca Greco 2004-05-27 13:12:22 UTC
Created attachment 6145 [details]
My kdeglobals INIFile after corruption

Notice that the first part of the file is binary!
Comment 4 Christoph Feck 2011-07-25 18:15:22 UTC
It is the kernel/file systems responsibility to ensure the data is intact. If an application crashes while writing the file, that crash should be fixed instead.

If an application crashes because of a corrupted file, it also should be fixed in that application. Remember that config files are editable by hand, so if you put junk in there, the application should correctly ignore it.

I prepended the junk from that file to my kwriterc, but got no crash. If KConfig crashes when parsing such files as added to this bug, please add the backtrace.
Comment 5 Christoph Feck 2013-07-24 20:10:20 UTC
No response, changing status. Please reopen, if you have more information.