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
Paths: dir.Parent / dir.Name names a different directory when the path ends in .. or ., breaking the documented round trip #503
Since #498 (cf1dd3d), the Name docs on AbsoluteDirectoryPath (Implementations/AbsoluteDirectoryPath.cs:74) and DirectoryPath (Primitives/DirectoryPath.cs:43) promise: "so Parent / Name is this directory again". The two halves read different forms of the path:
Parent resolves . and .. first: GetFullPath for absolute paths, Normalize for relative ones.
Name is Path.GetFileName(WeakString), the last segment exactly as written.
Observed (net10.0 build)
Path
Names
Parent / Name
Which resolves to
absolute /home/user/..
/home
/..
/
relative a/..
.
../..
two levels up
relative .
.
../.
..
DirectoryPath("/")
/
''
Parent and Name are both empty
Code that rebuilds a path from its parent and name, for example to move a directory to a new parent while keeping its name, ends up in the wrong place for these inputs. Nothing raises an error.
Suggested fix
Either:
derive Name from the same resolved form Parent uses: Path.GetFileName(Path.GetFullPath(WeakString)) for absolute paths, and the last segment of Normalize() for relative ones; or
if the as-written name is intended (an existing remark says the name of /home/user/.. is ..), narrow the doc promise to paths with no ./.. segments and that are not roots.
Acceptance criteria
Either Parent / Name equals the directory, by resolved path, for the four inputs above, or the docs state the exception and tests pin the chosen behaviour.
Decision needed: a maintainer has to pick between fix (1), resolving Name, which is a behaviour change, and fix (2), narrowing the doc. An existing remark says the name of /home/user/.. is .., which leans toward (2) unless that remark is being revisited.
Activity
matt-edmondson commentedon Oct 30, 2026
Triage
./..and roots, but when it hits, the rebuilt path silently points somewhere else.Semantics.Paths:Implementations/AbsoluteDirectoryPath.cs:74andPrimitives/DirectoryPath.cs:43. Both doc lines were added in AbsoluteDirectoryPath.Name and DirectoryPath.Name return FileName, so dir.Parent / dir.Name builds a file path #498 and are confirmed onmain(be8aa23).Name, which is a behaviour change, and fix (2), narrowing the doc. An existing remark says the name of/home/user/..is.., which leans toward (2) unless that remark is being revisited.Parentto resolve./.., which is where the two halves started to differ. Sibling: Paths: the parent of a one-segment relative path (or the directory of a bare file name) is "", so AsAbsolute() throws and IsDirectory is false #502, in the same area.Semantics.Paths.Generated by Claude Code
Reject "." and ".." as a file name and as a file path's last segment …