Error that persisted in Windows since 1974

Original author: Foone Turing
  • Transfer
It is now the year 2018, and this message is a mistake that has persisted since 1974 The restriction, which is found even in the latest Windows 10, has appeared before "STAR WARS". The bug is as old as Watergate.

In those days, barcodes were only invented, only one telephone company worked in America, Ted Bundy was still running free, and Babe Ruth's home-run record was in recent days.

When this bug appeared, the Wheel of Fortune was not shown on TV yet (Russian equivalent: Field of Miracles, 1990 - approx. Lane). No one saw the Rocky Horror Horror Show, and Steven Spielberg shot several television films and one full-screen film that failed in film distribution (but the film “Duel” received several film awards - approx. Lane). According to NBC, they did not show “Saturday Night Live”, and “Edmund Fitzgerald” was still carrying iron ore (a giant cargo ship with a crew sank on November 9, 1975 - approx. Lane).


So why did this happen? At that time, for five years, Unix came out with a good idea, “everything is a file”, which opened the door to many possibilities: writing to sockets, a pipeline, a console, etc. with the same commands and instructions.

The idea was implemented by Gary Kildall at CP / M in 1974. It allows cool things, such as copying data from a serial port to a text file or printing a text file directly from the command line!

In Unix, this is done through special files that exist in special folders, like / dev / tty for the console or / dev / lp0 for the first printer. You can get an endless stream of zeros from / dev / zero, random bytes from / dev / random, etc.!

But here's the problem: CP / M is designed for 8-bit computers with a small amount of memory and without hard drives. At best, you have an 8-inch floppy drive. What directories? You will not need them. Just use different disks.

But without directories, you cannot put your files in the / dev / directory. That is, they are just everywhere. So if you need to print the file foo.txt, enter a command PIP LST:=FOO.TXTthat copies foo.txt to the “file” LST, which is a printer. And it works everywhere, because there are no directories! It's simple.

But what about extensions? Here's the problem: programs like to add their extensions to files. Therefore, if the program says “Enter the file name to save the listing”, it is possible to specify LST for printing or PTP for embossing on punched tape (because this is 1974, remember?). But the program may try to put .TXT at the end of the file name! LST.TXT - this is not a printer, right?

Nope Hack still works. Special devices are broadcast to all extensions, so CON is reserved for the keyboard even in the case of CON.TXT or CON.WAT, or CON.BUG.

Yeah. This is a real hack, but only some small microcomputers with 4KB of RAM need it, who cares?

The CP / M operating system became widespread in the late 70s and early 80s. It was one of the main operating systems for business. She defined the standard interface, so you could write the CP / M code on NorthStar Horizon - and run it on Seequa Chameleon.

The lack of a universal graphic standard made it impossible to write many games for it (although there are releases of Infocom), so the standard was used mainly in the business environment.

But the market was big: naturally, IBM wanted to cover it for a new project called “PC”, which they did in the early 1980s.

IBM intended to launch an IBM PC with several operating systems and expected that CP / M would become “mainstream”. But CP / M for x86 appeared only 6 months after the launch of the IBM PC ... and cost $ 240 versus $ 40 for DOS.

Thus, the vast majority of users eventually bought Microsoft PC-DOS, a new version of the operating system originally developed by Seattle Computer Products. MS bought a Tim Paterson project and developed it in PC-DOS (which would later be renamed MS-DOS if you are not aware of it).

Tim Paterson’s system was called QDOS (Quick and Dirty Operating System, “Quick and Dirty Operating System”). It was written quickly, because CP / M has not yet come out under x86, and QDOS was trying to overcome some of the limitations of CP / M. This system definitely copied CP / M in many ways.

Among others, the concept of special files and the lack of directories was borrowed because it was a useful feature of CP / M. Thus, in QDOS and PC-DOS 1.0 there is also AUX, PRN, CON, LPT, etc.!

For PC-DOS 2.0, released in 1983 for the new IBM XT, Microsoft has significantly updated PC-DOS. IBM XT had a hard disk, so directory support was added to PC-DOS. After all, you need to clean up a bunch of files on a huge 10 MB hard drive, obviously!

But here's the problem: users have already used these special files since PC DOS 1.0 was released two years earlier. Written software with their support! Production has gone batch files.

With the advent of directories, Microsoft could now make the C: \ DEV folder ... but did not.

Not for the last time, Microsoft sacrificed common sense for backward compatibility. Special files can now be in ANY CATALOG and WITH ANY EXTENSION. So your teamDIR > LPTfor printing listing files will continue to work in C: \ DOS, as it worked in A: \.

Of course, we do not run DOS 2.0 ... But Windows 95 was built on top of DOS. Naturally, she inherited this behavior (like Windows 1/2/3 earlier). Windows 95 is no more! The current Windows branch is based on Windows NT, not Win95.

However, Windows NT sought to maintain compatibility with DOS / Windows programs, so XP combined the two branches. So these special files still work, LATER FORTY FOUR FUCKY YEARS.

You can try it yourself! Open Explorer, create a new text file and name it con.txt, aux.txt or prn.txt.

Sorry, friend ...

Gary Kildall borrowed a great idea from Unix and adapted it for microcomputers with 4 KB of memory without directories - it happened so long ago that children born then could have their own children who have the right to buy alcohol, but we still have no right to name con.txt file

Microsoft gives a complete list of prohibited names: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, ​​COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9 .

For even more buzz, an attempt to access C: \ con \ con (or C: \ aux \ aux) on win95 will instantly show a blue screen. It was fun even in 1995, because the bug is 21 years old! Imagine that some kind of error persists for so long?

Bonus: here is a photo of Tim Paterson on VCF: W in August of this year, he tells about the history of DOS.

If you are wondering how I got a “forbidden” file that cannot be copied, then I will say. These special device names are implemented at the OS level, not at the file system level. Thus, these are perfectly valid NTFS file names, and I used an NTFS disk under Linux.

It seems that OS / 2 also did not implement these special names, because one of the disks from IBM has AUX.H files in the OpenGL bundle.


A few notes:

1. CP / M didn't really use these special names as easily as I described. It seems that I either did not know, or forgot about this fact. In fact, they should be followed by a colon, like disk names, that is, PRN: - this is a printer, PRN - no.

2. CP / M did not implement them at the OS level, as in DOS! They were simply included in the PIP, file copy command. Therefore, the DOS saving trick to the PRN.TXT file with automatic printing did not work there. I did not mean that CP / M did this, but only DOS, but apparently it was not clearly expressed.

3. In PC DOS 1.0, in fact, there were no redirects or a pipeline, so you cannot make such a redirect as I suggested. I forgot about it. They were added to PC DOS 2.0 in 1983. Although PC DOS 1.0 supported copying to / from special files, therefore the general thesis is correct, even if the example is unsuccessful.

In any case, thanks for the feedback on this article! I didn’t expect it to explode like that, I just sprinkled a couple of paragraphs when I came home very tired and saw an error message because of a 44-year-old bug.

And if that, I was not going to shout "Windows SUCKS". Backward compatibility is generally a good thing. In fact, I would like more backward compatibility, not less.

But I was just struck by this bug from antiquity, which popped up while copying from USB 3.0 SSD to another SSD in Windows 10.

It’s like living on a space station - and then a horse appears.
tl; dr:

Also popular now: