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

error_code parameter not reset in directory_entry::status() #291

Closed
gfgtdf opened this issue Aug 28, 2023 · 4 comments
Closed

error_code parameter not reset in directory_entry::status() #291

gfgtdf opened this issue Aug 28, 2023 · 4 comments

Comments

@gfgtdf
Copy link

gfgtdf commented Aug 28, 2023

The documentation https://www.boost.org/doc/libs/1_83_0/libs/filesystem/doc/reference.html#status specifies

If, during attribute determination, the underlying file system API reports an error, sets ec to indicate the specific error reported. Otherwise, ec.clear().

But it was observed that ec.clear() is no longer called in all cases, see for example wesnoth/wesnoth#7866

@Lastique
Copy link
Member

Lastique commented Aug 28, 2023

Please, provide a reproducer or at least more information as to what's going on. ec.clear() is being called here.

@gfgtdf
Copy link
Author

gfgtdf commented Aug 28, 2023

I see i linked the wrong documentation, this issue is about directory_entry::status() not the status() free function, I think what i said still applies though: https://www.boost.org/doc/libs/1_83_0/libs/filesystem/doc/reference.html#directory_entry-observers refers to https://www.boost.org/doc/libs/1_83_0/libs/filesystem/doc/reference.html#Error-reporting which states:

Functions having an argument of type system::error_code& report errors as follows, unless otherwise specified:

If a call by the implementation to an operating system or other underlying API results in an error that prevents the function from meeting its specifications, the system::error_code& argument is set as appropriate for the specific error. Otherwise, clear() is called on the system::error_code& argument.

Here

if (!filesystem::status_known(m_status))
ec is not reset when the status is already known, which is a behavior change from boost 1.82

@Lastique
Copy link
Member

Oh, sorry, you mean directory_entry members. Those are not documented to call ec.clear(), but in std::filesystem they are effectively required to clear the error code.

I'll fix this, thanks for the report.

@gfgtdf
Copy link
Author

gfgtdf commented Aug 28, 2023

Thanks for fixing this.

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