Bugs from the crypt

Original author: foone
  • Transfer

Today is 2018, and the error message sends us greetings from 1974. This limitation, which is found in recent versions of Windows 10, goes back to the times when not a single Star Wars episode was lifted . This bug is as old as Watergate . When it was written, there was no UPC barcode on any product , because it was just invented. In those days, there was only one Telephone Company , which was not divided. Ted Bundy was free. Babe Ruta's record on home runs only prepared to fall . The Wheel of Fortune has not yet been shown , and no one has seen The Rocky Horror Horror Show .Steven Spielberg was then a little-known director, "Saturday Night Live" did not come out on the screens. "Edmund Fitzgerald" while carrying iron ore. It was the year of the premiere of the 2 part of the Godfather !

In those days, in Unix, which was only 5 years old , there was a cool idea that “everything is a file”. This means that you can do different things such as writing to sockets, pipes, console, etc., using the same commands and instructions. The concept was moved by Gary Kildall to CP / M in 1974. You could copy data from a serial port to a text file or print a text file directly from the command line! In Unix, this is done using special files located in special directories, such as / dev / tty for the console or / dev / lp0 for the first printer. You can get endless zeros from / dev / zero, random bytes from / dev / random, and so on.

But there is a problem: CP / M is designed for 8-bit computers with very little memory and without hard drives. At best, they had 8 "floppy disks. And directories? You don’t need them. Instead of directories, you just used different disks. But without directories you couldn’t put all your special files in / dev /. Therefore, in fact, they were" everywhere. " That is, if you had FOO.TXT and you needed to print it, you could do PIP LST: = FOO.TXT to copy FOO.TXT to an LST file, which is a printer. And it just worked anywhere, because that the directory did not exist.

What about extensions? Everything is also not easy: programs prefer to add the correct extensions to their files. That is, if you run the program and it says “Enter the name of the file to save the list”, you can enter LST to print it or PTP to write it to tape (because in 1974, remember?). But the program may try to add .TXT at the end of the file! And LST.TXT is no longer a printer, right? As if not so. This is it. Device names are recognized regardless of extensions. That is, if "CON" is assigned to the keyboard, then both CON.TXT and CON.BUG too. Hm This is a hack, but it works. While on any rubbish with 4KB RAM, do not care?

Well, CP / M was widespread in the late 70s - early 80s. It has become one of the main operating systems for business, defining a standard interface. This meant that you could write CP / M code on the NorthStar Horizon and run it on Seequa Chameleon . The lack of a graphical standard for the most part prevented it from entering the gaming market (although there were releases of Infocom), focusing mainly on business users. Still, it was significant, so IBM’s desire to use it in its PC project in the early 80s became natural. Then IBM was going to run an IBM PC with several operating systems, expecting CP / M to be one of the main ones. But CP / M for x86 did not come out six months after the launch of the IBM PC, and it cost $ 240 versus $ 40 for DOS.

As a result, the vast majority of users began to use PC-DOS from Microsoft, which became the evolution of the new OS, developed by Seattle Computer Products . Microsoft bought a project by Tim Paterson and created on its basis PC-DOS, which later became MS-DOS. Tim Paterson's OS was called “QDOS”, which meant "Quick and Dirty Operating System" ("fast and dirty operating system"). It was based on CP / M, which did not have the x86 version, and tried to solve some CP / M limitations. In many ways, these were very similar systems. One of the common features was the idea of ​​using special files and the absence of directories. Therefore, QDOS and PC-DOS 1.0 had all of these AUX, PRN, CON, LPT, etc.

With the release of PC-DOS 2.0 in 1983 for Microsoft's new IBM XT, Microsoft has significantly reworked PC-DOS. Obviously, you just needed the directories to keep in order your huge 10 MB disks that appeared on the market then. And again, bad luck: users have worked with their special files for a couple of years since the release of the previous version of PC DOS 1.0. Programs and scripts were written to use these files. With the support of directories, Microsoft could finally remove everything in C: \ DEV ..., but did not do that. As it will happen more than once, Microsoft has brought common sense to the backward compatibility altar: special files remain in each directory with any extension. This legacy has been carried through all versions up to Windows 95. But wait a minute, we are not using Windows 95 now, After all, the modern branch of operating systems is based on Windows NT. But she also needed compatibility with DOS / Windows programs. Therefore, these special files still work, after forty-four fucking years! Try it yourself: open explorer, create a new text file and name it con.txt. aux.txt or prn.txt. It was not there.

That is, thanks to Gary Kildall, who said, “Special Files Represent Education! Great idea, Unix. I borrow it and try to implement it in my toy operating system "so long ago that people born then may already have children who are allowed to drink alcohol ... we still cannot name the files con.txt. Microsoft even has a special list : CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, ​​COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. To heighten the fun, remember that an attempt to access C: \ con \ con (or C: \ aux \ aux) immediately threw Windows 95 into the BSOD. It was funny in 1995, because then this bug was already 21 years old!

I stumbled upon this when I realized that I had a file that could not be copied. These special file names are implemented at the OS level, and not at the file system level. Thus, they are valid file names in NTFS. And I used NTFS disk in linux. And apparently, OS / 2 does not support this system of special names, as a result of which among the opengl files was AUX.H on one of the disks for Devcon.

And today I tried to backup this NTFS disk on my main computer, and “oops, I can't copy all the files because of a bug older than most people who read it.”

В CP/M работа со специальными именами реализована на самом деле не так просто, как я описал. Например, для обращения к устройству нужно, чтобы в имени было двоеточие: PRN: — это принтер, а PRN — нет. Кроме того, в CP/M работа с файлами устройств реализована не на уровне операционки, как в DOS. Это просто часть команды PIP для копирования файлов. То есть вы не сможете провернуть, как в DOS, трюк с указанием программе сохранить PRN.TXT для того, чтобы напечатать его.

И на всякий случай уточняю: я не имею ввиду ничего вроде «Винда — отстой». Обратная совместимость, как правило, прекрасная вещь. На самом деле я хочу БОЛЬШЕ обратной совместимости, не меньше. Просто я офигел, столкнувшись с 44-летним багом на запущенной Windows 10 при попытке копирования с одного USB 3.0 SSD диска на другой SSD. Это как жить на космической станции и быть затоптанным лошадью.

Also popular now: