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

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • 5.12.5, 5.13.1
    • 5.14, 5.15.5, 6.2.0 Beta3
    • Build System
    • None
    • macOS 10.14
    • All
    • 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

          For Gerrit Dashboard: QTBUG-76140
          # Subject Branch Project Status CR V

          Activity

            People

              qtbuildsystem Qt Build System Team
              alexandru.croitor Alexandru Croitor
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes