You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
History may use reserved filenames on windows #177138
Does this issue occur when all extensions are disabled?: Yes
VS Code Version: 1.76.1
OS Version: Windows 10
Steps to Reproduce:
Can't really provide some simple instructions to reproduce because random values generated by vscode during runtime are the actual issue.
After regular use I ended up with a file named "LPt4" in AppData\Roaming\Code\User\History. The filename is a reserved filename on windows like CON, COM1, LPT1 etc. The file can't be deleted by the user using windows explorer or accessed by normal tools which broke my backup software. Solution is to use del command in cmd.exe and provide a complete UNC path to delete the file.
Source of bug probably is in vscode/src/vs/workbench/services/workingCopy/common/workingCopyHistoryService.ts doAddEntry()
const id = `${randomPath(undefined, undefined, 4)}${extname(workingCopyResource)}`;
The file generated has a random 4 character prefix which by accident can be a reserved filename. I propose to just extend the length of the history filename so it is impossible to be a reserved filename on windows.
At least this.historyEntriesNameMatcher = new RegExp(`[A-Za-z0-9]{4}${escapeRegExpCharacters(extname(workingCopyResource))}`);
would also need to be changed.
Activity
bpasero commentedon Mar 15, 2023
Good catch, I think we need a random file path generator that also calls into this validator:
vscode/src/vs/base/common/extpath.ts
Line 169 in 4b8edee
I wonder if we have other places where this can happen. We should probably check.
History may use reserved filenames on windows (fix #177138)