paths: skip the user search tier when there is no home directory

ConfigSearchDirs/DataSearchDirs/ExecutableSearchDirs (and therefore
core/config's Resolve/ResolveAll/LoadMerged) failed outright with
ErrNoHomeDirectory when HOME/USERPROFILE was unset, so a service
started without HOME could no longer find its working-directory or
/etc/<app> config -- a regression against the hand-rolled lookups
being migrated onto core, which just skipped the user location.
Missing-home now only drops the user tier from the search lists; the
canonical <Category>Dir() methods still report ErrNoHomeDirectory.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-09-22 22:24:51 +02:00
1 parent 72b656262d
commit e8bf23a064
7 files changed
+220 -57

No files matched your search

+10 -7
View File
@@ -160,16 +160,19 @@ func (r *Resolver) darwinDesktopLayers(kind PathKind, base func(core.Scope, stri
if v, ok := r.overrideValue(kind); ok {
return []layer{{path: r.applyRoot(v.path), source: v.source, priority: PriorityUser, canonical: true}}, nil
}
var user []layer
home, err := r.homeDir()
if err != nil {
if err := skipMissingHome(err); err != nil {
return nil, err
}
user := []layer{{
path: r.applyRoot(unixJoin(base(core.UserScope, home), r.app.Name)),
source: MacOSNative,
priority: PriorityUser,
canonical: true,
}}
if err == nil {
user = []layer{{
path: r.applyRoot(unixJoin(base(core.UserScope, home), r.app.Name)),
source: MacOSNative,
priority: PriorityUser,
canonical: true,
}}
}
system := []layer{{
path: r.applyRoot(unixJoin(base(core.SystemScope, ""), r.app.Name)),
source: SystemDirectory,