Description
namei is a great tool for debugging complex paths, especially when symbolic links are involved. However, if the symbolic link is invalid, namei shows no information instead of partial:
Example 1:
$ ln -s /usr/local/does/not/exist /tmp/space
$ ls -lad /tmp/space
lrwxrwxrwx 1 tlim eng 25 2012-01-29 11:03 /tmp/space -> /usr/local/does/not/exist
$ namei /tmp/space
namei: failed to stat: /tmp/space: No such file or directory
Desired output:
f: /tmp/space
d /
d tmp
l space -> /usr/local/does/not/exist
d /
d usr
does ERROR: No such file or directory.
This was discovered when debugging the following problem: "mkdir -p /the/dir/path" was giving a strange error: "Cannot create directory `/the/dir': File exists". The obvious debugging tool was namei, but "namei /the/dir/path" failed to start because /the/dir/path did not exist.