Bug 305527

Summary: Collection scanner should check the xml it writes for invalid characters
Product: [Applications] amarok Reporter: Wyatt Epp <wyatt.epp>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 2.6.0   
Target Milestone: 2.7   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Wyatt Epp 2012-08-21 02:03:32 UTC
The collection scanner was failing with the message:
amarok:   [WARNING] [ScanManager] Aborting ScanManager ScannerJob with error "Unexpected ''."
Sentynel on IRC checked the output of amarokcollectionscanner with qxmlstreamreader, found a directory with the ^Y character in its name was causing it to choke, and suggested the bug title as a general fix.

Renaming the directory allowed it to finish correctly, but this bug causes the collection scanner to abort before adding any tracks to the database and additionally does not adequately notify the user of the problem even when running with --debug.  Maybe make the debug messages more verbose, too?

Reproducible: Always
Comment 1 Edward Hades 2012-10-25 14:28:07 UTC
Git commit 6b8e129fb94a06d550f332724ef018d10fb045eb by Edward Hades.
Committed on 19/10/2012 at 03:41.
Pushed by hades into branch 'master'.

collectionscanner: prevent writing malformed XML

As you probably know already, Qt deviates from the "output strictly,
input relaxed" practice by producing shit in QXmlStreamWriter, which is
then being rejected by QXmlStreamReader.

This is a temporary solution, to try to escape all possible occurences
of invalid characters in the XML.

REVIEW: 106944

M  +4    -3    shared/collectionscanner/Directory.cpp
M  +3    -2    shared/collectionscanner/Playlist.cpp
M  +2    -20   shared/collectionscanner/Track.cpp
M  +0    -1    shared/collectionscanner/Track.h
C  +24   -43   shared/collectionscanner/utils.h [from: shared/collectionscanner/Playlist.cpp - 054% similarity]     [License: GPL]

http://commits.kde.org/amarok/6b8e129fb94a06d550f332724ef018d10fb045eb