Skip to content

dump-repo command is somewhat dangerous: removing the data directory if failed. #20191

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
wxiaoguang opened this issue Jul 1, 2022 · 1 comment · Fixed by #20205
Closed
Labels
issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP type/bug

Comments

@wxiaoguang
Copy link
Contributor

DumpRepository -> migrateRepository -> uploader.Rollback -> os.RemoveAll(g.baseDir)

If migrateRepository returns error, then the data directory is removed completely.

I have run gitea dump-repo in the gitea directory, then the Gitea's data directory (including sqlite database, repositories) is removed, all lost (luckily not on production).

@wxiaoguang wxiaoguang added type/bug issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP labels Jul 1, 2022
@a1012112796
Copy link
Member

a1012112796 commented Jul 2, 2022

looks it's beter make sure the repo_dir is empty or not exist before dump-repo

a1012112796 added a commit to a1012112796/gitea that referenced this issue Jul 2, 2022
or it looks dangerous ...

fix go-gitea#20191

Signed-off-by: a1012112796 <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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