Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50877

QLocalSocket begins at "/tmp/" when used with relative paths

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 3.x, 5.5.1
    • Network: Sockets
    • None

      Regarding QLocalSocket::connectToServer()

      https://doc.qt.io/qt-4.8/qlocalsocket.html#connectToServer

      When calling QLocalSocket::connectToServer() with the first argument "name" being a relative path, Qt assumes that it should relate this path to "/tmp/" instead of the current working directory.

      This behaviour is not documented. Furthermore, it is not intuitive. While it is true that some UNIX sockets reside in /tmp/, they can also be in /var/run/, /run/, or virtually anywhere.

      We stumbled upon this while trying to get below the unix path size of 104 characters in linux. Switching from absolute paths to relative paths is technically impossible with this implementation.

      http://code.qt.io/cgit/qt/qtbase.git/tree/src/network/socket/qlocalsocket_unix.cpp#n263

      I understand that this API is ancient and this behaviour should not be changed. But at least please put a warning in the API docs.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            docteam Qt Documentation Team
            jang jang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes