Bug 33457 - tp-qt4 uses non-atomic file write in avatar cache
Summary: tp-qt4 uses non-atomic file write in avatar cache
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-qt (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL: http://git.collabora.co.uk/?p=user/xc...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-25 03:59 UTC by Xavier Claessens
Modified: 2011-01-25 06:09 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Xavier Claessens 2011-01-25 03:59:23 UTC
The avatar cache is using not-atomic operation to store the image on-disk. This means when an avatar is updated, if more than on process is tracking its avatar data, they will both write the data into the cache at the same time. This is racy.

For now we could just create a QTemporaryFile then rename it. It's probably not 100% portable, but long-term solution is doing the cache in CM as said in bug #33410
Comment 1 Olli Salli 2011-01-25 04:04:23 UTC
Otherwise simple enough, but QFile::rename doesn't overwrite existing files. Looking at how similar tasks are implemented in KDE libraries could be a reasonable step forward.
Comment 2 Xavier Claessens 2011-01-25 04:50:40 UTC
Patch: http://git.collabora.co.uk/?p=user/xclaesse/telepathy-qt4.git;a=shortlog;h=refs/heads/atomic-write

I have to disable autoremove otherwise it remove the renamed file too :(
Comment 3 Xavier Claessens 2011-01-25 06:09:56 UTC
Branch merged.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.