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

qmake2cmake fails to parse unquoted install command with braces

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.3.0
    • Build tools: Other
    • None

    Description

      example input

      target.extra = printf "'%s'\n" a \"b (c d)\" e
      INSTALLS += target

      problem:

      the value is parsed as

      [ 'printf', "'%s'\n", 'a', '\\"b', '(', 'c', 'd', ')', '\\"', 'e' ]

      note how the braces go to separate tokens. this is because of the BracedValue parser

      qmake2cmake's class Scope has the method get_string, which simply does 

      " ".join(self.get(key)
      

      so now the command is different, because the original whitespace is lost. note the extra whitespace around braces 

      // actual
      printf "'%s'\n" a \"b ( c d ) \" e
      
      // expected
      printf "'%s'\n" a \"b (c d)\" e

      workaround: use a quoted string in the .pro file

      target.extra = "printf \"'%s'\n\" a \"b (c d)\" e"
      INSTALLS += target
      

      suggested solution

      parse the value string so that the original value can be restored with

      "".join(self.get(key)
      

      this means:

      • keep all whitespace between tokens
      • keep quotes around quoted strings
      • do zero evaluation in the parser stage (dont decode backslashes)
      • in class Scope, the method get will remove whitespace tokens, decode backslash-escapes, unpack quoted strings

      i started working on this ...
      will push commits to my fork at https://github.com/milahu/qmake2cmake

       

      Attachments

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

        Activity

          People

            jbornema Joerg Bornemann
            milahu milan hauth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes