[BUG] If there is a file in [repository]ROOT, that is name same as folder, error 500 is displayed #6231

Closed
opened 2025-11-02 06:49:14 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @Torstein-Eide on GitHub (Oct 31, 2020).

  • Gitea version (or commit ref):
  • Git version: 2.27.0
  • Operating system: Ubuntu 20.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • need SSH access to do that.
  • Log gist:

Description

If there is a file named the same as a user or Organisation, html 500 is displayed.

steps to reproduce:

  1. make a file named test
  2. add a user named test
  3. make a repository, this will fail.
  4. remove file
  5. now it shroud work.

Screenshots

┌─[root@server2][/volum1/@gitREP]
└──╼ #ll
total 70M
drwxr-x--- 1 git  git   182 07-03 00:23 .
drwxr-xr-x 1 root root  356 2020-04-26  ..
-rwxr-x--- 1 git  git  175K 2019-10-13  1
drwxr-xr-x 1 git  git    18 07-12 11:46 andre
-rwxr-x--- 1 git  git  2.3K 2019-10-15  .bash_history
-rwxr-x--- 1 git  git    73 2019-10-15  .gitconfig
-rwxr-x--- 1 git  git   69M 2019-05-08  gitea
drwxr-x--- 1 git  git     0 2018-12-02  lfs
-rwxr-x--- 1 git  git     0 2019-05-23  .mysql_history
drwxr-x--- 1 git  git   308 2019-10-13  .snapshots
drwxr-x--- 1 git  git     0 2019-05-23  .ssh 
-rwxr-x--- 1 git  git     0 2019-05-23  test 
┌─[root@server2][/volum1/@gitREP]
└──╼ #rm test 
┌─[root@server2][/volum1/@gitREP]
└──╼ #ll
total 70M
drwxr-x--- 1 git  git   174 10-31 19:43 .
drwxr-xr-x 1 root root  356 2020-04-26  ..
-rwxr-x--- 1 git  git  175K 2019-10-13  1
drwxr-xr-x 1 git  git    18 07-12 11:46 andre
-rwxr-x--- 1 git  git  2.3K 2019-10-15  .bash_history
-rwxr-x--- 1 git  git    73 2019-10-15  .gitconfig
-rwxr-x--- 1 git  git   69M 2019-05-08  gitea
drwxr-x--- 1 git  git     0 2018-12-02  lfs
-rwxr-x--- 1 git  git     0 2019-05-23  .mysql_history
drwxr-x--- 1 git  git   308 2019-10-13  .snapshots
drwxr-x--- 1 git  git     0 2019-05-23  .ssh 
┌─[root@server2][/volum1/@gitREP]
└──╼ #ll
total 70M
drwxr-x--- 1 git  git   182 10-31 19:43 .
drwxr-xr-x 1 root root  356 2020-04-26  ..
-rwxr-x--- 1 git  git  175K 2019-10-13  1
drwxr-xr-x 1 git  git    18 07-12 11:46 andre
-rwxr-x--- 1 git  git  2.3K 2019-10-15  .bash_history
-rwxr-x--- 1 git  git    73 2019-10-15  .gitconfig
-rwxr-x--- 1 git  git   69M 2019-05-08  gitea
drwxr-x--- 1 git  git     0 2018-12-02  lfs
-rwxr-x--- 1 git  git     0 2019-05-23  .mysql_history
drwxr-x--- 1 git  git   308 2019-10-13  .snapshots
drwxr-x--- 1 git  git     0 2019-05-23  .ssh 
drwxr-xr-x 1 git  git    16 10-31 19:43 test 
Originally created by @Torstein-Eide on GitHub (Oct 31, 2020). - Gitea version (or commit ref): - Git version: 2.27.0 - Operating system: Ubuntu 20.04 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [X] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [X] No - need SSH access to do that. - Log gist: ## Description If there is a file named the same as a user or Organisation, html 500 is displayed. steps to reproduce: 1. make a file named `test` 2. add a user named `test` 3. make a repository, this will fail. 4. remove file 5. now it shroud work. ## Screenshots ````bash ┌─[root@server2]─[/volum1/@gitREP] └──╼ #ll total 70M drwxr-x--- 1 git git 182 07-03 00:23 . drwxr-xr-x 1 root root 356 2020-04-26 .. -rwxr-x--- 1 git git 175K 2019-10-13 1 drwxr-xr-x 1 git git 18 07-12 11:46 andre -rwxr-x--- 1 git git 2.3K 2019-10-15 .bash_history -rwxr-x--- 1 git git 73 2019-10-15 .gitconfig -rwxr-x--- 1 git git 69M 2019-05-08 gitea drwxr-x--- 1 git git 0 2018-12-02 lfs -rwxr-x--- 1 git git 0 2019-05-23 .mysql_history drwxr-x--- 1 git git 308 2019-10-13 .snapshots drwxr-x--- 1 git git 0 2019-05-23 .ssh -rwxr-x--- 1 git git 0 2019-05-23 test ┌─[root@server2]─[/volum1/@gitREP] └──╼ #rm test ┌─[root@server2]─[/volum1/@gitREP] └──╼ #ll total 70M drwxr-x--- 1 git git 174 10-31 19:43 . drwxr-xr-x 1 root root 356 2020-04-26 .. -rwxr-x--- 1 git git 175K 2019-10-13 1 drwxr-xr-x 1 git git 18 07-12 11:46 andre -rwxr-x--- 1 git git 2.3K 2019-10-15 .bash_history -rwxr-x--- 1 git git 73 2019-10-15 .gitconfig -rwxr-x--- 1 git git 69M 2019-05-08 gitea drwxr-x--- 1 git git 0 2018-12-02 lfs -rwxr-x--- 1 git git 0 2019-05-23 .mysql_history drwxr-x--- 1 git git 308 2019-10-13 .snapshots drwxr-x--- 1 git git 0 2019-05-23 .ssh ┌─[root@server2]─[/volum1/@gitREP] └──╼ #ll total 70M drwxr-x--- 1 git git 182 10-31 19:43 . drwxr-xr-x 1 root root 356 2020-04-26 .. -rwxr-x--- 1 git git 175K 2019-10-13 1 drwxr-xr-x 1 git git 18 07-12 11:46 andre -rwxr-x--- 1 git git 2.3K 2019-10-15 .bash_history -rwxr-x--- 1 git git 73 2019-10-15 .gitconfig -rwxr-x--- 1 git git 69M 2019-05-08 gitea drwxr-x--- 1 git git 0 2018-12-02 lfs -rwxr-x--- 1 git git 0 2019-05-23 .mysql_history drwxr-x--- 1 git git 308 2019-10-13 .snapshots drwxr-x--- 1 git git 0 2019-05-23 .ssh drwxr-xr-x 1 git git 16 10-31 19:43 test ````
Author
Owner

