fix(compat): auditoría de stubs — los métodos que mentían dejan de mentir

Repaso de los 11 shims restantes buscando métodos que devolvían éxito
sin hacer el trabajo (como los dos setters de localed). Resultado:

timedated — tres setters arreglados de verdad:
- SetTime: aplica el reloj con clock_settime(CLOCK_REALTIME) en vez de
  sólo loggear; si falla (sin CAP_SYS_TIME) devuelve error honesto.
- SetLocalRTC: escribe la tercera línea de /etc/adjtime (UTC|LOCAL),
  conservando las dos primeras.
- SetNTP: arje no gestiona un daemon NTP — en vez de fingir éxito,
  rechaza honestamente; `CanNTP` pasa a `false` para que GNOME deje el
  toggle deshabilitado y ni llegue a llamarlo.

systemd1 — StopUnit/RestartUnit/KillUnit dejaban creer que habían
detenido la unit; ahora devuelven NotSupported honesto (como StartUnit).

Lo demás del repaso ya era honesto: resolved/machined devuelven
NotSupported de frente; polkit/tmpfiles/notify/binfmt/journald no
mienten. timer-compat queda como hueco conocido y autodocumentado (sus
timers disparan pero el spawn es un no-op a la espera del bus).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
sergio
2026-05-22 20:45:53 +00:00
parent 4bcdc88c83
commit a388ab14b7
4 changed files with 69 additions and 17 deletions
+16 -9
View File
@@ -143,15 +143,20 @@ impl SystemdManager {
}
async fn stop_unit(&self, name: String, _mode: String) -> fdo::Result<OwnedObjectPath> {
warn!(%name, "StopUnit (stub: TODO via bus capability)");
// TODO: bus → graph → kill PID por label. Por ahora no-op.
let path = ObjectPath::try_from("/").unwrap();
Ok(path.into())
// No se finge éxito: detener una Card por nombre de unit exige
// una capability del bus del fractal que aún no existe. Hasta
// entonces, se rechaza con honestidad (igual que StartUnit).
warn!(%name, "StopUnit rechazado — el fractal no detiene Cards por nombre de unit");
Err(fdo::Error::NotSupported(
"StopUnit: el fractal supervisa Cards; no se detienen por nombre de unit".into(),
))
}
async fn restart_unit(&self, name: String, mode: String) -> fdo::Result<OwnedObjectPath> {
info!(%name, "RestartUnit (delega a StopUnit)");
self.stop_unit(name, mode).await
async fn restart_unit(&self, name: String, _mode: String) -> fdo::Result<OwnedObjectPath> {
warn!(%name, "RestartUnit rechazado — sin StopUnit honesto no hay reinicio");
Err(fdo::Error::NotSupported(
"RestartUnit: el fractal no reinicia Cards por nombre de unit".into(),
))
}
async fn reload_unit(&self, name: String, _mode: String) -> fdo::Result<OwnedObjectPath> {
@@ -161,8 +166,10 @@ impl SystemdManager {
}
async fn kill_unit(&self, name: String, _who: String, _signal: i32) -> fdo::Result<()> {
warn!(%name, "KillUnit (stub)");
Ok(())
warn!(%name, "KillUnit rechazado — no implementado");
Err(fdo::Error::NotSupported(
"KillUnit: enviar señales a una Card por nombre de unit no está implementado".into(),
))
}
async fn subscribe(&self) -> fdo::Result<()> { Ok(()) }