Date: Thu, 04 Nov 2021 20:58:29 -0700
On Thursday, 4 November 2021 18:58:57 PDT Andrey Semashev via Std-Discussion
wrote:
> That's not a rationale, it's a consequence of the specification. I'm
> interested in the motivation for the specification being written this
> way (if it was written so intentionally, with respect to the case I
> described).
It seems that operator/ is implemented like the "cd" command, not a string
concatenation.
Think of this:
$ cd /usr
$ cd /bin
$ pwd
/bin
You don't expect it to show /usr/bin (whether /bin is a symlink to /usr/bin or
not is irrelevant here).
I agree with you it's surprising at first sight because
"//net/foo" + "/bar"
makes it a subdir of //net/foo.
But it's not meant to be like string concatenation.
The only prior art of operator/ that I know of is in the Meson buildsystem and
it behaves exactly like fs::path. See
https://mesonbuild.com/Syntax.html#string-path-building
> To me, the check for the appended path being absolute seems superfluous.
> Removing it fixes the test case I presented while it also seems to
> introduce no new regressions. The spec already checks the root name and
> root directory in the following steps, so eventually the algorithm still
> produces expected results in non-UNC cases.
No regressions except for the people who expect it to work as described.
Therefore, there may be regressions. It's too late to change now.
wrote:
> That's not a rationale, it's a consequence of the specification. I'm
> interested in the motivation for the specification being written this
> way (if it was written so intentionally, with respect to the case I
> described).
It seems that operator/ is implemented like the "cd" command, not a string
concatenation.
Think of this:
$ cd /usr
$ cd /bin
$ pwd
/bin
You don't expect it to show /usr/bin (whether /bin is a symlink to /usr/bin or
not is irrelevant here).
I agree with you it's surprising at first sight because
"//net/foo" + "/bar"
makes it a subdir of //net/foo.
But it's not meant to be like string concatenation.
The only prior art of operator/ that I know of is in the Meson buildsystem and
it behaves exactly like fs::path. See
https://mesonbuild.com/Syntax.html#string-path-building
> To me, the check for the appended path being absolute seems superfluous.
> Removing it fixes the test case I presented while it also seems to
> introduce no new regressions. The spec already checks the root name and
> root directory in the following steps, so eventually the algorithm still
> produces expected results in non-UNC cases.
No regressions except for the people who expect it to work as described.
Therefore, there may be regressions. It's too late to change now.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel DPG Cloud Engineering
Received on 2021-11-04 22:58:34