microsoft / microsoft/WSL

Creating files with reserved Windows file names creates issues within Windows

Open
#2,689 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

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

  • What you're doing and what's happening:
    echo "foobar" > con.out

This creates the file con.out in the current directory. It is totally usable from bash.

But from DOS, you cannot look at the file, rename the file, or do anything with it, because "CON" is a reserved file name. You cannot even rename the file from Windows Explorer.

  • What's wrong / what should be happening instead:
    Maybe a warning should be issued if from Linux, you are creating a file that has a name that is invalid for Windows. Or it should not be possible to create files with the reserved names.

Apparently, these are the reserved file names:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9 (see https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce echo "foobar" > con.out on the reported Windows build and inspect how WSL handles file creation and Windows-reserved names. The issue does not name files or tests, and its proposed outcomes differ; completion would require an agreed policy that either warns about or prevents names such as CON, PRN, and AUX.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.