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

du: Return non zero error code when dealing with permissions errors #3382

Merged
merged 1 commit into from
Apr 10, 2022

Conversation

sylvestre
Copy link
Contributor

Make the tests/du/no-x.sh & long-sloop.sh pass

Nd make the tests/du/no-x.sh & long-sloop.sh pass
@sylvestre
Copy link
Contributor Author

sylvestre commented Apr 10, 2022

Fixes more stuff than expected:


Warning: Congrats! The gnu test tests/du/inacc-dest is no longer failing!
Warning: Congrats! The gnu test tests/du/inacc-dir is no longer failing!
Warning: Congrats! The gnu test tests/du/long-sloop is no longer failing!
Warning: Congrats! The gnu test tests/du/no-x is no longer failing!

But caused a regression:

Error: GNU test failed: tests/du/long-from-unreadable. tests/du/long-from-unreadable is passing on 'main'. Maybe you have to rebase?

I will have a look later

@sylvestre
Copy link
Contributor Author

sylvestre commented Apr 10, 2022

OK, it isn't a regression. We had the issue before but we were not returning an error code.

The error in long-from-unreadable.sh is

[...]xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': 
File name too long (os error 36)

explained here even if we don't use walkdir, it is probably the same underlying issue:
BurntSushi/walkdir#23
Also referenced in our project about rm:
#2949

So, good for review!

@@ -340,8 +341,12 @@ fn du(
let description = format!("cannot access {}", entry.path().quote());
let error_message = "Permission denied";
show_error_custom_description!(description, "{}", error_message);
set_exit_code(1);
Copy link
Member

Choose a reason for hiding this comment

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

I think this can be cleaned up some more with UResult, which will print the right error message automatically when converting from an io::Error. However, that is a more involved refactor, so I'll approve and leave it up to you whether you want to do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I will land this and open an new issue and maybe work on it

@sylvestre sylvestre merged commit ddf067f into uutils:main Apr 10, 2022
@sylvestre sylvestre deleted the du-nox branch April 10, 2022 10:25
Copy link
Collaborator

@jfinkels jfinkels left a comment

Choose a reason for hiding this comment

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

👍

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.

3 participants