D17289: KDevelop/Shell: set dedicated TMPDIR

Pino Toscano noreply at phabricator.kde.org
Sun Mar 17 09:21:39 GMT 2019


pino requested changes to this revision.
pino added inline comments.

INLINE COMMENTS

> core.cpp:136
> +    auto tmpLocation = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
> +    const QString tmpName(QStringLiteral("/kdevelop-tmp-%1-").arg(getuid()));
> +    const auto pos = tmpLocation.lastIndexOf(tmpName);

using the user ID is definitely wrong here: with this change, opening a second kdevelop will erase the temporary directory of the first...
OTOH this is not needed anyway, see my comment about QTemporaryDir.

> core.cpp:136-149
> +    const QString tmpName(QStringLiteral("/kdevelop-tmp-%1-").arg(getuid()));
> +    const auto pos = tmpLocation.lastIndexOf(tmpName);
> +    if (pos >= 0) {
> +        // we must have been started by another KDevelop session,
> +        // restore the default TempLocation
> +        tmpLocation = tmpLocation.left(pos);
> +    }

Please do not manually create temporary directories!
This creates the directory with default permissions, so potentially accessible by other users.
There is the right API  for this: QTemporaryDir. Please do use it, with no need to use the user ID as identifier.

REPOSITORY
  R32 KDevelop

REVISION DETAIL
  https://phabricator.kde.org/D17289

To: rjvbb, #kdevelop, kfunk, mwolff, pino
Cc: aaronpuchert, mwolff, pino, kfunk, kdevelop-devel, gennad, glebaccon, domson, antismap, iodelay, alexeymin, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20190317/9a3a35a8/attachment-0001.html>


More information about the KDevelop-devel mailing list