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

Unix file permissions are corrupted by saving file on Windows #3388

Closed
leo-cydar opened this issue Jul 18, 2018 · 2 comments
Closed

Unix file permissions are corrupted by saving file on Windows #3388

leo-cydar opened this issue Jul 18, 2018 · 2 comments

Comments

@leo-cydar
Copy link

leo-cydar commented Jul 18, 2018

  • Your Windows build number:
    Microsoft Windows [Version 10.0.17134.165]

  • What you're doing and what's happening:
    Writing to an existing file inside the rootfs folder on Windows using any editor causes, upon reboot, the file to have permissions ---------- inside bash.

  • What's wrong / what should be happening instead:
    Saving ontop of an existing file in Windows should honor existing unix permissions, or at least set to the default (u=rw,go=rw), rather than corrupting the record.
    Running chmod u=rw,go=rw repro.txt fixes the issue, but only until a subsequent write by Windows + reboot.

  • Repro:

(bash) $ touch ~/repro.txt
(bash) $ ls -l ~/repro.txt
  -rw-rw-rw- 1 leo leo 0 Jul 18 10:38 repro.txt
(windows) open file in notepad, save some contents.
(reboot)
(bash) $ ls -l ~/repro.txt
  ---------- 1 leo leo   20 Jul 18 10:27 repro.txt
(bash) $ cat repro.txt
  cat: repro.txt: Permission denied 
(bash) $ stat ~/repro.txt
  File: 'repro.txt'
Size: 20              Blocks: 0          IO Block: 4096   regular file
Device: 2h/2d   Inode: 3096224744134491  Links: 1
Access: (0000/----------)  Uid: ( 1000/     leo)   Gid: ( 1000/     leo)
Access: 2018-07-18 10:38:28.281263500 +0100
Modify: 2018-07-18 10:44:06.896765900 +0100
Change: 2018-07-18 10:44:06.896765900 +0100
Birth: -

Note that

  • This seems to happen independently of where in the subsystem the file is located
  • This seems to happen independently of which editor is used on Windows to save the file
  • This does not occur if the file is merely opened and not saved in Windows; it is the save action that seems to cause this bug.
  • It is just as reproducable with all antivirus controls disabled
@WSLUser
Copy link

WSLUser commented Jul 18, 2018

Long answer: Modifying Linux files using Windows tools is still not supported. Biggest reason being that the vendors need to modify their apps to accept the metadata feature Windows offers in builds 17134+. VSCode has a PR stuck that would fix the issue if that helps. Forget issue number on their repo but you can find it easily enough filtering with "WSL" as the search criteria. Basically alternate streams need to be supported in order for a tool on Windows to support Linux file metadata.

Short answer: There's no WSL actionable here. You can preserve Linux permissions on Windows directories using the metadata option and use wsl.conf to make it permanent. Same goes with case sensitivity if you wanted that as well.

@benhillis
Copy link
Member

benhillis commented Jul 18, 2018

Thanks for opening the issue, marking this as a duplicate of #1524.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants