8000 Task command line arguments are sometimes being wrapped with single quotes which breaks functionality · Issue #12027 · microsoft/vscode-cpptools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Task command line arguments are sometimes being wrapped with single quotes which breaks functionality #12027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
marcinols opened this issue Feb 27, 2024 · 5 comments
Labels
bug duplicate tasks/build/debug An issue relating to tasks.json (e.g. build issues)

Comments

@marcinols
Copy link
marcinols commented Feb 27, 2024

Environment

  • OS and Version: OracleLinux 8
  • VS Code Version: 1.86.2
  • C/C++ Extension Version: 1.19.4
  • If using SSH remote, specify OS of remote machine:

Bug Summary and Steps to Reproduce

Bug Summary:
Latest update to cpptools, probably a bugfix for issue #11422, breaks command line argument passing to make.

Steps to reproduce:

  1. Create a task that runs make command
  2. Add a parameter: "-j`nproc`"
  3. Run the task and observe that the parameter is now wrapped with single quotes:
    '-j`nproc`'
    which causes make to fail.

Expected behavior:
Older versions used to pass arguments directly, which would cause the shell to run nproc and substitute the right value before launching make.

Configuration and Logs

{
    "env": {
        "compilerName": "gcc-10.2.0",
        "miscellaneous": "(private local Path)",
        "thirdParty": "(private local Path)",
        "vendor": "(private local path)",
        "vendorThirdParty": "(private local path)"
                                                  
    },
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/src",
                (other private include paths)
            ],
            "compilerPath": "${miscellaneous}/${compilerName}/bin/gcc",
            "defines": [
                (private defines)
            ],
            "cStandard": "c17",
            "cppStandard": "c++20",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

Other Extensions

No response

Additional context

No response

@SteuxJMHelha
Copy link
SteuxJMHelha commented Feb 27, 2024

I have the same kind of issue due to the added quotes. It appears suddenly on all computers in my school, breaking all compilation procedures. We now have to manuall specify all files in a folder, which is incompatible and very painful.
Note that an issue was written on VSC but closed because it was detected that the extension causes the problem: tasks.json surrounds argument with single quotes when including asterisk

Here is the tasks.json that is not working anymore:

{
    "version": "2.0.0",
    "tasks": [
         {
            "type": "cppbuild",
            "label": "Compiler les tests",
            "command": "/usr/bin/gcc",
            "args": [
                "-g",
                "${workspaceFolder}/Sources/*.c",
                "${workspaceFolder}/Unity/*.c",
                "${workspaceFolder}/Tests/*.c",
                "-I",
                "/usr/include/mariadb",
                "-I",
                "/usr/include/mariadb/mysql",
                "-o",
                "${workspaceFolder}/Tests/tests",
                "-L",
                "/usr/lib/x86_64-linux-gnu/",
                "-l",
                "mariadb",
                "-l",
                "ncurses"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

@spotter1006
Copy link

I have the same problem

@bobbrow
Copy link
Member
bobbrow commented Feb 27, 2024

The case in the original post may be expected if using "args" to specify "-j nproc". You should use "-j" and "nproc" as separate arguments because each of the args is treated as a single argument and quotes will be added when spaces are detected.

The responses about getting incorrect escaping when using a * is a duplicate of #12001 which we are in the process of fixing. #12026 should address it. We're sorry for the inconvenience. If you need an immediate resolution we recommend rolling back to version 1.18.5 until we publish 1.19.5.

@bobbrow bobbrow closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2024
@bobbrow bobbrow added bug duplicate tasks/build/debug An issue relating to tasks.json (e.g. build issues) labels Feb 27, 2024
@marcinols
Copy link
Author
marcinols commented Feb 27, 2024 via email

@bobbrow
Copy link
Member
bobbrow commented Feb 27, 2024

I see. Looks like Markdown messed up your message. I'll fix it. The existence of backtick in the argument puts that arg in the same category as *, so your issue is a duplicate of #12001 as well.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug duplicate tasks/build/debug An issue relating to tasks.json (e.g. build issues)
Projects
None yet
Development

No branches or pull requests

4 participants
0