Microsoft wants to make sure developers do not create or modify Linux files using Windows apps, tools, scripts or consoles. According to the company, this can lead to data corruption and damage to Linux environments.
“There is one hard-and-fast rule when it comes to Bash on Windows: DO NOT, under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc.,” warned Rich Turner, senior program manager at Microsoft, in a blog post.
According to him, this is a situation he sees users run into at least two to three times a day. The problem is that Linux and Windows handle metadata differently. If Windows doesn’t understand or can’t find file metadata, it will assume it is corrupt or damaged and overwrite the file contents.
“Also, several Windows tools implement different strategies to handle file updating and don’t actually edit files in-place,” wrote Turner. “When apps/tools save changes to a file, the original files are often deleted and re-created, or cloned edited and then copied over the original file, etc. During such operations, NT file extended properties are often not persisted and are ‘lost.’ ”
Instead, developers should store files in their Windows filesystem if they want to work on files using both Windows and Linux tools. “When you access files on your Windows filesystem from within Bash, WSL honors the NT filesystem behaviors (e.g. case insensitivity), permissions, etc., so you can easily access the same files using both Windows tools and Bash tools without having to copy files back and forth between filesystems,” Turner wrote.
More information is available here.