[libcxx-commits] [libcxx] [libc++] Do not remove a root-name followed by ".." in `path::lexically_normal()` (PR #201261)
Igor Kudrin via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jun 26 20:20:00 PDT 2026
================
----------------
igorkudrin wrote:
> ```
> {"C:/..", "C:/"},
> {"C:/../foo", "C:/foo"},
> ```
These examples were normalized correctly before my patch because the parser identified the first '/' as a root separator, so `ClassifyPathPart()` classified it as `PK_RootSep`, which prevented the following ".." from removing the root name, despite it being incorrectly classified as `PK_Filename` before the patch.
> ```
> {"C:./", "C:"},
> {"C:.", "C:"},
> ```
These examples were also normalized in the expected (i.e., exactly this) way before the patch.
> WDYT? I'm not a huge Windows connoisseur but I think those are correct, and they are fixed by your patch IIUC (because it now properly classifies `C:` as a root name).
It's great to have more test cases, especially since there are no cases with drive letters, but as the patch does not actually change the observed behavior for them, I don't think they should be added here.
https://github.com/llvm/llvm-project/pull/201261
More information about the libcxx-commits
mailing list