Skip to content

realpath -s doesn't resolve to absolute path #7574

@kidonng

Description

@kidonng
❯ fish --version
fish, version 3.1.2-1798-g4dae10691

❯ echo $version
3.1.2-1798-g4dae10691

Glad to see a -s (--no-symlinks) option is added to realpath in 568f903. But there are currently two issues with realpath:

  • share/functions/realpath.fish isn't updated along with the builtin, so one can't just use realpath -s, they have to type builtin realpath -s instead.
  • While the above is a minor issue, the main problem this issue is about is realpath -s doesn't resolve to absolute path at all.
❯ pwd
/Users/kid

❯ ls -l .cache
lrwxr-xr-x  1 kid  staff  14 Dec  5 11:29 .cache -> Library/Caches

❯ builtin realpath -s ~/.cache
/Users/kid/.cache

❯ builtin realpath -s .cache
.cache

But I expect .cache to be resolved to the absolute path /Users/kid/.cache.

I noticed the -s flag calls normalize_path internally, but the function seems to only deal with . and .., and it doesn't resolve to a absolute path. So is realpath -s's behavior intended? Or is this just a implementation flaw?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intendedenhancement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions