microsoft / vscode-test

Testing utility for VS Code extensions
MIT License
242 stars 57 forks source link

Extension installation fails with EPERM on windows when running with vscode-test #258

Open karthiknadig opened 8 months ago

karthiknadig commented 8 months ago
Downloaded VS Code into C:\GIT\formatters\vscode-black-formatter\.vscode-test\vscode-win32-x64-archive-1.85.2
Installing extensions...
Installing extension 'ms-python.python'...
(node:31328) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
[node.js fs] rename failed after 1 retries with error: Error: EPERM: operation not permitted, rename 'c:\GIT\formatters\vscode-black-formatter\.vscode-test\extensions\.70c4e24d-3e6d-4ef9-8311-de75c41021cf' -> 'c:\GIT\formatters\vscode-black-formatter\.vscode-test\extensions\ms-python.python-2023.22.1'
EPERM: operation not permitted, rename 'c:\GIT\formatters\vscode-black-formatter\.vscode-test\extensions\.70c4e24d-3e6d-4ef9-8311-de75c41021cf' -> 'c:\GIT\formatters\vscode-black-formatter\.vscode-test\extensions\ms-python.python-2023.22.1'
Failed Installing Extensions: ms-python.python
Found existing install in C:\GIT\formatters\vscode-black-formatter\.vscode-test\vscode-win32-x64-archive-1.85.2. Skipping download
JustinGrote commented 8 months ago

Seeing something similar, my test archives using vscode-test-cli are not extracting correctly and getting ENOENT because code.exe isn't there.

connor4312 commented 8 months ago

@JustinGrote it sounds like you're hitting an issue that's fixed on the latest version of @vscode/test-electron

JustinGrote commented 8 months ago

@connor4312 you are correct, my dependency in the vscode-test-cli project didn't update. Nice catch. image

sandy081 commented 8 months ago

rename failed after 1 retries with error: Error: EPERM: operation not permitted

Looks like on the system where you are running this, you do not have permissions to do rename. Please fix it and re-run.

karthiknadig commented 8 months ago

@sandy081 in my case I do have permissions and it does work sometimes. Just repeating the same operation again and again it works after few attempts, after that point it start working every time.

sandy081 commented 8 months ago

This message is coming from FileService

CC @bpasero

bpasero commented 8 months ago

fs.rename can fail with EPERM if you try to rename to a folder that already exists on disk:

image

If you are using IFileService, the error will be more specific because we check before-hand if the target exists:

https://github.com/microsoft/vscode/blob/9b2e567ee2a13ff5ccad58897343cef0aebfc1df/src/vs/platform/files/node/diskFileSystemProvider.ts#L756

Here I assume that the file service is not being used, since the error message is coming from pfs:

https://github.com/microsoft/vscode/blob/9b2e567ee2a13ff5ccad58897343cef0aebfc1df/src/vs/base/node/pfs.ts#L496

I would suggest to switch to using file service and set the overwrite option to true:

https://github.com/microsoft/vscode/blob/9b2e567ee2a13ff5ccad58897343cef0aebfc1df/src/vs/platform/files/common/files.ts#L165

sandy081 commented 7 months ago

@karthiknadig Is it possible to run with --verbose flag and provide the trace?

karthiknadig commented 7 months ago

npm-run-smoke-tests.log