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

qt6_create_translation() mishandles -extensions due to malformed regex

    XMLWordPrintable

Details

    • 581fc31c54aaa06af16c2047808a29be1a8d3239 (qt/qttools/dev) 84a80f54fa5caf3eef159e480b2da7b7811b7cf7 (qt/qttools/6.1) 0b4ced53c2b36a84fe7d1a05955137213cc0c144 (qt/qttools/6.2) 8fa3e7b65e0b1351f41cf2947f609f91b4f21858 (qt/tqtc-qttools/5.15)

    Description

      The qt6_create_translation() command contains the following block of CMake code:

          list(FIND _lupdate_options "-extensions" _extensions_index)
          if(_extensions_index GREATER -1)
              math(EXPR _extensions_index "${_extensions_index} + 1")
              list(GET _lupdate_options ${_extensions_index} _extensions_list)
              string(REPLACE "," ";" _extensions_list "${_extensions_list}")
              list(TRANSFORM _extensions_list STRIP)
              list(TRANSFORM _extensions_list REPLACE "^\." "")  # <----- BUG!
              list(TRANSFORM _extensions_list PREPEND "*.")
          else()
              set(_extensions_list "*.java;*.jui;*.ui;*.c;*.c++;*.cc;*.cpp;*.cxx;*.ch;*.h;*.h++;*.hh;*.hpp;*.hxx;*.js;*.qs;*.qml;*.qrc")
          endif()
      

      The list(TRANSFORM ... REPLACE) line has a malformed regular expression. CMake's string parsing would require the backslash to be escaped in order to preserve it as part of the regular expression (to escape the period character). The behavior of the malformed expression will result in the first character of every extension being dropped, not just a leading period character. Any extension that was specified without a leading period would therefore have been incorrectly handled.

      Attachments

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

        Activity

          People

            crscott Craig Scott
            crscott Craig Scott
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: