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

Stack trace on 'Permission Denied' #3

Closed
kkuchta opened this issue Nov 6, 2012 · 6 comments
Closed

Stack trace on 'Permission Denied' #3

kkuchta opened this issue Nov 6, 2012 · 6 comments

Comments

@kkuchta
Copy link

kkuchta commented Nov 6, 2012

FFind should probably fail a little more gracefully if it hits a directory it doesn't have the permissions to deal with.

➜ ~ mkdir foo
➜ ~ mkdir foo/blah
➜ ~ cd foo
➜ foo chmod 000 blah
➜ foo ffind whatever
Traceback (most recent call last):
File "/usr/local/bin/ffind", line 828, in
main()
File "/usr/local/bin/ffind", line 824, in main
search(query)
File "/usr/local/bin/ffind", line 481, in search
_search(query, '.', 0, get_initial_ignorers())
File "/usr/local/bin/ffind", line 478, in _search
_search(query, d, depth + 1, ignorers)
File "/usr/local/bin/ffind", line 461, in _search
contents = os.listdir(dir)
OSError: [Errno 13] Permission denied: './blah'
➜ foo

(OS X 10.8.1)

@sjl
Copy link
Owner

sjl commented Nov 9, 2012

Sounds like a good idea. I wonder if I should do what find does and print messages on standard error, or just skip them silently.

I'm leaning toward skipping silently since those messages always annoy the shit out of me when I use find. Maybe a --verbose flag to show them would be useful?

@kkuchta
Copy link
Author

kkuchta commented Nov 9, 2012

Hmm... yeah, it's a tradeoff, since silently skipping them could lead to a frustrating time wondering why something you know is there is not showing up. Since ffind is all about defaults that do what most people want, you're right: silent skipping with a verbose flag to do otherwise is probably the most useful route.

@sjl
Copy link
Owner

sjl commented Nov 9, 2012

What about a single WARNING: Skipping directories you don't have permission to read
line of output at the end on stderr when that happens by default, not even then
if --quiet, and full warnings when --verbose?

@kkuchta
Copy link
Author

kkuchta commented Nov 9, 2012

Could do. Probably depends on whether you think the main use case is people just searching manually (in which case that's useful) or are piping the output of ffind somewhere (in which case the quite option is probably better).

@NewAlexandria
Copy link

bump for quality. My thanks for your work.

@wwwjfy
Copy link
Contributor

wwwjfy commented Apr 14, 2014

committed my initial version for this 1-year-old issue. Just print every error.

@kkuchta for pipes, it's not a problem as stderr won't be piped to stdout pipe unless specified explicitly.

@sjl sjl closed this as completed in 0dc718e Dec 9, 2015
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

4 participants