realpath icon indicating copy to clipboard operation
realpath copied to clipboard

Fails to find realpath of directory symlink

Open cspotcode opened this issue 6 years ago • 0 comments

realpath ./foo/this-is-a-symlink fails to resolve the symlink.

pwd # assume we're in /home/cspotcode
mkdir -p foo
ln -s .. ./foo/this-is-a-symlink
# ./foo/this-is-a-symlink points to .. (points to /home/cspotcode)

realpath ./foo/this-is-a-symlink # Native realpath outputs "/home/cspotcode"
realpath-bash-implementation ./foo/this-is-a-symlink # Erroneously outputs "/home/cspotcode/foo/bar"

pwd -P will resolve symlinks for everything except the last item of the path. So it doesn't resolve this-is-a-symlink.

cspotcode avatar Sep 06 '19 16:09 cspotcode