I have been looking for a while, and I cannot fathom why the md5 checksum of a symbolic link equals to the file it points to. In my understanding a symbolic link is still a file. Given that it is empty I would expect a symlink to have an md5 of d41d8cd98f00b204e9800998ecf8427e. (see here)
However testing in practice:
echo Hello World > test
ln -s test test_symlink
Then running:
md5deep test test_symlink
Yields:
e59ff97941044f85df5297e1c302d260 /tmp/test
e59ff97941044f85df5297e1c302d260 /tmp/test_symlink
Does anyone know what I am missing here?
A symbolic link is transparent to almost all filesystem operations; that's the point of it. When you open
a symlink, it actually opens the target file, and it's the contents of the target file that get MD5'd. Only readlink
and lstat
(and the much more rarely used lchown
, lutimes
, and open(..., O_PATH|O_NOFOLLOW)
) are able to "see" a symlink instead of the file behind it.