From nobody Tue Sep 9 03:17:50 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1746517746; cv=none; d=zohomail.com; s=zohoarc; b=B+Tr/evE9rEjk71TduDGzb9dtFrgSWRq53ZVnL2x+u3OtXMgq84qd5tSRdG0sCtpzI4nf7x9eswsbmI7k0BJIY5815n5fNvnh50dqe4rE7cPcrtViz/WlxuADa/V7bbiwGWlGxh7bF2uXPm5y/2yD3Pjf7u3m0JSwjwqaYPHJPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746517746; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=8OzppBwrodN0ENQlA9knMoeLrcGtlBSZLNiiuptBLTk=; b=k5i487kPHRJMVu/EqlYixpr2Hvj2MdMLDfFx5MYl5WXZSZAhJL+Dv4c7gY/reJpD8uV91SxBF4irdwADjboBRP8vFVRFYACeOJcRJn+VILERCkRjZutfQObVTrrMKN+YvYLy8Uu2va2oSOPESj6Pv3hJU257Jq2n6F6ZWabNQsk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1746517746387418.410337813246; Tue, 6 May 2025 00:49:06 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CF54714E9; Tue, 6 May 2025 03:49:05 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 75D841443; Tue, 6 May 2025 03:47:49 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C4D851387; Mon, 5 May 2025 17:20:31 -0400 (EDT) Received: from mr6.vodafonemail.de (mr6.vodafonemail.de [145.253.228.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CB18A1388 for ; Mon, 5 May 2025 17:20:30 -0400 (EDT) Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr6.vodafonemail.de (Postfix) with ESMTPS id 4ZrvMN3831z1xxd for ; Mon, 5 May 2025 21:10:56 +0000 (UTC) Received: from sappc2.fritz.box (port-83-236-39-172.dynamic.as20676.net [83.236.39.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.vodafone.de (Postfix) with ESMTPSA id 4ZrvMD6yy4z8slq; Mon, 5 May 2025 21:10:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-23sep; t=1746479456; bh=A5yoHpHZDwlEmSVRR7psRhkdd4rlrvNu1+4FTMIcv2c=; h=From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References: From; b=kHBRspoCSLI3Ps94y7+aVOT7DbNXX1TJ6aFohPLCiCCM1zZTUiwwbu/Xr8gFOr8Sp wWrvCfuLA95CukrCNGfivOnN3Hral0FMf6mCs5pOb9ns0YBRiUiKTL9oQcs+SXJap2 VldSRGZAPZ4oFKU0YlHV3Pw6+Fb1+dIkAlxWAT+g= To: devel@lists.libvirt.org Subject: [PATCH 1/1] virsh: Add option '--no-pkttyagent' Date: Mon, 5 May 2025 23:09:52 +0200 Message-Id: <20250505210952.136120-2-farblos@vodafonemail.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250505210952.136120-1-farblos@vodafonemail.de> References: <20250505210952.136120-1-farblos@vodafonemail.de> MIME-Version: 1.0 X-purgate-server: smtpa06 X-purgate-type: clean X-purgate: clean X-purgate-size: 3944 X-purgate-ID: 155817::1746479452-A6C7928F-36C4DF81/0/0 Content-Transfer-Encoding: quoted-printable X-MailFrom: farblos@vodafonemail.de X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 Message-ID-Hash: 7PD43EDB7JUBLYVOMTBN3Z624FENZYYC X-Message-ID-Hash: 7PD43EDB7JUBLYVOMTBN3Z624FENZYYC X-Mailman-Approved-At: Tue, 06 May 2025 07:47:44 -0400 CC: Jens Schmidt X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Jens Schmidt via Devel Reply-To: Jens Schmidt X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1746517748001019000 Content-Type: text/plain; charset="utf-8" In scripts repeated execution of virsh can result in a lot of journal noise when pkttyagent gets registered with polkitd each time. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/757 Reviewed-by: Peter Krempa --- NEWS.rst | 4 ++++ docs/manpages/virsh.rst | 8 ++++++++ tools/virsh.c | 13 ++++++++++++- tools/vsh.h | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/NEWS.rst b/NEWS.rst index ad8910da4c..12ef87bfce 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -17,6 +17,10 @@ v11.4.0 (unreleased) =20 * **New features** =20 + * virsh: Add option ``--no-pkttyagent`` + + That option suppresses registration of pkttyagent with polkitd. + * **Improvements** =20 * **Bug fixes** diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index cef9959f16..f2fac0acad 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -140,6 +140,14 @@ Output elapsed time information for each command. =20 =20 =20 +- ``--no-pkttyagent`` + +Do not register ``pkttyagent`` as authentication agent with the +polkit system daemon, even if ``virsh`` has been started from a +terminal. + + + - ``-v``, ``--version[=3Dshort]`` =20 Ignore all other arguments, and prints the version of the libvirt library diff --git a/tools/virsh.c b/tools/virsh.c index 800e280c7a..6ae650ec89 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -21,6 +21,7 @@ #include #include "virsh.h" =20 +#include #include #include #include @@ -117,7 +118,8 @@ virshConnect(vshControl *ctl, const char *uri, bool rea= donly) keepalive_forced =3D true; } =20 - if (virPolkitAgentAvailable() && + if (!ctl->no_pkttyagent && + virPolkitAgentAvailable() && !(pkagent =3D virPolkitAgentCreate())) virResetLastError(); =20 @@ -446,6 +448,7 @@ virshUsage(void) " -q | --quiet quiet mode\n" " -r | --readonly connect readonly\n" " -t | --timing print timing informatio= n\n" + " --no-pkttyagent suppress registration o= f pkttyagent\n" " -v short version\n" " -V long version\n" " --version[=3DTYPE] version, TYPE is shor= t or long (default short)\n" @@ -642,6 +645,7 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) { "quiet", no_argument, NULL, 'q' }, { "readonly", no_argument, NULL, 'r' }, { "timing", no_argument, NULL, 't' }, + { "no-pkttyagent", no_argument, NULL, 0 }, { "version", optional_argument, NULL, 'v' }, { NULL, 0, NULL, 0 }, }; @@ -739,6 +743,13 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) case 'V': virshShowVersion(ctl); exit(EXIT_SUCCESS); + case 0: + if (STREQ(opt[longindex].name, "no-pkttyagent")) { + ctl->no_pkttyagent =3D true; + break; + } else { + assert(false); + } case ':': for (i =3D 0; opt[i].name !=3D NULL; i++) { if (opt[i].val =3D=3D optopt) diff --git a/tools/vsh.h b/tools/vsh.h index 8b87c00ff4..3b75216e11 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -200,6 +200,7 @@ struct _vshControl { bool imode; /* interactive mode? */ bool quiet; /* quiet mode */ bool timing; /* print timing info? */ + bool no_pkttyagent; /* suppress registration of pkttyagent? */ int debug; /* print debug messages? */ char *logfile; /* log file name */ int log_fd; /* log file descriptor */ --=20 2.39.5