vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Version 1.9.4 (pre-release) C++ extension automatically creates garbled files in the workspace

Open j1angle0 opened this issue 4 years ago • 32 comments

Bug type: Language Service

Describe the bug

  • OS and Version: Win11
  • VS Code Version: 1.65.2
  • C/C++ Extension Version: 1.9.4(pre-release)
  • Other extensions you installed (and if the issue persists after disabling them):
  • If using SSH remote, specify OS of remote machine: Cent0S 7
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc). I updated to version 1.9.4 (pre-release), C/C++ automatically creates garbled files in the workspace,please check it, thanks Uploading 20220317-163832.png…

j1angle0 avatar Mar 17 '22 08:03 j1angle0

This issue is also tracked on the vscode issue tracker -> https://github.com/microsoft/vscode/issues/145297

I am not 100% sure this issue is due to the cpptools extension. I had all extensions disabled and the issue still persisted. It does seem to be limiting itself to C/C++ workspaces.

daantimmer avatar Mar 17 '22 10:03 daantimmer

Same issue. Also some source files becomes empty.

Chuvi-w avatar Mar 17 '22 12:03 Chuvi-w

Confirmed on Linux in pre-release version. Lots of empty files with random filenames. It seems to trigger when there are updates to the files in the project folder. I can trigger the issue when this pre-release plugin is enabled. Problem goes away if I switch to the release version

sbovbjerg avatar Mar 17 '22 12:03 sbovbjerg

Same issue.

howardlau1999 avatar Mar 17 '22 12:03 howardlau1999

Confirmed on Linux in pre-release version. Lots of empty files with random filenames. It seems to trigger when there are updates to the files in the project folder. I can trigger the issue when this pre-release plugin is enabled. Problem goes away if I switch to the release version

Can confirm too. When I went back to 1.8.4, I didn't see anymore garbled files but once I switched back to the pre-release version vs code immediately spat out 300+ random files.

Screenshot_20220317_205633

RenoirTan avatar Mar 17 '22 13:03 RenoirTan

same issue... it deletes the content of random files!!!! it stopped when I reverted to v1.8.4

burlizzi avatar Mar 17 '22 13:03 burlizzi

Same issue. use a simple C project.

  1. open it with vscode
  2. exit vscode
  3. rename the directory
  4. reopen it with vscode

then, one or many emtry file will create ,and some other file will be emtry.

QQ图片20220317222544

wendal avatar Mar 17 '22 14:03 wendal

Same issue.

image

HyHy100 avatar Mar 17 '22 14:03 HyHy100

Same issue. Also some source files becomes empty.

This problem also nuked entire files of my Boost installation. Since it is installed through the mamba package manager I got warnings that the files in my include folder has incorrect size (0kb).

Other projects I was working on are now full of garbled files and fail to compile. This kind of side effect really really shouldn't happen.

Update: this bug also deletes parts of the Python headers, so a reinstall of the affected Python environment is required.

ManifoldFR avatar Mar 17 '22 15:03 ManifoldFR

Same issue. Also some source files becomes empty.

This problem also nuked entire files of my Boost installation. Since it is installed through the mamba package manager I got warnings that the files in my include folder has incorrect size (0kb).

Other projects I was working on are now full of garbled files and fail to compile. This kind of side effect really really shouldn't happen.

Update: this bug also deletes parts of the Python headers, so a reinstall of the affected Python environment is required.

I'm using root in docker for development. It seems any referenced headers with proper permission may be nuked. In my case, several linux headers are nuked and almost nothing compiles any more. If someone uses root on physical machine, they might have a very bad day fixing everything.

kblackcn avatar Mar 17 '22 17:03 kblackcn

Yeah, hugely sorry about this -- we have not yet been able to repro this issue locally and haven't identified the cause yet. Does anyone know if there's any pre-condition required for this to repro? Are there any special characters or spaces in the paths?

Downgrading to 1.9.3 or 1.8.4 is recommended.

Can someone on Windows x64 try https://github.com/microsoft/vscode-cpptools/releases/tag/1.9.4-prerelease1 and let us know if the bug repros with that or not? That vsix is identical to 1.9.4 except for one change to cpptools and 3 updated DLL dependencies (and those DLLs were Windows-only show they couldn't cause the Linux issues).

sean-mcmanus avatar Mar 17 '22 17:03 sean-mcmanus

What location are these file alterations occurring in? Are they isolated to the workspace or do they occur in any system includes? Does it repro with C_Cpp.intelliSenseEngine set to "Tag Parser"? Does it repro with the C_Cpp.loggingLevel set to "none" or when no tag parsing is occurring?

sean-mcmanus avatar Mar 17 '22 17:03 sean-mcmanus

Yeah, hugely sorry about this -- we have not yet been able to repro this issue locally and haven't identified the cause yet. Does anyone know if there's any pre-condition required for this to repro? Are there any special characters or spaces in the paths?

Downgrading to 1.9.3 or 1.8.4 is recommended.

Can someone on Windows x64 try https://github.com/microsoft/vscode-cpptools/releases/tag/1.9.4-prerelease1 and let us know if the bug repros with that or not? That vsix is identical to 1.9.4 except for one change to cpptools server and 3 updated DLL dependencies (and those DLLs were Windows-only show they couldn't cause the Linux issues).

I tried to reproduce this bug from scratch and found that a large project might help reproduction a lot. I tried with a single hello world and there is no problem, but once I extract nginx.tgz, the problem shows up (since vscode is actively monitoring the opened folder, then called the extension).

Also, since the written file looks like pieces of memory a lot, emptied file might just be the special case when that piece of memory happened to be the path of an included file in memory. So that is very likely not a separate problem.

One of my colleague uses linux (without remote) only and I tried windows sshing linux and linux sshing linux. These combinations are all done for. So it is definitely not a Windows problem.

kblackcn avatar Mar 17 '22 17:03 kblackcn

I had Windows SDK kit headers nuked.

All my development paths start at C:/git/ do nothing special there.

The issue presented itself every time a folder was opened with vscode. Most likely while parsing included files. When opening files they would often flicker, as if the contents were refreshed multiple times. Sometimes this would leave me with an empty file.

daantimmer avatar Mar 17 '22 17:03 daantimmer

To add, the files that are randomly created appear to be coming from a running process memory dumps. Some names are short, some are very long with strings that normally appear in an executable file. Without trying to give false pointers, but it sounds somewhere like a pointer had gone rogue, stack corruption or out of bounds issues

daantimmer avatar Mar 17 '22 17:03 daantimmer

We're in the process of building a 1.9.5 vsix to revert the changes until we can identify the cause (so users don't have to manually downgrade to 1.9.3).

sean-mcmanus avatar Mar 17 '22 18:03 sean-mcmanus

Same issue. use a simple C project.

  1. open it with vscode
  2. exit vscode
  3. rename the directory
  4. reopen it with vscode

then, one or many emtry file will create ,and some other file will be emtry.

@wendal Could you share this simple repository that we can reproduce this locally? And by "rename the directory", is this rename the project path or folder?

Update: I tried with https://github.com/openLuat/LuatOS and couldn't get the issue to reproduce. Are there any custom settings done to the project folder?

michelleangela avatar Mar 17 '22 19:03 michelleangela

1.9.5 is released -- which reverts to the 1.9.3 binaries, which should fix this issue.

We're still investigating an actual fix though...

sean-mcmanus avatar Mar 17 '22 20:03 sean-mcmanus

@michelleangela rename from "D:\github\LuatOS" to "D:\github\LuatOS123" , it will happen. I just try 1.9.5, it seem ok.

wendal avatar Mar 18 '22 00:03 wendal

install vxis from https://github.com/microsoft/vscode-cpptools/releases/tag/1.9.4-prerelease1, it happen again. I uploaded the local directory as 7z. https://wetransfer.com/downloads/38c3b9dea19da30151708d1f6f5165b520220318010110/85d0e01b6ad6888d42c54634b301aba520220318010125/91e497

wendal avatar Mar 18 '22 01:03 wendal