Skip to content

get_realpath doesn't resolve symlinks in the last (basename) part of the input path #1

@auno

Description

@auno

Consider the following example:

$ mkdir -p foo/bar1 foo/bar2 $ touch foo/bar1/baz $ ln -s ../bar1/baz foo/bar2 $ ln -s bar1 foo/bar3 $ ls -l foo/bar*/baz -rw-rw-r-- 1 auno auno 0 Nov 6 12:35 foo/bar1/baz lrwxrwxrwx 1 auno auno 11 Nov 6 12:35 foo/bar2/baz -> ../bar1/baz -rw-rw-r-- 1 auno auno 0 Nov 6 12:35 foo/bar3/baz $ get_realpath foo/bar2/baz /tmp/foo/bar2/baz $ no_symlinks=true get_realpath foo/bar2/baz /tmp/foo/bar2/baz $ readlink -f foo/bar2/baz /tmp/foo/bar1/baz $ get_realpath foo/bar3/baz /tmp/foo/bar3/baz $ no_symlinks=true get_realpath foo/bar3/baz /tmp/foo/bar1/baz

get_realpath evidently only resolves symlinks in the dirname part of the given input path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions