]> git.ipfire.org Git - thirdparty/git.git/commit
mingw: do not treat `COM0` as a reserved file name
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 8 Apr 2020 18:06:49 +0000 (18:06 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Apr 2020 19:15:51 +0000 (12:15 -0700)
commitb6852e19794245566f7c961a434c56ca3b7a883b
tree53b9c597b2f5dacffd158b349033c15f026641b9
parenta748f3f3dc0adff1d8a83dfc098ed819658998d0
mingw: do not treat `COM0` as a reserved file name

In 4dc42c6c186 (mingw: refuse paths containing reserved names,
2019-12-21), we started disallowing file names that are reserved, e.g.
`NUL`, `CONOUT$`, etc.

This included `COM<n>` where `<n>` is a digit. Unfortunately, this
includes `COM0` but only `COM1`, ..., `COM9` are reserved, according to
the official documentation, `COM0` is mentioned in the "NT Namespaces"
section but it is explicitly _omitted_ from the list of reserved names:
https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions

Tests corroborate this: it is totally possible to write a file called
`com0.c` on Windows 10, but not `com1.c`.

So let's tighten the code to disallow only the reserved `COM<n>` file
names, but to allow `COM0` again.

This fixes https://github.com/git-for-windows/git/issues/2470.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.c
t/t0060-path-utils.sh