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

QCoreApplication::applicationFilePath() unnecessarily unreliable on unix

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Won't Do
    • Affects Version/s: 4.7.4, 5.10
    • Fix Version/s: None
    • Component/s: Core: I/O
    • Labels:
      None
    • Environment:
      Unix

      Description

      one of the fallback paths in this function reads QDir::current().absoluteFilePath(argv0). the problem here is that QDir::current() does not necessarily represent the cwd at the time the application was started.

      this is a problem for QLibraryInfo, which uses that function to locate qt.conf.

      i'm not entirely sure what to do about it. one could preemptively save the pwd (or even the executable location) in the qapp c'tor. but that comes at a small additional cost, and isn't even reliable (as the qapp is not guaranteed to be created first. maybe a static object would work "in most of the cases"?).

      note that this usually does not affect linux, as it has a specialized code path based on /proc.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              buddenha Oswald Buddenhagen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes