KTemporaryFile::createLocalFile()

Jaison Lee lee.jaison at gmail.com
Thu Jul 5 14:39:01 BST 2007


> K/QTemporaryFile does not provide this functionality directly, the attached patch adds
>   QString KTemporaryFile::createLocalFile()
> with the above implementation.
>
> Do we want that / ok to commit?

FWIW when I ported KTempFile to KTemporaryFile I purposefully did not
add a function of this type. As Oswald has stated it's not quite a
security risk (although with the number of systems KDE4 is going to
run on I'm not going to say that a bad scenario can't happen
somewhere) but mostly because I didn't want to encourage this sort of
behavior. There are many instances already of programs doing this for
all sorts of wierd reasons and then being lazy about cleanup and right
now I have 2MB of orphaned temporary files in my kde tmp dir.

The primary use for something like this is for deliberately passing a
TEMPORARY filename to another program and I'm not sure so many
applications have a need for this that it should be in the library.

If a function such as this were to be added I think it should require
a path prefix, since the ability to create a PERMANENT unique filename
in a particular location (for saving internal data) and store it for
later is more common. But without that I don't think adding it at all
is a good idea.

But if you do add it, at least remove the "tmpfile.close();" line as
it is basically a no-op.  :)




More information about the kde-core-devel mailing list