systemd-resolved: the names file write refuses naming its bound on the deadline (review r2 (3))

Past WriteUplinkNamesBound (15 s) the refusal read the bare signal the
deadline killed the process with ("install failed: signal: killed"); it
now names the bound and says the file was left as it was, for either
step (install or mv).

Builds: design 08 sign-in-page §6, C-8
This commit is contained in:
jochen
2026-11-25 01:18:09 +01:00
parent d859380669
commit ac50980ba1
2 changed files with 24 additions and 2 deletions
@@ -579,13 +579,23 @@ func (r *Resolver) writeUplinkNamesFile(ctx context.Context, content []byte) err
var stderr bytes.Buffer
cmd.Stderr = &stderr
if err := cmd.Run(); err != nil {
// Past the bound, name it and say the file was left as it was (review r2 (3)), never the bare
// signal the deadline killed the process with.
if ctx.Err() == context.DeadlineExceeded {
return fmt.Errorf("the names file's write did not finish within %s; it was left as it was", WriteUplinkNamesBound)
}
if said := strings.TrimSpace(stderr.String()); said != "" {
return fmt.Errorf("install: %s", said)
}
return fmt.Errorf("install failed: %w", err)
}
_, err := r.Change(ctx, "mv", "-f", newPath, r.UplinkNamesFile)
return err
if _, err := r.Change(ctx, "mv", "-f", newPath, r.UplinkNamesFile); err != nil {
if ctx.Err() == context.DeadlineExceeded {
return fmt.Errorf("the names file's write did not finish within %s; it was left as it was", WriteUplinkNamesBound)
}
return err
}
return nil
}
// SetUplinkNames writes the host names the uplink's holder gives for its network's own check, through