Skip to content
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

Found a way to break all repositories inside a gitea instance #26264

Closed
ghost opened this issue Aug 1, 2023 · 5 comments · Fixed by #26271
Closed

Found a way to break all repositories inside a gitea instance #26264

ghost opened this issue Aug 1, 2023 · 5 comments · Fixed by #26271
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP type/bug

Comments

@ghost
Copy link

ghost commented Aug 1, 2023

Description

The task "Delete all repositories' archives (ZIP, TAR.GZ, etc..)" corrupts all git repositories.
One of the deleted files are the HEAD files at the root of one repository.
I send the screenshot of the error message of the ui

Gitea Version

1.20.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

image

Git Version

No response

Operating System

No response

How are you running Gitea?

It is running from the official docker image

Database

MySQL

@ghost ghost added the type/bug label Aug 1, 2023
@CaiCandong
Copy link
Member

Please tell me how to reproduce this problem, I tried "Delete all repositories' archives (ZIP, TAR.GZ, etc...)" . There is no problem as you said.
image

@ghost
Copy link
Author

ghost commented Aug 1, 2023

I did exact the same step but I got the issue.
I don't know yet how to reproduce the problem.
There are no error messages in the logs.

@wxiaoguang
Copy link
Contributor

What's your app.ini? Especially the storage path related options.

@ghost
Copy link
Author

ghost commented Aug 1, 2023

Here is all the parts of the app.ini file, which have a path.

WORK_PATH = /data/gitea
[repository]
ROOT = /data/git/repositories
[repository.local]
LOCAL_COPY_PATH = /data/gitea/tmp/local-repo

[repository.upload]
TEMP_PATH = /data/gitea/uploads

[server]
APP_DATA_PATH = /data/gitea

[storage]
STORAGE_TYPE = local
PATH = /data/git

[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve

[session]
PROVIDER_CONFIG = /data/gitea/sessions
PROVIDER = file

[picture]
AVATAR_UPLOAD_PATH = /data/gitea/avatars
REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars

[attachment]
PATH = /data/gitea/attachments

[log]
ROOT_PATH = /data/gitea/log
MODE = file

Would that help?

@wxiaoguang
Copy link
Contributor

The problem is

[storage]
STORAGE_TYPE = local
PATH = /data/git

The INI package has a quirk behavior: the path is inherited, so storage.repo-archive also uses path /data/git

Then everything is removed under the /data/git

Related to : Fix all possible setting error related storages and added some tests (#23911)

@lunny

@wxiaoguang wxiaoguang added issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented labels Aug 1, 2023
lunny added a commit that referenced this issue Aug 4, 2023
This PR will fix #26264, caused by #23911.

The package configuration derive is totally wrong when storage type is
local in that PR.

This PR fixed the inherit logic when storage type is local with some
unit tests.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Aug 4, 2023
This PR will fix go-gitea#26264, caused by go-gitea#23911.

The package configuration derive is totally wrong when storage type is
local in that PR.

This PR fixed the inherit logic when storage type is local with some
unit tests.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
KN4CK3R pushed a commit that referenced this issue Aug 4, 2023
Backport #26271 by @lunny

This PR will fix #26264, caused by #23911.

The package configuration derive is totally wrong when storage type is
local in that PR.

This PR fixed the inherit logic when storage type is local with some
unit tests.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants