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

Handle std::filesystem::directory_iterator errors #256

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

m-blaha
Copy link
Member

@m-blaha m-blaha commented Jan 27, 2023

Setting *dir config options to non-existing or non-accessible directory leads to unnecessary crash.
In case of reposdir also a warning is written to the log.

Resolves: #249

libdnf::repo::RepoCache::RemoveStatistics statistics{};
for (const auto & dir_entry : std::filesystem::directory_iterator(cachedir)) {
for (const auto & dir_entry : std::filesystem::directory_iterator(cachedir, ec)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intended, that issues are silent?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most cases yes. But thinking about this particular case - we can print a warning to std::err.

@j-mracek j-mracek self-assigned this Jan 30, 2023
@m-blaha m-blaha force-pushed the mblaha/reposdir_notdir branch from 233c481 to e410972 Compare January 30, 2023 13:11
Setting *dir config options to non-existing or non-accessible directory
leads to unnecessary crash.

Resolves: #249
@m-blaha m-blaha force-pushed the mblaha/reposdir_notdir branch from e410972 to dc93495 Compare January 30, 2023 16:51
@m-blaha
Copy link
Member Author

m-blaha commented Jan 31, 2023

The CI tests are failing due to syntax error in feature file - rpm-software-management/ci-dnf-stack#1213

@j-mracek
Copy link
Contributor

LGTM, please feel free to merge it when all tests pass.

@j-mracek j-mracek merged commit ac4478a into main Jan 31, 2023
@j-mracek j-mracek deleted the mblaha/reposdir_notdir branch January 31, 2023 11:36
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

Successfully merging this pull request may close these issues.

DNF4-accepted reposdir=/dev/null doesn't work
2 participants