There are two main types of symlinks, hard and soft. Hard symlinks allow a single file to appear as if it resides in multiple locations, and soft symlinks simply point to a location. Should that location change the soft symlink will no longer point to the file, and unless it is updated it will become a bad symlink. Bad symlinks are most commonly found as a result of programs being installed and un-installed. One example is when a user finds that some of their files work as expected in one location but fail when moved or a directory is renamed. This is usually due to problems caused by bad symlinks. Symlinks can be extremely useful, but they can potentially cause great frustration for the user. FSlint will look for symlinks that have some kind of problem. Not all symlinks reported need to be fixed as the circumstances for their inception can be radically different depending on the user and the purpose. FSlint will simply report the symlinks it finds during its search. Specifically, it will look for five different types.
"Dangling" symlinks point to a file that is no longer there. These symlinks do not take up a lot of hard drive space, but they can often cause confusion as they clutter the file system. In this example, the file My_File_Is_Gone has been deleted leaving the symlink Where_Is_My_File dangling.
"Suspect" symlinks point to a file below their directory structure. In this example Suspect_Symlink points to a valid file sub file, however, if not treated properly the file could easily be moved breaking the symlink.
"Relative" symlinks point to a path that is determined by the current location. In this example yet_another_softlink will only work if another_softlink exists in a subdirectory of another_dir. Should this symlink be moved to another location, it will cease to work.
"Absolute" symlinks point to an exact full path location. In this example the path is expressly stated. This is generally a good practice as it allows the symlinks to move at the user's discretion. However, should the original file be moved or deleted, these symlinks will fail.
"Redundant" symlinks collapse and expand pointlessly in their path. In this example, FSlint starts in the /FSlint directory. The link is told to move into the parent directory (with ../), then to search the parent directory (with ./) before descending back into the originating folder, /FSlint, to find the file badid. This tells the link to perform three actions only to arrive in the same directory where it started. It would be better for the link to directly point to the absolute location of the file.
Command Line Interface
The command line interface to this utility is 'findbl'. This utility will be found in the installation directory of fslint.
$ /usr/share/fslint/fslint/findbl --help find "Bad" symbolic Links. Usage: findbl [-d] [-s] [-l] [-s] [-n] [[-r] [-f] paths(s) ...] These options are mutually exclusive (i.e. only the last one takes effect). -d Dangling (or stale) links. This is the default mode -s Suspect links (absolute links to paths within or below the link's directory) -l all reLative links -A all Absolute links -n reduNdant info in links (/././. ///// /../ etc.) If no path(s) specified, then the current directory is assumed. e.g. find dangling links in library directories: findbl $(getffl)