[Issue 13825] New: relativePath not handling "." and ".." correctly

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Dec 6 16:12:57 PST 2014


https://issues.dlang.org/show_bug.cgi?id=13825

          Issue ID: 13825
           Summary: relativePath not handling "." and ".." correctly
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: cromfr at gmail.com

It seems that relativePath handles "." and ".." as folders names instead of
using them as "paths".
This leads to situations like "/home/../" is a subdirectory of "/home"



Use case:

import std.path;
import std.stdio;

void main(){
    //Gives ".." instead of "."
    writeln( relativePath("/", "/./") );

    //Gives "../.." instead of "."
    writeln( relativePath("/home", "/home/../home") );
}

--


More information about the Digitalmars-d-bugs mailing list