[Patch] let KSaveFile honor the umask

Thiago Macieira thiago at kde.org
Wed Mar 26 22:43:50 GMT 2008

David Faure wrote:
>On Wednesday 26 March 2008, Thiago Macieira wrote:
>> David Faure wrote:
>> >On Wednesday 26 March 2008, Thiago Macieira wrote:
>> >> Thorsten Zachmann wrote:
>> >> >Hello all,
>> >> >
>> >> >KSaveFile does not honor the umask for newly created files. Looks
>> >> > like this behaviour was introduces during the port to
>> >> > QTemporaryFile which by default creates file with permissions
>> >> > 0600. This is good for temporary files but for a file saved by an
>> >> > application it is not. The attached patch changes the behaviour
>> >> > so that the KSaveFile does honor the umask for files that are
>> >> > newly created.
>> >> >
>> >> >Ok to commit?
>> >>
>> >> By calling umask, you make the code thread-unsafe.
>> >
>> >Well, this code comes from ktempdir.cpp which uses umask too.
>> And KTempDir was thread-unsafe.
>> >And we never really checked which kdelibs classes are threadsafe, but
>> > it's not too late to start I guess.
>> True, but QTemporaryFile and KTemporaryFile are thread-safe now (to
>> the best of my knowledge). This change of yours would break that.
>> >In both classes, all we want is to "get" the umask, not to set it.
>> > How about we get the umask in some code called during
>> > initialization, like the KGlobalPrivate ctor, and we add a
>> > KGlobal::umask() accessor?
>> That's a compromise, but what if the user sets the umask to something
>> else in the middle of the program?
>That's a 0.000001% use case, and I'm forgetting some zeros.
>I'm really really fine with the requirement that the user has to restart
> the KDE application(s) that should obey the newly set umask
>(or logout/login if we're talking about the always-running applications
>like konqueror-preloaded for instance).
>Aren't you?

I am.

  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080326/e160845b/attachment.sig>

More information about the kde-core-devel mailing list