UFS: The Root of All Evil 275 Recall that Unix does place one hard-and-fast restriction on filenames: they may never, ever contain the magic slash character (/), since the Unix kernel uses the slash to denote subdirectories. To enforce this requirement, the Unix kernel simply will never let you create a filename that has a slash in it. (However, you can have a filename with the 0200 bit set, which does list on some versions of Unix as a slash character.) Never? Well, hardly ever. Date: Mon, 8 Jan 90 18:41:57 PST From: sun!wrs!yuba!steve@decwrl.dec.com (Steve Sekiguchi) Subject: Info-Mac Digest V8 #35 I’ve got a rather difficult problem here. We've got a Gator Box run- ning the NFS/AFP conversion. We use this to hook up Macs and Suns. With the Sun as a AppleShare File server. All of this works great! Now here is the problem, Macs are allowed to create files on the Sun/ Unix fileserver with a “/” in the filename. This is great until you try to restore one of these files from your “dump” tapes. “restore” core dumps when it runs into a file with a “/” in the filename. As far as I can tell the “dump” tape is fine. Does anyone have a suggestion for getting the files off the backup tape? Thanks in Advance, Steven Sekiguchi Wind River Systems sun!wrs!steve, steve@wrs.com Emeryville CA, 94608 Apparently Sun’s circa 1990 NFS server (which runs inside the kernel) assumed that an NFS client would never, ever send a filename that had a slash inside it and thus didn’t bother to check for the illegal character. We’re surprised that the files got written to the dump tape at all. (Then again, perhaps they didn’t. There’s really no way to tell for sure, is there now?) 5Forwarded to UNIX-HATERS by Steve Strassmann.
276 The File System Moving Your Directories Historically, Unix provides no tools for maintaining recursive directories of files. This is rather surprising, considering that Unix (falsely) prides itself on having invented the hierarchical file system. For example, for more than a decade, Unix lacked a standard program for moving a direc- tory from one device (or partition) to another. Although some versions of Unix now have a mvdir command, for years, the standard way to move directories around was with the cp command. Indeed, many people still use cp for this purpose (even though the program doesn’t preserve modifica- tion dates, authors, or other file attributes). But cp can blow up in your face. Date: Mon, 14 Sep 92 23:46:03 EDT From: Alan Bawden Alan@lcs.mit.edu To: UNIX-HATERS Subject: what else? Ever want to copy an entire file hierarchy to a new location? I wanted to do this recently, and I found the following on the man page for the cp(1) command: NAME cp - copy files cp -rR [ -ip ] directory1 directory2 -r -R Recursive. If any of the source files are directories, copy the directory along with its files (including any subdirectories and their files) the destination must be a directory. Sounds like just what I wanted, right? (At this point half my audience should already be screaming in agony—“NO! DON’T OPEN THAT DOOR! THAT’S WHERE THE ALIEN IS HIDING!”) So I went ahead and typed the command. Hmm… Sure did seem to be taking a long time. And then I remembered this horror from fur- ther down in the cp(1) man page: BUGS cp(1) copies the contents of files pointed to by symbolic links. It does not copy the symbolic link itself. This can lead to
Previous Page Next Page