Windows dotted paths – DEV Community
January 5, 2025

Windows dotted paths – DEV Community

I accidentally discovered that Windows (or NTFS?) does not allow archive names with trailing dots.

Internally, the dot is the delimiter between the base file name and the file extension. Some tools treat the last point as implicit, so type plain. will display the contents of the file named plain.

With this curiosity, I decided to create a troublesome git repository to find out how would Windows handle such a thing?

  1. Indiscriminate error?
  2. Choose an arbitrary conflicting name?
  3. Privilege escalation?

https://github.com/PeterShinners/doomdots

PS C:\dev> git clone https://github.com/PeterShinners/doomdots.git
Cloning into 'doomdots'...
remote: Enumerating objects: 35, done.
remote: Counting objects: 100% (35/35), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 35 (delta 10), reused 0 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (35/35), 10.41 KiB | 1.16 MiB/s, done.
Resolving deltas: 100% (10/10), done.
error: invalid path 'MIXed.'
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

PS C:\dev> cd .\doomdots\
PS C:\dev> git switch main
error: invalid path 'MIXed.'
error: invalid path 'enddot.'
error: invalid path 'extdot.txt.'
Enter full screen mode

Exit full screen mode

These errors are most likely coming from Git itself, and there is an alternative to fallback to some undefined system behavior.

At any rate, avoid edge cases as well as mixed-case naming conflicts and invalid characters.

2025-01-05 01:19:32

Leave a Reply

Your email address will not be published. Required fields are marked *