POSIX will be standardizing readlink(1) and realpath(1): https://www.austingroupbugs.net/view.php?id=1457
Among other things, I can see the following changes that coreutils will need to make to become compliant, or else we need to push back on the POSIX folks if we have strong reasons to complain that their specification will break things: POSIX wants 'readlink non-symlink' to output a diagnostic; that is, it looks like POSIX wants us to behave like '-v' is enabled by default (our current behavior of -q by default will be non-compliant). POSIX wants us to support 'realpath -E file'. I'm not quite sure if it is matches our existing behavior when -e is omitted (in which case, all the more we have to do is have -E coming later than -e disable the earlier -e). In particular, it gives a convincing example: "The behavior with the -E option when file does not resolve (with symbolic links followed) to an existing file is not the same as simply calling realpath() with the path prefix of the file operand and writing the resulting pathname, a <slash>, and the last component of file to standard output. For example, if /tmp/nofile does not exist, and file is A/B where A is an existing directory and B is a symbolic link to /tmp/nofile, realpath with -E will output /tmp/nofile, but if B is a symbolic link to /tmp/nofile/foo, realpath with -E will treat this as an error. In both cases <tt>realpath("A/B")</tt> would fail with errno set to [ENOENT]. Even though <tt>realpath("A")</tt> would succeed, in neither case is anything ending /B the result." -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org