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

race condition in install targets in nmake Makefiles

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.1.0 Beta 1
    • 5.0.0 Beta 2
    • Build tools: qmake
    • None
    • 457afb3749f4f1d7db86c89cbf251e18fbd0dfbf

    Description

      For example qtbase/src/corelib/Makefile.Debug. There are the targets install_class_headers and install_targ_headers. Both are independent and can be executed in parallel by jom.

      Both start with the following command:

      @if not exist D:$(INSTALL_ROOT)\dev\qt\5.0-vs2012\qtbase\include\QtCore $(MKDIR) D:$(INSTALL_ROOT)\dev\qt\5.0-vs2012\qtbase\include\QtCore 
      

      There's a race condition:

      • both conditions (if not exists) evaluate to true
      • one $(MKDIR) call creates the directory
      • one $(MKDIR) call fails to create the directory because it already exists

      Note that this works on Linux, because mkdir -p doesn't complain, if the directory already exists.

      Possible solutions:

      • Create a target for every distinct "if not exist $(MKDIR)" call and let the install target that needs this directory depend on it.
      • Prevent parallel execution of install targets by chaining them.

      Attachments

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

        Activity

          People

            buddenha Oswald Buddenhagen
            jbornema Joerg Bornemann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes