2017-10-25 22:50:09 +0100, Martijn Dekker: [...] > I think this means 'df' and all other utilities (and even basic libc > functions like fopen()) are required to follow symlinks given as > arguments, unless explicitly specified otherwise either by the spec or > (if a relevant option exists) by the user/programmer. [...]
I think you're right. It's not so clear that it happens for arguments to utilities, but I see that for utilities like rm/mv/ln that are supposed to act on the symlink, that is explicitely specified. That leaves only sockets and devices other than those that contain a mounted file system (and that doesn't do what you want either if they contain a mounted file system) and other esoteric files like doors, network files... as unspecified. That also means you can't know the file system the symlink is on. Thankfully on Linux at least a symlink can't be a mount point (AFAIK as mount(2) resolves the symlink and you can't change the type of a file). -- Stephane