Thursday, 27 August 2015

Reserved Filenames on Windows

So today I was working on a full Atlassian product suite, you know Stash, Bamboo, JIRA. And we had a well known code base (the Linux kernel itself) that will compile on our Linux build agent.

However one of the development platforms is Window 7 (yes Windows 7 doesn't develop the Linux kernel but this is a test of the product suite and not windows 7 ability to compile the Linux kernel). So I'm cloning the Linux Kernel from Stash to Window 7 and it fails half way through and I'm thinking "Oh no stash and git must be configured incorrectly."

Once inspecting the git errors however it was complaining of

fatal: git rm: 'drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c': Permission denied

Obviously this had me trying again and then trying to create a file called aux.c on the desktop.

Queue a most random error from a file creation I have seen

The error was "specific device name is invalid" when creating the file aux.c on the desktop. Now as you can tell this got my interest and so off to google and windows and aux.c.

This lead me to an interesting little knowledge base article

where it details that some filenames are reserved for certain things.

  Name    Function
   ----    --------
   CON     Keyboard and display
   PRN     System list device, usually a parallel port
   AUX     Auxiliary device, usually a serial port
   CLOCK$  System real-time clock
   NUL     Bit-bucket device
   A:-Z:   Drive letters
   COM1    First serial communications port
   LPT1    First parallel printer port
   LPT2    Second parallel printer port
   LPT3    Third parallel printer port
   COM2    Second serial communications port
   COM3    Third serial communications port
   COM4    Fourth serial communications port

Has anyone ever come across this before, it such an oddity of Windows to do this.....