-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Do not reset WSL permissions metadata on save #49021
Comments
I also just upgraded to 18.03 and am noticing the same behavior. Files get reset back to 755 as soon as you save them with VSCode (running in Windows). I'm seeing that other editors are avoiding this problem by turning off safe writes. I don't personally use phpStorm but I did read about that here https://github.com/andrewmackrodt/docker-sync-wsl-native#use-wsl-as-the-default-terminal-in-phpstorm. |
Unfortunately PhpStorm non-safe writes lose linux metadata for NTFS files (but not those mounted via SSH which v1 of that project was using). From previously looking at this problem I believe it's a node.js issue. #28927 (comment); more specifically I think it related to nodejs/node#18549. WSL does not use ADS IIRC, I'm not sure how it stores its metadata. |
This is applicable for anything done in VSCode, not just nodejs just as mentioned in the OP. They need to do work on their end but what about everything else? I don't think we can or should expect package maintainers to update for this behavior since it's a Windows specific issue. IDEs need to be able to handle the behavior, which from your guys point of view is a feature request, but a necessary one in order to maintain security of our data. |
@DarthSpock VSCode is written in Node.js/Electron. It utilizes Node.js methods for file operations. |
And the referenced issue in nodejs was closed when trying to address this saying "use this workaround". I pinged them about it to see what they say about it. But if it gets a "won't fix", then the team here will need to fork off from them and implement it themselves. Thank you for the enlightment though. |
This might help: #42899 |
I just couldn't wait and compiled VScode myself with PR #42899 and indeed it fixes this issue and unix permission are conserved when CTRL+S a file on DrvFs. |
Problem is something with AppVeyor is blocking the merge and none of the MS devs appear to be troubleshooting the issue. For now the only workaround that preserves Linux permissions when working in WSL is to use the native Linux VS Code and doing so means suffering performance drops. Until the perf issues are resolved in WSL, Windows VS Code is the best route so this issue should be shown some serious attention over other new features since this is fundamental to workflow. |
Lots of text files keep getting their "execute" bit set because of editing on Windows? I think the underlying problem is as described here: microsoft/vscode#49021 For @Checkmate50, can you please set this git configuration option? https://stackoverflow.com/a/1580644
I'm also using WSL and I start VS Code (Windows) from Bash by simply typing SOLVED (20/8/2018): |
#42899 is merged which claims to fix this. Alternate data streams will no longer be removed when saving a file. (I still think it is not advised to save files from Windows that are owned by WSL though, so do this at your own risk) |
These aren't necessarily files owned by WSL. They are files that happen to be mounted into WSL. Insiders 1.27 as of commit 6e559 (August 20th 2018's build) still resets files back to 755 on edit btw, not sure if that PR has made it into an insiders release yet. |
@nickjj can you verify with today's insider build |
@bpasero Seems to be working great now. Here's what I did to test it:
For clarity, all of the 6 steps are ran from inside of a ConEmu driven WSL Ubuntu terminal. |
@nickjj how does that setup work exactly? How is |
@nickjj You should put the details into hi.txt
…On Tue, Aug 21, 2018, 5:49 PM Benjamin Pasero ***@***.***> wrote:
@nickjj <https://github.com/nickjj> how does that setup work exactly? How
is hi.txt linked from Windows into Linux? Specifically, how does code
hi.txt turn into an absolute file path for VSCode to open?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#49021 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AVPRpTgWyt_I7a32E3Egt8eXAvBVKgS2ks5uTB31gaJpZM4TunPO>
.
|
@bpasero VSCode is installed directly within Windows (Windows installer) and The terminal I use (ConEmu) preloads |
@nickjj makes sense, thanks |
Setting to verified based on #49021 (comment) |
Can also confirm that the Insiders build retains alternate data streams / WSL permissions! Thank you! |
Great. Also let me know if anyone is seeing weird issues when saving in general, the code change impacts every single save on Windows. |
The April Windows 10 update brings many improvements to WSL. One of them is the possibility to save unix permissions as NTFS file metadata:
https://blogs.msdn.microsoft.com/commandline/2018/01/12/chmod-chown-wsl-improvements/
One of the caveats is: "Editing a file using a Windows editor may remove the file's Linux metadata. In this case, the file will revert to its default permissions"
As of now, VSCode unfortunately does exactly that - when you save the file, the metadata (containing i.e. the execution permission bit) is deleted.
It would be nice to keep the file's metadata on save.
The text was updated successfully, but these errors were encountered: