The restart line names no part of a value; the new rows join existing tests (issue 1966, review round 1)
mesh/delivery merged: source.main moved to novox/mesh-host@9d8647aa0f56
mesh/check checking aa649d85a065 on 9d8647aa0f56
mesh/delivery merged: source.main moved to novox/mesh-host@9d8647aa0f56
mesh/check checking aa649d85a065 on 9d8647aa0f56
Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -562,8 +562,7 @@ func DaemonRoot() string { return daemonRoot }
|
||||
|
||||
// unitDifference names what differs between what a process's record says was written and what is wanted now, both
|
||||
// "sha256:<hex> <unit>": its bundle when the digest differs, and in the unit file each directive and each environment
|
||||
// word that differs, with inside a word the keys of a JSON object (and, one level down, of its objects) or the names of
|
||||
// the name=value entries of a list that differ. Names only, never a value, so a secret in a word is never said. Empty
|
||||
// word that differs, with inside a word the keys of a JSON object (and, one level down, of its objects) that differ. Names only, never a value, so a secret in a word is never said. Empty
|
||||
// when nothing differs or there was no record.
|
||||
func unitDifference(was, want string) string {
|
||||
if was == "" {
|
||||
@@ -630,40 +629,11 @@ func valueDifference(was, now string, depth int) string {
|
||||
if string(a[k]) == string(b[k]) {
|
||||
continue
|
||||
}
|
||||
inner := ""
|
||||
var x, y string
|
||||
if json.Unmarshal(a[k], &x) == nil && json.Unmarshal(b[k], &y) == nil {
|
||||
inner = valueDifference(x, y, 0)
|
||||
} else {
|
||||
inner = valueDifference(string(a[k]), string(b[k]), depth-1)
|
||||
}
|
||||
inner := valueDifference(string(a[k]), string(b[k]), depth-1)
|
||||
names = append(names, k+inner)
|
||||
}
|
||||
return " (" + strings.Join(names, ", ") + ")"
|
||||
}
|
||||
entries := func(list string) map[string]string {
|
||||
m := map[string]string{}
|
||||
for _, e := range strings.Split(list, ",") {
|
||||
if name, _, ok := strings.Cut(e, "="); ok {
|
||||
m[e] = name
|
||||
}
|
||||
}
|
||||
return m
|
||||
}
|
||||
before, after := entries(was), entries(now)
|
||||
named := map[string]bool{}
|
||||
for e, name := range before {
|
||||
if _, ok := after[e]; !ok {
|
||||
named[name] = true
|
||||
}
|
||||
}
|
||||
for e, name := range after {
|
||||
if _, ok := before[e]; !ok {
|
||||
named[name] = true
|
||||
}
|
||||
}
|
||||
if len(named) == 0 {
|
||||
return ""
|
||||
}
|
||||
return " (" + strings.Join(slices.Sorted(maps.Keys(named)), ", ") + ")"
|
||||
// Anything else is a value: said as differing, never split, since a name before an "=" in it can be a secret.
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user