Skip to content

custom_hook.rb:72:in `popen': Permission denied - hooks/post-receive.d/__pycache__ (Errno::EACCES) #785

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

Closed
tomhub opened this issue Apr 9, 2021 · 6 comments

Comments

@tomhub
Copy link

tomhub commented Apr 9, 2021

I'm not sure if I setup something wrong, or there is something weird.

remote: /var/lib/gitolite/local/hooks/common/lib/git_hosting/custom_hook.rb:72:in `popen': Permission denied - hooks/post-receive.d/__pycache__ (Errno::EACCES)
remote:         from /var/lib/gitolite/local/hooks/common/lib/git_hosting/custom_hook.rb:72:in `block in call_extra_hooks'
remote:         from /var/lib/gitolite/local/hooks/common/lib/git_hosting/custom_hook.rb:69:in `each'
remote:         from /var/lib/gitolite/local/hooks/common/lib/git_hosting/custom_hook.rb:69:in `call_extra_hooks'
remote:         from /var/lib/gitolite/local/hooks/common/lib/git_hosting/custom_hook.rb:17:in `exec'
remote:         from hooks/post-receive:15:in `<main>'

In addition, I had to install python onto server so I don't get unexpected error:
Calling additional post-receive hooks...

  • Executing extra hook 'hooks/post-receive.d/mail_notifications'
    remote: /usr/bin/env: 'python': No such file or directory
@tomhub
Copy link
Author

tomhub commented Apr 10, 2021

removed all hooks, reinstalled them (with current redmine_git_hosting), issue seems disappeared.

@tomhub tomhub closed this as completed Apr 10, 2021
@tomhub
Copy link
Author

tomhub commented Apr 10, 2021

Unfortunatelly, it's back.

@tomhub tomhub reopened this Apr 10, 2021
@tomhub
Copy link
Author

tomhub commented Apr 12, 2021

So I tested this a bit more. If I delete local/hooks/common/post-receive.d/__pycache__ directory, then first git push proceeds without an error. However, further pushed produces warnings as above.

@fairf4x
Copy link

fairf4x commented Oct 19, 2021

My guess is that hooks/common/post-receive.d/__pycache__ gets in the list of hooks by mistake.
In file hooks/common/lib/git_hosting/custom_hook.rb I can see call to get_executables('hooks/post-receive.d') which yields all the files in hooks/common/post-receive.d/ directory including the __pycache__ directory (I have tested this with piece of ruby code).
I have extended the skip loop test in get_executables function to leave out __pycache__ like this:
next if item == '.' || item == '..' || item == '__pycache__'
This patch worked for me.

@tomhub
Copy link
Author

tomhub commented Oct 20, 2021

Thank you @fairf4x for your solution. I have modified line 55 to:

next if ['.', '..', '__pycache__'].include? item

And it seems this fixed the problem for me as well. I assume the code will be updated in repository as well.

@alexandermeindl
Copy link
Collaborator

Hi @tomhub, @fairf4x

thanks for providing a solution for this problem. I added your change to master.

@tomhub tomhub closed this as completed Oct 28, 2021
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

3 participants