Skip to content
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

Create File overwrites existing files without warning #33899

Closed
Obbi89 opened this issue Sep 6, 2017 · 6 comments
Closed

Create File overwrites existing files without warning #33899

Obbi89 opened this issue Sep 6, 2017 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues file-watcher File watcher linux Issues with VS Code on Linux verified Verification succeeded

Comments

@Obbi89
Copy link

Obbi89 commented Sep 6, 2017

  • VSCode Version: Code - Insiders 1.17.0-insider (be71eec, 2017-09-06T05:15:43.568Z)
  • OS Version: Linux x64 4.4.0-93-generic
  • Extensions:
Extension Author (truncated) Version
vscode-markdownlint Dav 0.10.0
xml Dot 1.9.2
vscode-docker Pet 0.0.16
django-html bib 1.2.0
django-snippets bib 1.1.0
path-intellisense chr 1.4.2
gitignore cod 0.5.0
vscode-eslint dba 1.2.11
githistory don 0.2.3
jupyter don 1.1.3
python don 0.7.0
python-extension-pack don 1.0.0
MagicPython mag 1.0.12
cpptools ms- 0.12.3
csharp ms- 1.12.1
vscode-icons rob 7.12.0
perltidy sfo 1.2.1
vim vsc 0.10.0
gitblame wad 2.1.0
jinja who 0.0.8

(2 theme extensions excluded)


Steps to Reproduce:

  1. create a file externally for example use the integrated terminal and do "wget https://wowsocool.domain.tld/supersecretpath/veryimportant.file.ext"
  2. see that the file browser does not recognize the new file that was created.
  3. click on create file and enter the filename of the existing file
  4. ????
  5. Profit! Your file has been truncated.

Reproduces without extensions: No

This is weird. It seems that one of the extensions is preventing the folder to be re-scanned and updated.
But even though it is a bug that the file gets truncated if it already exists. Even if it would correctly update it would still be racy and that is bad. I guess this bug is rather low prio but it should be relative easy to fix tbh.

@vscodebot vscodebot bot added the insiders label Sep 6, 2017
@roblourens
Copy link
Member

see that the file browser does not recognize the new file that was created.

This should work. Does it never see the new file? Even if you use vim or echo 'foo' > file.txt?

@Obbi89
Copy link
Author

Obbi89 commented Sep 7, 2017

This set of extensions I have seems to cause this.
Maybe it causes the open-files / file handle limit to be reached for watching folders or w/e

But even though. A file should never be overwritten by a create-file dialogue.

@Tyriar
Copy link
Member

Tyriar commented Sep 7, 2017

Maybe it causes the open-files / file handle limit to be reached for watching folders or w/e

Have you boosted the file watch limit? https://code.visualstudio.com/docs/setup/linux#_error-enospc

@Tyriar Tyriar added info-needed Issue requires more information from poster linux Issues with VS Code on Linux labels Sep 8, 2017
@Obbi89
Copy link
Author

Obbi89 commented Sep 12, 2017

Well I could, but why should I and it still is unrelated to the issue. It should be impossible to overwrite an existing file. And moving this into a different layer and blocking the function from being called is not the right solution tbh.

It will stay racy and it's bad design.

@Tyriar Tyriar added file-watcher File watcher file-explorer Explorer widget issues labels Sep 14, 2017
@Tyriar
Copy link
Member

Tyriar commented Sep 14, 2017

@bpasero do we do a file check before creating a few or do we rely on the file watcher giving us an accurate tree?

@bpasero
Copy link
Member

bpasero commented Sep 15, 2017

createFile is just creating the file which is not good, we should check if the file exists and maybe provide an option to override the file if it exists.

@bpasero bpasero added this to the September 2017 milestone Sep 15, 2017
@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Sep 15, 2017
@roblourens roblourens added the verified Verification succeeded label Sep 28, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues file-watcher File watcher linux Issues with VS Code on Linux verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants