Repository navigation
Closed
Labels
Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.tasks/build/debugAn issue relating to tasks.json (e.g. build issues)An issue relating to tasks.json (e.g. build issues)
Milestone
Description
Environment
- OS and Version: Windows 11 with WSL 2 running Ubuntu 20.04.4
- VS Code Version: 1.81.1
- C/C++ Extension Version: 1.17.5
- If using SSH remote, specify OS of remote machine: N/A
Bug Summary and Steps to Reproduce
Bug Summary:
If the source path contains punctuation, the extension's build command ignores the punctuation in that path. Since the entered file path doesn't exist a 'No such file or directory' error is thrown.
Steps to reproduce:
- Create a new directory
Sept'23(Notice the'). - Create a new
.cppfile inside this directory (helloworld.cpp) - Try to trigger the build using the 'Run' button on the top-right corner of VSCode's nav bar.
The build will fail and you should see a 'No such file or directory' error in the terminal.
Expected behavior:
The build command uses the source path /path/to/Sept23/helloworld.cpp instead of /path/to/Sept'23/helloworld.cpp due to which it fails. The punctuation should have been taken into account.
Configuration and Logs
{
"configurations": [
{
"name": "Linux",
"includePath": ["${workspaceFolder}/**"],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}Other Extensions
No response
Additional context
Here is part of the terminal output:
Starting build...
/usr/bin/g++ -fdiagnostics-color=always -g /mnt/d/Shashwat/Fall'23/main.cpp -o /mnt/d/Shashwat/Fall'23/main
g++: error: /mnt/d/Shashwat/Fall'23/main.cpp -o /mnt/d/Shashwat/Fall'23/main: No such file or directory
g++: fatal error: no input files
compilation terminated.
Build finished with error(s).
* The terminal process failed to launch (exit code: -1).
* Terminal will be reused by tasks, press any key to close it.
Metadata
Metadata
Assignees
Labels
Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.tasks/build/debugAn issue relating to tasks.json (e.g. build issues)An issue relating to tasks.json (e.g. build issues)
Activity
Colengms commentedon Sep 11, 2023
Hi Shashwat Rathod (@shashwatrathod) . Thanks for reporting this. It looks like this path is not properly escaped to account for shell command-line special characters before being used in a shell command line.
sean-mcmanus commentedon Jan 22, 2024
Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.19.2
Colengms commentedon Feb 28, 2024
Hi Shashwat Rathod (@shashwatrathod) . With 1.19.5, we're aligning the behavior of
argsandcommandfields intasks.jsonwith the behavior of VS Code'sshelltask type, which is documented here. When upgrading to 1.19.5, I believe you'll need to modify the generatedtasks.jsonto provide an explicitquotingbehavior, as described in that documentation.Aligning this behavior with VS Code's default task type should provide a consistent user experience, and allow us to drive any shortcoming of that approach as issues with VS Code itself, and not behavior specific to the extension. If the new behavior turns out to be problematic for you, I'd suggest following up with an issue in the VS Code repo.