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

qmake creates invalid Makefile when path contains : (colon)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.11.2
    • 5.0.0
    • Build tools: qmake
    • None
    • 7c34e0a7b48572be1f9e3fb45911a13b01798e37

      When the path to a file or dependency contains the : (colon) character, qmake creates an invalid Makefile. The problem is that : is a special character in Makefile rules and it needs to be escaped.

      If either the file or the dependency contains a : character, this will not parse correctly.

      Makefile: /home/me/foo:bar/baz # invalid
      /home/me/foo:bar/baz: something/else # invalid
      

      qmake should be escaping : to create valid syntax.

      Makefile: /home/me/foo\:bar/baz # valid
      /home/me/foo\:bar/baz: something/else # valid
      

      This clearly doesn't affect Windows because : is not valid in paths on Windows but it is perfectly valid on Unix and OBS makes use of it.

      It may be enough to patch the escapeFilePath method but I'm not sure of all the places where this is used.

      QString
      UnixMakefileGenerator::escapeFilePath(const QString &path) const
      {
          QString ret = path;
          if(!ret.isEmpty()) {
              ret = unescapeFilePath(ret).replace(QLatin1Char(' '), QLatin1String("\\ ")).replace(QLatin1Char(':'), QLatin1String("\\:"));
              debug_msg(2, "EscapeFilePath: %s -> %s", path.toLatin1().constData(), ret.toLatin1().constData());
          }
          return ret;
      }
      

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

            buddenha Oswald Buddenhagen
            lramsay Lincoln Ramsay (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes