• I’m not really sure I get the usefulness of this absolute function. It still returns relative paths if the input was relative and it doesn’t resolve “…”. What would you use it for where canonicalize doesn’t work for you?

    • Well, as it says in the documentation I linked:

      unlike canonicalize absolute does not resolve symlinks and may succeed even if the path does not exist.

      Primarily, the latter part is what I want. There’s just sometimes situations where a path doesn’t exist (yet), but you want to know what it would look like as an absolute path.

    •  ssokolow   ( @ssokolow@lemmy.ml ) 
      link
      fedilink
      English
      1
      edit-2
      3 months ago

      It still returns relative paths if the input was relative

      False

      and it doesn’t resolve “…”

      I’ll assume you meant .., since ... is an ordinary filename. (Aside from the “who remembers …?” feature introduced in Windows 95’s COMMAND.COM where cd ... was shorthand for doing cd .. twice and you could omit the space after cd if your target was all dots.)

      The reason it doesn’t do that is that, when symlinks get involved, /foo/bar/.. does not necessarily resolve to /foo and making that assumption could introduce a lurking security vulnerability in programs which use it.