Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior of absolute("") in v4 #301

Closed
Pesa opened this issue Jan 7, 2024 · 8 comments
Closed

Behavior of absolute("") in v4 #301

Pesa opened this issue Jan 7, 2024 · 8 comments

Comments

@Pesa
Copy link

Pesa commented Jan 7, 2024

(Like #300, I'm not sure if this is a bug or I'm misreading the documentation)

absolute() on an empty path is defined as being equal to absolute(base) / path(). Let's assume base is /foo. With Boost Filesystem v4 we get the following:

  • absolute(path()) returns /foo
  • absolute(base) / path() returns /foo/

This is because the behavior of operator/= changed in v4. Which one is correct?

@Lastique
Copy link
Member

Lastique commented Jan 7, 2024

Which one is correct?

Both are, according to path modification rules in v3 and v4. This is intended behavior.

@Lastique Lastique closed this as completed Jan 7, 2024
@Pesa
Copy link
Author

Pesa commented Jan 7, 2024

Sorry, I'm not sure I understand. What do you mean that both are correct? Is the documentation of absolute wrong for v4 then?

@Lastique
Copy link
Member

Lastique commented Jan 7, 2024

In what way is it wrong?

@Pesa
Copy link
Author

Pesa commented Jan 7, 2024

It says:

Returns: A absolute path composed according to the following table [...] return absolute(base) / p

(I'm looking at the bottom right cell)

Not sure what "according to" means formally, but as I said earlier, for an empty path p, absolute(p) and absolute(base) / p give different results in v4.

@Lastique
Copy link
Member

Lastique commented Jan 7, 2024

I'm not sure what the problem is. Yes, the result is different between v3 and v4, and that is as expected. The v4 result is correct - in v4.

@Pesa
Copy link
Author

Pesa commented Jan 8, 2024

I'm not talking about v3, or the difference between v3 and v4. This entire issue is exclusively about v4.

@Lastique
Copy link
Member

Lastique commented Jan 8, 2024

Ah, sorry, I misunderstood the original post. Yes, in v4, result should be /foo/.

@Lastique Lastique reopened this Jan 8, 2024
Lastique added a commit that referenced this issue Jan 8, 2024
This follows the absolute() definition in the docs, as in v4 appending
an empty path results in a trailing slash.

Unfortunately, this also influences canonical and weakly_canonical,
so we had to duplicate those for v3 and v4 as well.

Fixes #301.
@Pesa
Copy link
Author

Pesa commented Jan 9, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants