http://qs1969.pair.com?node_id=1050011


in reply to Path-Tiny-0.028 Path::Tiny on win32 turns C:/ or C:\ into C: / absolute / realpath are broken

FYI: This has been opened as issue #49.

Does this break on Linux

It should. So that's a test suite coverage failure.

I think I have a fix, but I have a broader question:

Is there any reason to allow a raw volume like "C:" (no trailing slash) or "\\server\share" as a Path::Tiny "path"? Or should I be fixing those to have a trailing slash so they are properly understood as referencing the root directory of those volumes?

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
  • Comment on Re: Path-Tiny-0.028 Path::Tiny on win32 turns C:/ or C:\ into C: / absolute / realpath are broken

Replies are listed 'Best First'.
Re^2: Path-Tiny-0.028 Path::Tiny on win32 turns C:/ or C:\ into C: / absolute / realpath are broken
by Corion (Patriarch) on Aug 19, 2013 at 10:58 UTC

    I would say that there is a misconception. C: does not reference the root directory of a volume. It references the current working directory of that volume.

    You should either prohibit this or handle it properly, not silently convert to something else, especially not a root directory. I think the failure mode of converting C: to C:/ is a very bad one:

    my $p= path("C:"); unlink $_ for $p->children;

    For UNC paths, I see no such bad failure mode of appending a trailing directory separator.

      C: does not reference the root directory of a volume

      I understand that. What I'm trying to get guidance on is how likely it is that people would use "C:" and not mean the root directory.

      If I understand you correctly, what probably needs to happen is to immediately turn C: into the absolute path for cwd on that volume via getdcwd.

      Is that right?

      Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

        Yes. I would consider it highly likely that people use the system as documented.

        Yes, getcwd getdcwd is the function that needs to get involved to make C: resolve correctly.