From 9ed1af2bd1638038033b774c17fd173dc089078a Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 22 Apr 2026 00:21:00 +0200 Subject: [PATCH] vmspawn-varlink: treat empty event subscription filter as catch-all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A client supplying "filter": [] previously matched no events at all, because filter is checked with strv_contains() — an unintuitive corner case. Treat an empty filter strv identically to a NULL filter (deliver all events) by freeing the empty strv before it lands in the subscription map. Brings the API closer to least-surprise. Signed-off-by: Christian Brauner (Amutable) --- src/vmspawn/vmspawn-varlink.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vmspawn/vmspawn-varlink.c b/src/vmspawn/vmspawn-varlink.c index d9beb5bfe3..8df234a9bb 100644 --- a/src/vmspawn/vmspawn-varlink.c +++ b/src/vmspawn/vmspawn-varlink.c @@ -159,6 +159,10 @@ static int vl_method_subscribe_events(sd_varlink *link, sd_json_variant *paramet if (r != 0) return r; + /* Treat [] identically to null: deliver all events. */ + if (strv_isempty(filter)) + filter = strv_free(filter); + sd_varlink_ref(link); r = hashmap_ensure_put(&ctx->subscribed, &varlink_subscriber_hash_ops, link, filter);