mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
fix: triage the unwritable config dir remedy by cause
The chown hint is only correct when another account created files inside the current user's own home. When a leaked HOME or XDG_CONFIG_HOME points at another user's home (e.g. sudo -u on GitHub runners), following it would chown that user's directory and brick their pmg instead. Classify the failure against the passwd home, which the leaked environment cannot influence, and prescribe: - dir inside own home: restore ownership with chown - dir outside own home: fix the leaked environment, never chown - explicit PMG_CONFIG_DIR: make it writable Used by both the fatal event-log error and the doctor check, and the docs troubleshooting now carries the same two-case triage.
This commit is contained in:
@@ -229,7 +229,7 @@ func eventlogInitError(err error) error {
|
||||
return usefulerror.NewUsefulError().
|
||||
WithCode(errcodes.PermissionDenied).
|
||||
WithHumanError("event logging is required but its directory is not writable").
|
||||
WithHelp(fmt.Sprintf("If a root or sudo run created it, restore ownership: sudo chown -R $(id -un) %s", config.Get().ConfigDir())).
|
||||
WithHelp(config.UnwritableConfigDirRemedy(config.Get().ConfigDir())).
|
||||
Wrap(err)
|
||||
}
|
||||
return usefulerror.NewUsefulError().
|
||||
|
||||
Reference in New Issue
Block a user