@jolheiser commented on GitHub (Oct 31, 2020):

I'd assume there's a better error on the log, but regardless I wouldn't consider this a bug.

Repository root is where Gitea stores all of its repository data, so mixing it with a user's home directory (or any other directory that's not solely used for this data) is a very unadvisable setup.

@jolheiser commented on GitHub (Oct 31, 2020): I'd assume there's a better error on the log, but regardless I wouldn't consider this a bug. Repository root is where Gitea stores all of its repository data, so mixing it with a user's home directory (or _any_ other directory that's not solely used for this data) is a very unadvisable setup.
Author
Owner

@zeripath commented on GitHub (Oct 31, 2020):

Yeah this is the definition an internal server error.

Gitea must be the only thing that writes in its repository root.

On 1.13 Gitea can adopt repositories if they're in the right place e.g. owner/reponame.git but it cannot be expected to workaround files where there should be directories.


I would also note that we ask very kindly that you at least indicate a version that you have found issues in and provide logs. AFAIK none of us are paid to work on Gitea and we do this using our freetime - expecting us to hunt around to replicate issues without logs is not fair.

@zeripath commented on GitHub (Oct 31, 2020): Yeah this is the definition an internal server error. Gitea must be the only thing that writes in its repository root. On 1.13 Gitea can adopt repositories if they're in the right place e.g. owner/reponame.git but it cannot be expected to workaround files where there should be directories. --- I would also note that we ask very kindly that you at least indicate a version that you have found issues in and provide logs. AFAIK none of us are paid to work on Gitea and we do this using our freetime - expecting us to hunt around to replicate issues without logs is not fair.
Author
Owner

@Torstein-Eide commented on GitHub (Oct 31, 2020):

  • gitea version: 1.12.4 built with GNU Make 4.1, go1.14.8 : bindata, sqlite, sqlite_unlock_notify

Log from event:

2020/10/31 19:42:34 ...repository/create.go:52:func1() [E] initRepository: git.InitRepository: mkdir /volum1/@gitREP/test: not a directory
2020/10/31 19:42:34 ...sitory/repository.go:23:CreateRepository() [E] Rollback deleteRepository: repository does not exist [id: 44, uid: 4, owner_name: , name: ]
2020/10/31 19:42:34 routers/repo/repo.go:176:handleCreateError() [E] CreatePost: delete repo directory Test/test failed(2): unlinkat /volum1/@gitREP/test/test.git: not a directory

I am guessing i make the file to verify that the git user were able had access.

@Torstein-Eide commented on GitHub (Oct 31, 2020): - gitea version: 1.12.4 built with GNU Make 4.1, go1.14.8 : bindata, sqlite, sqlite_unlock_notify Log from event: ```` 2020/10/31 19:42:34 ...repository/create.go:52:func1() [E] initRepository: git.InitRepository: mkdir /volum1/@gitREP/test: not a directory 2020/10/31 19:42:34 ...sitory/repository.go:23:CreateRepository() [E] Rollback deleteRepository: repository does not exist [id: 44, uid: 4, owner_name: , name: ] 2020/10/31 19:42:34 routers/repo/repo.go:176:handleCreateError() [E] CreatePost: delete repo directory Test/test failed(2): unlinkat /volum1/@gitREP/test/test.git: not a directory ```` I am guessing i make the file to verify that the `git` user were able had access.
Author
Owner

@cndoit18 commented on GitHub (Apr 29, 2021):

I'd assume there's a better error on the log, but regardless I wouldn't consider this a bug.

Repository root is where Gitea stores all of its repository data, so mixing it with a user's home directory (or any other directory that's not solely used for this data) is a very unadvisable setup.

I think so too.

@cndoit18 commented on GitHub (Apr 29, 2021): > I'd assume there's a better error on the log, but regardless I wouldn't consider this a bug. > > Repository root is where Gitea stores all of its repository data, so mixing it with a user's home directory (or _any_ other directory that's not solely used for this data) is a very unadvisable setup. I think so too.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6231