gogs/gogs

Backing up fails due to a missing file

doadam opened this issue · 1 comments

Gogs version

0.13.0

Git version

  • Server: 2.38.4
  • Client: 2.41.0

Operating system

Pop!_OS 20.04 LTS

Database

sqlite3

Describe the bug

When backing up, the entire process fails because the /data/gogs/log/xorm.log is missing. It is created when the backup is being initiated, then at some points it gets removed, only to end up failing:

$ docker exec gogs /bin/bash -c 'export USER=git && /app/gogs/gogs backup --target /data/backups/'
2024/03/16 16:18:47 [ INFO] Backup root directory: /tmp/gogs-backup-845024120
2024/03/16 16:18:47 [ INFO] Packing backup files to: /data/backups/gogs-backup-20240316161847.zip
2024/03/16 16:18:47 [TRACE] Skipping "data" directory in custom directory
2024/03/16 16:18:47 [ INFO] Dumping repositories in "/home/git/gogs-repositories"
2024/03/16 16:19:18 [ INFO] Repositories dumped to: /tmp/gogs-backup-845024120/repositories.zip
2024/03/16 16:19:18 [FATAL] [...s.io/gogs/internal/cmd/backup.go:161 runBackup()] Failed to save backup archive '/data/backups/gogs-backup-20240316161847.zip': lstat /data/gogs/log/xorm.log: no such file or directory

If I repeatedly try to touch this file while the backup process is running, then at some point, after the file is removed, it will be created again and the backup process will succeed.

To reproduce

Just run the following command:

docker exec gogs /bin/bash -c 'export USER=git && /app/gogs/gogs backup --target /data/backups/'

This assumes your docker container for gogs is called gogs

Expected behavior

The backup process shouldn't fatally exit because of that missing file.
I think the backup process creates a list of all the files it needs to back up, then this file gets removed but is being marked for backup. As it doesn't exist, the process fails.

I believe this file should not be removed when the backup process is being initiated.

Additional context

My OS (Pop OS) is just another Linux distro.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Apparently, there was an external process that deleted this file every minute.
Sorry for the noob post