display | more...
If you own a Macintosh, you probably know (or should know) that you never begin a file or disk name with a period.

This is a very good rule, by the way. The Mac's operating system believes that files beginning with periods to be drivers, those invisible programs that run your disk drives, serial ports, and other input/output jacks. If your file names begin with a period, the Mac can potentially become confused and treat your file as a device driver instead of a plain old data file.

This can be bad enough, but never, never name anything .Sony. Doing so will trash your hard drive.

".Sony" is the name of the invisible floppy disk driver that controls your floppy drive. If you give a file that name, the Mac may try to address it as though it's a floppy drive. All kinds of hard drive corruption may result.

I have never tried this personally. This knowledge usally causes one to snicker with sinister glee. It's kinda like having a giant red "do not push" button attached to the side of your computer. If anybody actually tries this, let me know what happens.

...and if you use this tactic on a Mac other than your own, please don’t mention my name

Well gee, this seems like a bit of latent anti-mac propaganda...

This problem happens in very old software that uses older Mac OS APIs. The original Mac OS System Software used a flat file system called MFS. Under a flat filesys, all files on a volume are actually in the same directory, and any illusion to the contrary is perpetrated by the browser (in this case the Finder.)

To open a file, you could use FSOpen(), which takes a file name and a volume reference number and returns a file reference number. No directory ID is used because we're on a flat file system. In most cases, the desired directory is the default one, so the volume refnum is zero. Unfortunately, this behavior causes the underlying API, PBOpen, to mistake the file manager call for a driver manager call, causing communication with the driver instead of I/O file. Oddly, specification of a vRefNum still causes the driver to be used.

This is a consequence of the Mac's adoption of a scheme somewhat like UNIX, where devices are given a branch of a monolithic hierarchical tree, /dev. In UNIX, saving things to /dev can be bad, although you shouldn't normally have privileges to do so. Naming things starting with a period will cause ls and most browsers to hide the file, causing it to be hard to find later on.

Clarification for UNIX folks - I've been informed that /dev is not really a "magic" branch of the FS in that the OS doesn't know there's something special about it. However, all it contains (& should contain) are device files, which are special to the OS. Hence devices are given a branch of the tree. This contrasts with the Mac OS, where devices can be treated as part of the file system, but do not have pathnames or reside on volumes. I've gotten a comment & a few downvotes; I don't know if this is the main problem with this node.

Most programmers have always used the more specific APIs that end in xxOpenDF or xxOpenRF, which open the data fork or resource fork, respectively. These calls don't have these problems. Unless a programmer is trying to minimize work in a quick-and-dirty app by using the MFS backwards-compatibility "feature" which treats the app's directory as the flat volume, they're unlikely to get bitten by this bug.

BTW, .Sony is the name of the floppy driver. Newer Macs don't use it. The only hard drive to was the 20 MB Apple HD-20.

Log in or register to write something here or to contact authors.