Why does canonicalize call collapse after realpath?

Martin Buchholz martinrb at google.com
Wed Apr 30 23:33:52 UTC 2014

canonicalize_md.c does:

    /* First try realpath() on the entire path */
    if (realpath(original, resolved)) {
        /* That worked, so return it */
        return 0;

And collapse promises to remove /./ and /../ BUT realpath should have
already done that:

The *realpath*() function shall derive, from the pathname pointed to by
*file_name*, an absolute pathname that names the same file, whose
resolution does not involve '.', '..', or symbolic links.

(although it's true that collapse is not the expensive part of the

More information about the core-libs-dev mailing list