D21650: Shorten sockets file path

Daniel Vrátil noreply at phabricator.kde.org
Sat Jun 8 12:46:10 BST 2019


dvratil requested changes to this revision.
dvratil added a comment.


  Good idea, this generally opens a new range of possibilities to simplify the code a bit, since the socket will now exist in user-specific directory (unlike until now it existed in `/tmp` on Linux, which could possibly clash with other users if it were called only "akonadi", hence the username and random string) so the name can be deterministic without random strings.

INLINE COMMENTS

> utils.cpp:104
>      const QString link = StandardDirs::saveDir("data") + QLatin1Char('/') + QLatin1String("socket-") + hostname;
> -    QString tmpl = QLatin1String("akonadi-") + QString::fromLocal8Bit(pw_ent->pw_name) + QLatin1String(".XXXXXX");
> +    QString tmpl = QLatin1String("XXXXXX");
>  

Since on Linux you are now creating the directory in `/var/run/user/<uid>/`, I'd very much prefer to keep `akonadi` in the name...

Actually, since you cannot have two same instances of Akonadi running at the same time, it should be perfectly fine to call the folder `akonadi` for the default instance and `akonadi-<instancename>` when `Akonadi::Instance::hasIdentifier()` is `true`, no more random strings.

This would make the directory deterministic for each instance, simplifying the code.

> utils.cpp:151
>  
>      if (!mkdtemp(directoryString.data())) {
>          qCCritical(AKONADISERVER_LOG) << "Creating socket directory with template" << directoryString << "failed:" << strerror(errno);

Once you change to the deterministic format, `mkdtemp ` can be switched to `QDir::mkpath()`

REPOSITORY
  R165 Akonadi

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

To: fazevedo, dfaure, dvratil
Cc: kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20190608/cdbe7ef0/attachment-0001.html>


More information about the kde-pim mailing list