File permissions not being updated/checked on rewrite #1925

Closed
opened 2025-11-02 04:18:00 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @tobias-- on GitHub (Jun 12, 2018).

  • Gitea version (or commit ref): 1.4.2
  • Git version:
  • Operating system: Linux ecm07 4.4.0-127-generic #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/
Originally created by @tobias-- on GitHub (Jun 12, 2018). - Gitea version (or commit ref): 1.4.2 - Git version: - Operating system: Linux ecm07 4.4.0-127-generic #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 - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] 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/ ````
GiteaMirror added the issue/staletype/bug labels 2025-11-02 04:18:00 -06:00
Author
Owner

@stale[bot] commented on GitHub (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[bot] commented on GitHub (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.
Author
Owner

@stale[bot] commented on GitHub (Feb 18, 2019):

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

@stale[bot] commented on GitHub (Feb 18, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1925