Repository navigation
Commit 30a6e28
committed
scx_loader: log the selected configuration source
get_config_path() checks four locations in a fixed order and the first
existing file wins - including a file that parses to an empty
configuration, which silently shadows every path after it. Nothing in
the logs says which file was selected, or that none was found and the
built-in defaults took over.
That silence has a sharp edge: with the shipped defaults mirrored in a
vendor config file, a shadowed setup is behaviorally indistinguishable
from a working one right up until the first divergent setting - say,
enabling the power-profiles integration in a file the loader never
reads - which then fails as a silent no-op with nothing to grep for.
Diagnosing it today means reasoning backwards from scheduler flags to
which file could have produced them, and when the candidate files
agree, even that is inconclusive.
Log one line at startup naming the selected config file, or stating
that no file was found and the built-in defaults are in use. The
logger is initialized before init_config() runs, so the line lands in
the journal, and "which file rules this daemon" becomes the first
line of journalctl output instead of an archaeology exercise.
The line is deliberately emitted before parsing rather than after:
the parse error chain does not carry the file name (neither the io
error from read_to_string nor the toml error names the path), so on
invalid TOML the last line in the journal before the failure is the
one naming the file being parsed. "Selected" is also the honest verb
for that placement - a file that fails to parse was chosen but never
took effect.
get_config_path() returns Err in exactly one case - no candidate path
exists - so the fallback message is precisely as categorical as the
code. Path::exists() swallows IO errors (an unstattable file counts
as absent), but that is the search's own semantics: such a file is
skipped by the loader too, so "found" consistently means "visible to
the loader".
Signed-off-by: Piotr Gorski <lucjan.lucjanov@gmail.com>1 parent d598921 commit 30a6e28
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
0 commit comments