SchoofsKelvin / vscode-sshfs

Extension for Visual Studio Code: File system provider using SSH
GNU General Public License v3.0
543 stars 36 forks source link

Writing to a read-only file succeeds falsely #282

Closed CCing17 closed 2 years ago

CCing17 commented 2 years ago

When writing to a read-only file and save, the save action "succeeds" (while the remote file is actually not updated) without any pop-up message, which was there previously.

Output log has (exact file path obfuscated):

[DEBUG]   Writing 85652 bytes to ssh://vm/home/[...]
[ERROR]   Error handling uri: ssh://vm/home/[...]
[ERROR]   Permission denied
JSON: {"code":3,"lang":""}
Error: Permission denied
    at k._transform (/Users/[...]/.vscode/extensions/kelvin.vscode-sshfs-1.21.2/dist/262.extension.js:1:82627)
    at k.Transform._read (internal/streams/transform.js:205:10)
    at k._read (/Users/[...]/.vscode/extensions/kelvin.vscode-sshfs-1.21.2/dist/262.extension.js:1:78632)
    at k.Transform._write (internal/streams/transform.js:193:12)
Logged at:
    at z.<anonymous> (/Users/[...]/.vscode/extensions/kelvin.vscode-sshfs-1.21.2/dist/398.extension.js:1:2827)
[DEBUG]   Error converted to: NoPermissions (FileSystemError): ssh://vm/home/[...]

It used be the case that the save action would not succeed and a pop-up message would show up about the permission issue.

SchoofsKelvin commented 2 years ago

Since when did this start happening? Your error log shows the extension is still throwing the correct order, so my first guess is that VS Code changes something in an update.

CCing17 commented 2 years ago

It has been like this for a while (a few months?). I can try to revert back to a previous version of VS Code to find out the exact update that breaks this. But is this going to be a VS Code issue, or can the extension still do something about it?

SchoofsKelvin commented 2 years ago

It sounds to me like it's something that VS Code changed.

Worst case, if they did indeed remove that feature, I can add it myself, since extensions can also create notifications.

CCing17 commented 2 years ago

It seems this started to not work in April's release (version 1.56). The March release was still functioning properly.

SchoofsKelvin commented 2 years ago

I did notice some code changes in VS Code going from 1.55.2 to 1.56.0, although that was just after taking a very quick glance at over thousands of file changes. I'll see if I can pinpoint the exact cause and report it to VS Code. Otherwise I'll add a config flag to make the extension explicitly notify the user when write operations fail for some reason.

Software-Noob commented 2 years ago

I can confirm this issue persists on 1.61.0

SchoofsKelvin commented 2 years ago

I'll look into this again, seeing if this is an issue reported on the VS Code repository. Otherwise I'll (add an option to) make it show a notification when writing to a file fails instead of letting (only) VS Code handle the error reporting.

MrMuzzio commented 2 years ago

I can confirm it's still an issue on version 1.63.2. If you don't have permission to write on the file, you will lose your work without noticing it (like me 😢)

SchoofsKelvin commented 2 years ago

Fixed in cac0ec2, which'll be in the next version (1.24.2 or later) of the extension.

The extension now by default shows an error notification (a non-modal one in the bottom right) whenever a file system operation fails, with the exception of NotFound errors for ignored paths. The extension has a few NotFound ignored paths hardcoded, such as .vscode/settings.json, since VS Code (or extensions) always try to read them.

_The feature is actually hidden behind the FS_NOTIFY_ERRORS flag (see #270), but is auto-enabled for VS Code 1.56.0+._