zypperd experiment

note: vibe-coded, use as inspiration, needs review + testing before real-world use

##Summary
Result: zypper info bash 726 ms → 40 ms (18×, −95%) with stock libzypp, output byte-identical to stock zypper across an 18-case matrix (--xmlout, -q, de_DE locale, exit codes, Ctrl-C).

How it works — reliability first, as requested:

zypperd (new binary linking the existing zypper_lib) loads the pool once using libzypp's readonly hack (never takes the zypp lock, so normal zypper/PackageKit run unaffected), then forks per request: each worker inherits the pool copy-on-write and runs the completely stock Zypper::main() pipeline — no state-reset bugs, worker crashes contained.
zypperc is plain C (libc only, ~1 ms overhead): it passes its argv plus its real stdin/stdout/stderr via SCM_RIGHTS, so isatty/width/colors/prompts are indistinguishable from direct zypper, and Ctrl-C forwards to the worker (verified: graceful stop, rc 105). On any failure before the daemon's "started" frame it silently execs /usr/bin/zypper — a dead daemon costs you stock speed, never a failure.
Never stale data: before each fork the daemon stats rpmdb + repos.d + services.d + solv cookies. rpmdb change → parent Target::reload() (verified live with a package install and removal); repo metadata change → decline + re-exec (0.7 s rewarm of 114k solvables, verified).
Write permissions for root: socket is 0666, but mutating commands need peer uid 0 via SO_PEERCRED — the worker then execs the real zypper (real lock, real prompts on your tty). The netcat bonus works: printf "info bash\n" | nc -U /run/zypperd/zypperd.sock streams output plus a ### exit 0 trailer, read-only commands only.
Bonus find: a genuine libzypp bug — a forked child exiting via exit() (zypper's SIGPIPE path, e.g. zypperc info bash | head) hangs forever in ~LogThread joining the parent-only log thread. Fixed on the libzypp branch (detach when getpid() differs); upstream-worthy since it bites any forking libzypp consumer.

Where everything lives:

zypper repo branch zypperd (off tag 1.14.98): 3 commits (daemon / client / systemd units, socket-activated without a libsystemd dep)
libzypp repo branch zypperd (off 17.38.14): the fork-safety fix
OBS home:bmwiedemann:zypperd rev 2: zypper (Patch1–3, new zypperd subpackage) + libzypp (Patch1) — all green on Tumbleweed i586 + x86_64
zypperd-design.md — design/results doc (left uncommitted in the outer repo for your review)
To try it on a real system: install the zypperd RPM from the project, systemctl enable --now zypperd.socket, then zypperc info bash. Locally the daemon still runs as your user via zypperd --socket /tmp/zd.sock (test harness: ~/.cache/zdtest-diff.sh). The residual 40 ms is child-side option parsing + Augeas zypper.conf + repos.d re-read — cacheable parent-side if you ever want to chase it, and combining with your pool-snapshot patches would cut the re-exec rewarm from ~0.7 s to ~0.2 s.

Name Changed
Comments 0
No comments available
openSUSE Build Service is sponsored by