Skip to content

File permissions not being updated/checked on rewrite #4230

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
2 of 7 tasks
tobias-- opened this issue Jun 12, 2018 · 2 comments
Closed
2 of 7 tasks

File permissions not being updated/checked on rewrite #4230

tobias-- opened this issue Jun 12, 2018 · 2 comments

Comments

@tobias--
Copy link

tobias-- commented Jun 12, 2018

  • Gitea version (or commit ref): 1.4.2
  • Git version:
  • Operating system: Linux ecm07 4.4.0-127-generic fixed bug #151 caused Find should be Get #153-Ubuntu SMP Sat May 19 10:58:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

I noticed that the git hooks stopped working (after migrating to another server). Rewriting the hooks from the administration panel did not yield any results. Newly created repositories work fine, but the pre-migration ones do not. I noticed that the file permissions of the hooks directory differ:

ls -lah old-repo.git/hooks/
total 76K
drwxrwxr-x 5 gitea gitea 4,0K Jun 12 09:32 ./
drwxrwxr-x 7 gitea gitea 4,0K Mai 29 14:43 ../
-rw-rw-r-- 1 gitea gitea  478 Jun 25  2017 applypatch-msg.sample
-rw-rw-r-- 1 gitea gitea  896 Jun 25  2017 commit-msg.sample
-rw-rw-r-- 1 gitea gitea  303 Jun 12 09:29 post-receive
drwxrwxr-x 2 gitea gitea 4,0K Jun 12 09:32 post-receive.d/
-rw-rw-r-- 1 gitea gitea  189 Jun 25  2017 post-update.sample
-rw-rw-r-- 1 gitea gitea  424 Jun 25  2017 pre-applypatch.sample
-rw-rw-r-- 1 gitea gitea 1,7K Jun 25  2017 pre-commit.sample
-rw-rw-r-- 1 gitea gitea 1,3K Jun 25  2017 prepare-commit-msg.sample
-rw-rw-r-- 1 gitea gitea 1,4K Jun 25  2017 pre-push.sample
-rw-rw-r-- 1 gitea gitea 4,9K Jun 25  2017 pre-rebase.sample
-rw-rw-r-- 1 gitea gitea  303 Jun 12 09:29 pre-receive
drwxrwxr-x 2 gitea gitea 4,0K Jun 25  2017 pre-receive.d/
-rw-rw-r-- 1 gitea gitea  544 Jun 25  2017 pre-receive.sample
-rw-rw-r-- 1 gitea gitea  283 Jun 12 09:29 update
drwxrwxr-x 2 gitea gitea 4,0K Jun 25  2017 update.d/
-rw-rw-r-- 1 gitea gitea 3,6K Jun 25  2017 update.sample
ls -lah new-repo.git/hooks/
total 72K
drwxr-xr-x 5 gitea gitea 4,0K Jun 12 09:36 ./
drwxr-xr-x 7 gitea gitea 4,0K Jun 12 09:36 ../
-rwxr-xr-x 1 gitea gitea  478 Jun 12 09:36 applypatch-msg.sample*
-rwxr-xr-x 1 gitea gitea  896 Jun 12 09:36 commit-msg.sample*
-rwxr-xr-x 1 gitea gitea  303 Jun 12 09:36 post-receive*
drwxr-xr-x 2 gitea gitea 4,0K Jun 12 09:36 post-receive.d/
-rwxr-xr-x 1 gitea gitea  189 Jun 12 09:36 post-update.sample*
-rwxr-xr-x 1 gitea gitea  424 Jun 12 09:36 pre-applypatch.sample*
-rwxr-xr-x 1 gitea gitea 1,7K Jun 12 09:36 pre-commit.sample*
-rwxr-xr-x 1 gitea gitea 1,3K Jun 12 09:36 prepare-commit-msg.sample*
-rwxr-xr-x 1 gitea gitea 1,4K Jun 12 09:36 pre-push.sample*
-rwxr-xr-x 1 gitea gitea 4,8K Jun 12 09:36 pre-rebase.sample*
-rwxr-xr-x 1 gitea gitea  303 Jun 12 09:36 pre-receive*
drwxr-xr-x 2 gitea gitea 4,0K Jun 12 09:36 pre-receive.d/
-rwxr-xr-x 1 gitea gitea  283 Jun 12 09:36 update*
drwxr-xr-x 2 gitea gitea 4,0K Jun 12 09:36 update.d/
-rwxr-xr-x 1 gitea gitea 3,6K Jun 12 09:36 update.sample*

Deleting old-repo.git/hooks and rewriting hooks from the admin panel fixes the problem and recreates the hooks dir with the same permissions as newly created repositories (but the sample files do not get recreated).

ls -lah new-repo.git/hooks/
total 32K
drwxr-xr-x 5 gitea gitea 4,0K Jun 12 09:48 ./
drwxrwxr-x 8 gitea gitea 4,0K Jun 12 09:48 ../
-rwxr-xr-x 1 gitea gitea  303 Jun 12 09:48 post-receive*
drwxr-xr-x 2 gitea gitea 4,0K Jun 12 09:48 post-receive.d/
-rwxr-xr-x 1 gitea gitea  303 Jun 12 09:48 pre-receive*
drwxr-xr-x 2 gitea gitea 4,0K Jun 12 09:48 pre-receive.d/
-rwxr-xr-x 1 gitea gitea  283 Jun 12 09:48 update*
drwxr-xr-x 2 gitea gitea 4,0K Jun 12 09:48 update.d/
@tobias-- tobias-- changed the title Permissions for hooks inconsistent File permissions not being updated/checked on rewrite Jun 12, 2018
@stale
Copy link

stale bot commented Jan 24, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Jan 24, 2019
@stale
Copy link

stale bot commented Feb 18, 2019

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale stale bot closed this as completed Feb 18, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants