You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AbsoluteDirectoryPath.IsRoot is false for /home/.. while Parent returns the path itself, so while (!dir.IsRoot) dir = dir.Parent never ends #479
Since #446, Parent resolves dot segments with Path.GetFullPath, and when the resolved path has no parent it returns this (AbsoluteDirectoryPath.cs#L50-L66).``
IsRoot still compares the unresolved string with its root (L118):
The XML docs on Parent (L39-L43) tell callers to detect the end of an upward walk by checking IsRoot, or by comparing the parent with this path. For a path that resolves to a root, those two signals now disagree.
Reproduction (net10.0, Linux, observed)
vard=AbsoluteDirectoryPath.Create<AbsoluteDirectoryPath>("/home/..");d.Parent==d;// true (resolved "/" has no parent, so Parent returns this)d.IsRoot;// falsed.GetAncestors().Count()// 0// The documented idiom spins forever:while(!d.IsRoot){d=d.Parent;}
/home/user/../.. behaves the same way, and so does C:\Windows\.. on Windows.
Related: Name (L75) returns the literal last segment, so "/home/user/..".Name is "..". That matches its "last component" doc, but it should either be called out in the docs or resolved the same way.
Suggested fix
Compute IsRoot on the resolved path, either as string full = Path.GetFullPath(WeakString); Path.GetPathRoot(full) == full or as the equivalent Parent == this.
Use PathPolyfill where netstandard2.0 needs it.
Acceptance criteria
IsRoot is true exactly when Parent returns the path itself, including for /home/.., /home/user/../.. and C:\x\...
A test walks while (!d.IsRoot) d = d.Parent; from a dotted path and stops at the root.
Priority: High. The idiom the XML docs recommend, while (!d.IsRoot) d = d.Parent;, loops forever for a dotted path that resolves to a root. In a shipped library that is a hang in consumers' code, with no exception to catch.
Area / suggested assignee:Semantics.Paths/Implementations/AbsoluteDirectoryPath.cs (IsRoot at L118 vs Parent at L50-L66). Owner: @matt-edmondson
Next step: compute IsRoot on the Path.GetFullPath-resolved string, or as Parent == this, using PathPolyfill for netstandard2.0. Add the walk-to-root test. Decide whether Name on .. paths should also resolve, or just be documented.
Activity
matt-edmondson commentedon Oct 20, 2026
Triage
while (!d.IsRoot) d = d.Parent;, loops forever for a dotted path that resolves to a root. In a shipped library that is a hang in consumers' code, with no exception to catch.Semantics.Paths/Implementations/AbsoluteDirectoryPath.cs(IsRootat L118 vsParentat L50-L66). Owner: @matt-edmondsonDirectoryPathprimitive). Fixing both in one change would keepIsRoot/Parentconsistent across the three path types. No open PR covers either.IsRooton thePath.GetFullPath-resolved string, or asParent == this, usingPathPolyfillfor netstandard2.0. Add the walk-to-root test. Decide whetherNameon..paths should also resolve, or just be documented.Generated by Claude Code