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

qmake computes wrong path for .qmake.stash when invoking it on an example of a repo containing a .qmake.conf file

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.14
    • Fix Version/s: 5.12.5, 5.13.1
    • Component/s: Build System
    • Labels:
      None
    • Environment:

      macOS 10.14

    • Platform/s:
      All
    • Technical Risk:
      Normal
    • Commits:
      224a60989ed95e8b91ac88a12666af6e5a66e619 (qt/qtbase/5.12)

      Description

      The path structure for reproducing is important, thus my steps to reproduce will mention my structure.

      Steps to reproduce:
      1)make dir and cd /Volumes/T3/Dev/qt/qt5_cmake/examples/bla
      2) call qmake on an example /Volumes/T3/Dev/qt/qt5_cmake/qtbase/examples/corelib/threads/mandelbrot/mandelbrot.pro

      3) Observe the following message and path:

      Info: creating stash file /Volumes/T3/Dev/.qmake.stash
      

      The .qmake.stash file is created a couple of levels higher in the file system, instead of the build dir of the example.

      The culprit code is in

      bool QMakeEvaluator::prepareProject(const QString &inDir)
      /Volumes/T3/Dev/qt/qt514_source/qtbase/qmake/library/qmakeevaluator.cpp:1107

      bool QMakeEvaluator::prepareProject(const QString &inDir) {
      // ..
      forever {
                      conffile = sdir + QLatin1String("/.qmake.conf");
                      if (!m_vfs->exists(conffile, flags))
                          conffile.clear();
                      cachefile = dir + QLatin1String("/.qmake.cache");
                      if (!m_vfs->exists(cachefile, flags))
                          cachefile.clear();
                      if (!conffile.isEmpty() || !cachefile.isEmpty()) {
                          if (dir != sdir)
                              m_sourceRoot = sdir;
                          m_buildRoot = dir;
                          break;
                      }
                      if (dir == superdir)
                          goto no_cache;
                      QFileInfo qsdfi(sdir);
                      QFileInfo qdfi(dir);
                      if (qsdfi.isRoot() || qdfi.isRoot())
                          goto no_cache;
                      sdir = qsdfi.path();
                      dir = qdfi.path();
                  }
      // ..
      

      the forever loop assumes that both the source and build dir would be at the same file system level, so when searching for a ".qmake.conf" file, sdir goes one level up in lock step with dir (build dir).

      In my particular case, the .qmake.conf is found a few levels higher in /Volumes/T3/Dev/qt/qt5_cmake/qtbase/ while navigating up from mandelbrot.pro.

      The same amount of ".."s are added to the build dir, resulting in going from /Volumes/T3/Dev/qt/qt5_cmake/examples/bla
      to
      /Volumes/T3/Dev

      I think the proper solution is to extract the forever loop into two loops, so that there is no assumption that the .qmake.conf file and the .qmake.cache file are at the same level.

        Attachments

          Issue Links

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

            Activity

              People

              • Assignee:
                jbornema Joerg Bornemann
                Reporter:
                alexandru.croitor Alexandru Croitor
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes