Bug 97335

Summary: Creating a (read-only) file resource for a file owned by a different user not possible in kaddressbook
Product: kab3 Reporter: Reinhold Kainhofer <reinhold>
Component: generalAssignee: Tobias Koenig <tokoe>
Status: RESOLVED UNMAINTAINED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Reinhold Kainhofer 2005-01-18 13:42:58 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

I have a vcf file and the kde accounts file on my harddisk owned by user and group reinhold. The permissions are:
-rw-r--r--   1 reinhold reinhold 12139 Jan 18 13:37 Institut.vcf
-rw-r--r--   1 reinhold reinhold 64457 Jan 18 13:35 accounts

As user kdetest (who has read-only permissions to the above files) I try to add a new file resource in kaddressbook for these files (and mark them as read-only). After pressing OK in the Resource configuration dialog, nothing happens: The new resource is not added, but also no error dialog appears.

As soon as I make the file writable for the user kdetest (e.g. by setting the permissions to 666 or changing the owner to kdetest), things work as usual.

Cheers,
Reinhold
Comment 1 Tobias Koenig 2005-01-19 16:37:41 UTC
CVS commit by tokoe: 

Open file in read-only mode when we've no write access.
Fixes #97335

BUG:97335


  M +7 -2      resourcefile.cpp   1.34


--- kdelibs/kabc/plugins/file/resourcefile.cpp  #1.33:1.34
@@ -178,6 +178,11 @@ bool ResourceFile::doOpen()
     return ok;
   } else {
+    if ( readOnly() ) {
+      if ( !file.open( IO_ReadOnly ) )
+        return false;
+    } else {
     if ( !file.open( IO_ReadWrite ) )
       return false;
+    }
 
     if ( file.size() == 0 ) {


Comment 2 Tobias Koenig 2009-08-05 16:21:47 UTC
The development of the old KAddressBook will be discontinued for KDE 4.4.
Since the new application has the same name, but a completly new code base we close all bug reports against the old version and ask the submitters to resend there reports against the new product.