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

Command line arguments wrong when quotes used in command path

    XMLWordPrintable

Details

    • Windows

    Description

      When quotes are used in paths arguments gets lost in certain cases, reproduced with 5.12.

       

      From a customer:

       

      "I think there's a bug in QCoreApplication::arguments() when dealing with quoted paths to the exe in Windows.

       

      The attached exe prints the contents of QCoreApplication::arguments(). The output is as follows for various invocations of the program. As you can see, sometimes it splits the application path wrongly, and drops the last argument. Note: all these quotings of the application path are valid in Windows, and are executing the application.

       

      D:\stuff\qtcmd>x64\Release\qtcmd.exe hello world

      arg=x64\Release\qtcmd.exe

      arg=hello

      arg=world

       

      D:\stuff\qtcmd>"x64\Release\"qtcmd.exe hello world

      arg=x64\Release\

      arg=qtcmd.exe

      arg=hello

       

      D:\stuff\qtcmd>"x64\Release"\qtcmd.exe hello world

      arg=x64\Release

      arg=\qtcmd.exe

      arg=hello

       

      D:\stuff\qtcmd>"x64\Release\qtcmd.exe" hello world

      arg=x64\Release\qtcmd.exe

      arg=hello

      arg=world"

      Attachments

        1. main.cpp
          0.3 kB
          Tero Siironen
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            izero Tero Siironen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes