Bug 295178 - poorly handled index.xml data corruption
Summary: poorly handled index.xml data corruption
Status: RESOLVED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: XML backend (show other bugs)
Version: 4.1.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-01 21:24 UTC by Josef
Modified: 2012-03-03 18:45 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Josef 2012-03-01 21:24:22 UTC
Version:           4.1.1 (using KDE 4.7.4) 
OS:                Linux

My index.xml file got corrupted (perhaps when kphotoalbum closed due to power failure, but not sure). When I tried to start KPhotoAlbum with the corrupt file I get an error message saying 

Error on line 1 column 1 in file /home/josef/Pictures/index.xml: error occurred while parsing element

The only choice of action is the "OK" button. I had to manually find the hidden backup file ".#index.xml" and rename it. 

What I expected was that KPhotoAlbum would handle the situation by offering me an option to use the backup file. 

Reproducible: Always

Steps to Reproduce:
Start KPhotoAlbum with the corrupt XML file

Actual Results:  
KPhotoAlbum throws out an error message and quits.

Expected Results:  
KPhotoAlbum shows an error message and offers to restore the database from a backup.
Comment 1 Josef 2012-03-01 21:31:29 UTC
The corrupt file was too large to upload, so here is a link (~10 MB): http://josf.se/kphotoalbum-corrupt-file/index.xml
Comment 2 Miika Turkia 2012-03-03 18:45:56 UTC
Git commit 375ffdde59ee4a6e73fd25e2d5519c8a8eac9001 by Miika Turkia.
Committed on 03/03/2012 at 19:41.
Pushed by mturkia into branch 'master'.

Offering to recover from backup if index corrupted

If index.xml is corrupted we check if a backup exists. Then we ask the
user if he would like to use the backup.

M  +17   -8    Utilities/Util.cpp
M  +1    -1    Utilities/Util.h
M  +7    -2    XMLDB/FileReader.cpp

http://commits.kde.org/kphotoalbum/375ffdde59ee4a6e73fd25e2d5519c8a8eac9001