question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

end-of-file-fixer hook does not handle permission errors well

See original GitHub issue

I saw this traceback from during execution of pre-commit today:

Traceback (most recent call last):
  File "/home/someuser/.cache/pre-commit/repolz82qqa4/py_env-python3/bin/end-of-file-fixer", line 11, in <module>
    sys.exit(end_of_file_fixer())
  File "/home/someuser/.cache/pre-commit/repolz82qqa4/py_env-python3/lib/python3.5/site-packages/pre_commit_hooks/end_of_file_fixer.py", line 58, in end_of_file_fixer
    with open(filename, 'rb+') as file_obj:
PermissionError: [Errno 13] Permission denied: 'some_django_project/migrations/0023_auto_20181120_1541.py'

That file was created from inside a container… Would be nice to not have the backtrace, just an error.

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
asottilecommented, Nov 20, 2018

You’re free to disagree 😃 – and in most cases I agree with you that a tool should produce error messages instead of stracktraces but in this case and in this particular class of tools and exceptions I don’t:

  • first, the target audience of this tool is programmers
  • when catching an exception, produce an actionable result: that is, take the exception you’re handed and produce a readable error message helping the user understand what to do
  • In this case, there are a fractal of IO errors that are possible (not to mention MemoryError and any other flavor of “impending doom”)
  • Almost all of these the tool can’t make a reasonable decision on a useful error message to display. You might say “oh just print the exception and not the frames” but in many cases you’ve removed the most useful information! The number of times I’ve seen IOError [Errno 13] Permission denied and no other information…
  • except Exception as e: print(e) sucks! It’s much more likely to cause confusion (or hide bugs!) than be productive.
  • The logic to implement all of the above, plus some sort of --debug option, plus the tests to ensure it would work would dwarf the contents of the actual tool!
  • Developing the tool would be harder as mistake-exceptional cases may be swallowed as noops
0reactions
hartworkcommented, Nov 24, 2018

Well, if you consider showing backtraces cool and I don’t we have hit the bottom here. Let’s close this as wont-fix then?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Container permission denied: How to diagnose this error
Learn what is causing a container permissions error and how to work around the issue without resorting to the --privileged flag.
Read more >
post receive hook is showing an error of permission
1 Answer 1 ... Check path-to-beta-dir permissions and ownership.Try changing them.Give to your user as owner or give permissions with chmod for ...
Read more >
Getting error trying to start a process via app - UiPath Forum
I am getting the following error when trying to start the process from an app ... webhook with message: You are not authorized!...
Read more >
How to fix Error You do not have permission to access…
Every file and directory in the Linux system is owned by a specific user and group and has permissions that allow performing particular...
Read more >
File access permissions? - Code Composer Studio forum
I can work around this error by exiting CCS and restarting the program as an ... I believe CCS does not handle user...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found