Symlinks are an abomination

$ pwd
$ cd ..
$ rm -rf b
$ pwd
$ ls -l /a
b -> /d/e
$ # Drat!  I've just removed the wrong set of files, d/e!

Even ln(1) needs a special flag to tell it if the target is a real file or a symlink! Which makes replacing existing symlinks extremely confusing.

Breaking Dot Dot

From Rob Pike’s paper Lexical File Names in Plan 9 or Getting Dot-Dot Right:

The introduction of symbolic links has changed the Unix file system from a true hierarchy into a directed graph, rendering .. ambiguous and sowing confusion.

Unix popularized hierarchical naming, but the introduction of symbolic links made its naming irregular. Worse, the pwd command, through the underlying getwd library routine, uses a tricky, expensive algorithm that often delivers the wrong answer. Starting from the current directory, getwd opens the parent, .., and searches it for an entry whose i-number matches the current directory; the matching entry is the final path element of the ultimate result. Applying this process iteratively, getwd works back towards the root. Since getwd knows nothing about symbolic links, it will recover surprising names for directories reached by them, as illustrated by the example; the backward paths getwd traverses will not backtrack across the links.“ –


See Also