[PATCH] Fix bug in kdelibs/kabc/lock.cpp
Simone Gotti
simone.gotti at email.it
Wed Apr 13 10:32:59 BST 2005
While I was fixing some kitchensynk issues I noticed this ugly bug in
kabc/lock.cpp that was bringing all the lock system to not work creating
wrong lock files.
The problem is located in this line:
mError = i18n("The resource '%1' is locked by application '%2'.")
.arg( mIdentifier.replace( '_', '/' ) ).arg( app );
When a resource is locked this line is executed to notify of the error, but
the instruction: mIdentifier.replace( '_', '/' ), will replace the chars and
so on the next run mIdentifier will be the file with the '/' instead of the
'_' bringing to something like this:
1) I lock the resource.
2) Try to access to it:
kabc: Lock::lock()
kabc: locksDir:/home/motaboy/.kde/share/apps/kabc/lock/
kabc: mIdentifier: _home_motaboy_.kde_share_apps_korganizer_std.ics
kabc: -- lock name:
/home/motaboy/.kde/share/apps/kabc/lock/_home_motaboy_.kde_share_apps_korganizer_std.ics.lock
The above instruction is executed, it changes mIdentifier from
'_home_motaboy_.kde_share_apps_korganizer_std.ics' to
'/home/motaboy/.kde/share/apps/korganizer/std.ics'
3)
kabc: Lock::lock()
kabc: locksDir:/home/motaboy/.kde/share/apps/kabc/lock/
kabc: mIdentifier: /home/motaboy/.kde/share/apps/korganizer/std.ics
kabc: -- lock name:
/home/motaboy/.kde/share/apps/kabc/lock//home/motaboy/.kde/share/apps/korganizer/std.ics.lock
kabc: -- lock unique name:
/home/motaboy/.kde/share/apps/kabc/lock//home/motaboy/.kde/share/apps/korganizer/std.icslTmLEAEM
So the locking mechanism is broken and I can access the resource also if
it's locked.
Can I commit (and backport) the attached patch?
Bye!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs-kabc-lock.cpp.patch
Type: text/x-diff
Size: 536 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050413/9647b053/attachment.patch>
More information about the kde-core-devel
mailing list