KSaveFile

Richard Smith kde at metafoo.co.uk
Sat Feb 21 21:20:38 GMT 2004


On Saturday 21 February 2004 9:13 pm, Waldo Bastian wrote:
> On Sat February 21 2004 18:01, Julian Rockey wrote:
> > If I understand correctly KSaveFile helps atomically save data by first
> > creating a new temporary file, which is written to, and then deleting the
> > original and renaming the temporary file to the original name.
> >
> > A side effect of this is that the original file's permissions are lost
> > and replaced with the default permissions for the user.
> >
> > In practice this causes me trouble with KAddressBook std.vcf files which
> > I want to share between accounts (on a single machine). I chmod g+rw
> > std.vcf but as soon as one user edits the address box it's reset to
> > rw-r---- so the other then can't.
> >
> > Should we be remembering the permissions of the original file and
> > re-setting them after the renaming? I can patch it if required.
>
> Probably a good idea, yes.

Resetting them before renaming (or even writing to the file at all) would be 
better, otherwise you still have a race where someone can read the file 
before it's moved and chmod'd (if, for instance, the file's not supposed to 
be group readable).

Richard




More information about the kde-core-devel mailing list