gogs/gogs

gogs restore report: The system cannot move the file to a different disk drive. It's caused by 'rename' file to a different disk drive on Windows Server 2019.

lliding opened this issue · 0 comments

Gogs version

0.13.0

Git version

  • Server: 2.44.0
  • Client: 2.44.0

Operating system

Windows Server 2019

Database

SQLite 3

Describe the bug

I run gogs.exe at D:\gogs, and create a backup.zip file. It works fine.

But when I try gogs.exe restore I get 'The system cannot move the file to a different disk drive'. It seems gogs.exe creates some files to my HOME PATH (on C:), and 'rename' these files to D:\gogs.

PS D:\gogs> .\gogs.exe backup
2024/05/18 22:33:42 [ INFO] Backup root directory: C:\Users\ld\AppData\Local\Temp\2\gogs-backup-2869618201
2024/05/18 22:33:42 [ INFO] Packing backup files to: gogs-backup-20240518223342.zip
2024/05/18 22:33:42 [ INFO] Dumping repositories in "D:\\gogs\\gogs-repositories"
2024/05/18 22:33:44 [ INFO] Repositories dumped to: C:\Users\ld\AppData\Local\Temp\2\gogs-backup-2869618201\repositories.zip
2024/05/18 22:33:45 [ INFO] Backup succeed! Archive is located at: gogs-backup-20240518223342.zip
PS D:\gogs> .\gogs.exe restore --from="d:\gogs\gogs-backup-20240518223342.zip"
2024/05/18 22:34:05 [ INFO] Restoring backup from: d:\gogs\gogs-backup-20240518223342.zip
2024/05/18 22:34:06 [FATAL] [....io/gogs/internal/cmd/restore.go:130 runRestore()] Failed to import 'custom': rename C:\Users\ld\AppData\Local\Temp\2\gogs-backup\custom D:\gogs\custom: The system cannot move the file to a different disk drive.
PS D:\gogs>

To reproduce

Run gogs.exe at D:\gogs
Create a backup.zip by 'gogs.exe backup'
Restore backup.zip by 'gogs.exe restore --from="D:\gogs\backup.zip"'

PS D:\gogs> .\gogs.exe backup
2024/05/18 22:33:42 [ INFO] Backup root directory: C:\Users\ld\AppData\Local\Temp\2\gogs-backup-2869618201
2024/05/18 22:33:42 [ INFO] Packing backup files to: gogs-backup-20240518223342.zip
2024/05/18 22:33:42 [ INFO] Dumping repositories in "D:\\gogs\\gogs-repositories"
2024/05/18 22:33:44 [ INFO] Repositories dumped to: C:\Users\ld\AppData\Local\Temp\2\gogs-backup-2869618201\repositories.zip
2024/05/18 22:33:45 [ INFO] Backup succeed! Archive is located at: gogs-backup-20240518223342.zip
PS D:\gogs> .\gogs.exe restore --from="d:\gogs\gogs-backup-20240518223342.zip"
2024/05/18 22:34:05 [ INFO] Restoring backup from: d:\gogs\gogs-backup-20240518223342.zip
2024/05/18 22:34:06 [FATAL] [....io/gogs/internal/cmd/restore.go:130 runRestore()] Failed to import 'custom': rename C:\Users\ld\AppData\Local\Temp\2\gogs-backup\custom D:\gogs\custom: The system cannot move the file to a different disk drive.
PS D:\gogs>

Expected behavior

Data on backup.zip should be restored.

Additional context

No response

Code of Conduct

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