fix: chown migrated legacy storage entries to dokku

`SaveEntry` and `touchMigrationFlag` wrote files via `os.WriteFile` and `os.Create` and never chowned them, so the install-time legacy-mount migration produced root-owned `legacy-*.json` files in `/var/lib/dokku/data/storage-registry/entries/`. The dokku user that runs `ps:rebuild` could not read them and every rebuild on a 0.37.x to 0.38.0 upgrade failed with permission denied. The companion `repairRegistryOwnership` pass in `TriggerInstall` rewrites ownership across the whole registry tree so installs that already ran the buggy code are fixed on the next package upgrade, since the per-app migration flag would otherwise cause `MigrateLegacyMounts` to skip the broken files forever.
This commit is contained in:
Jose Diaz-Gonzalez
2026-05-02 05:37:11 -04:00
parent cdfcd4d2c8
commit 179d09fdd5
7 changed files with 168 additions and 24 deletions

View File

@@ -168,11 +168,7 @@ func migrateMount(appName string, mount string, phases []string) error {
}
func touchMigrationFlag(appName string) error {
f, err := os.Create(migrationFlagFile(appName))
if err != nil {
return err
}
return f.Close()
return common.TouchFile(migrationFlagFile(appName))
}
func filterMountLines(lines []string) []string {