[PATCH] Fix bug in kdelibs/kabc/lock.cpp

Simone Gotti simone.gotti at email.it
Wed Apr 13 13:54:38 BST 2005


 --------- Original Message --------
 Da: kde-core-devel at kde.org
 To: kde-core-devel at kde.org <kde-core-devel at kde.org>
 Oggetto: [PATCH] Fix bug in kdelibs/kabc/lock.cpp
 Data: 13/04/05 11:39
 
I really think it was already fixed. My CVS snapshot was too old... 

http://webcvs.kde.org/kdelibs/kabc/lock.cpp?rev=1.9&view=markup

Bye!

 > 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!
> 
> 






More information about the kde-core-devel mailing list