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

Request: skip & continue when directories/files do not have permission #75

Closed
mburr-precor opened this issue Jan 22, 2021 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@mburr-precor
Copy link

mburr-precor commented Jan 22, 2021

When dua encounters a directory that it doesn't have permission to enter, the program prints an error essage and terminates:

$ ~/.cargo/bin/dua -f binary aggregate
Error: Permission denied (os error 13)
$ echo $?
1

It would be nice if it prints a more specific error message and continues, similar to du:

$ du -chs
du: cannot read directory './.config/gsmartcontrol': Permission denied
du: cannot read directory './.cache/dconf': Permission denied
du: cannot access './.cache/doc': Permission denied
du: cannot read directory './.dbus': Permission denied
du: cannot access './.gvfs': Permission denied
873G	.
873G	total
$ echo $?
1

My personal preference would be for this to be the default, but if it has to be enabled with an option so be it.

(du apparently doesn't have a way to turn off this behavior - which is fine by me).

edit:

I should have noted the dua version. When I went to correct this oversight I found that dua won't tell me:

mburr@mint-19:~$ ~/.cargo/bin/dua --version
dua 
mburr@mint-19:~$ ~/.cargo/bin/dua -V
dua 
@Byron Byron added the enhancement New feature or request label Jan 22, 2021
@Byron
Copy link
Owner

Byron commented Jan 22, 2021

Thanks for posting!

Could you verify that this behaviour only occours on the top-level? Thus, the issue above would not occour like this: dua -f . or dua -f - it should just report that there were IO errors while descending into the given directory.

Regarding the termination behaviour, I am not quite sure what happens if IO errors are encountered during traversal, my feeling is that this doesn’t affect the exit code yet. If that should be the case, it should enable the new behaviour rather than change it to prevent breakage.

@mburr-precor
Copy link
Author

mburr-precor commented Jan 22, 2021

Thanks for the very quick response.

Strangely, I am unable to reproduce the behavior I ran into just yesterday even though the permissions haven't changed (du still complains about the same directories).

In case you care (I don't), dua doesn't give an error message about the directories it shouldn't be able to enter - it just lists a 0 size for them.

closed: can't repro

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

No branches or pull requests

2 participants