From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id BAFDF1FF09B for ; Mon, 09 Nov 2026 14:56:57 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 84203215DA; Mon, 09 Nov 2026 14:56:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794232606; x=1794837406; darn=lists.proxmox.com; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=bH1NcK58owAFfNz1rMYvOpmW3yirxjLJvVV2aCG4a+E=; b=hVWuQXyrEcmIZ9M7zCBxB0LsFlvGCesaEze0hJDAxKeqL1CBz2W81a5sWLXv60+Qcu WTqkyYy9XQo+o78J/NmPDMl86n8oAeUTbQmW73zyf1in2D1oeJGfXoM+8u2wtOiQCTiq u90uXJzxRmi29DCbgtybKF7pCiC+EF2NUPHr28GdeZxNi8/6jAcqeZiFv0ee2KLJ+X/g 5PUXVPxMb5TlmzHiXNiIPUmrd1Cg7dBNZPjHxoSmR1+zG/MJ10m41vvehpbYwtPGgy1W uMAdVq6UdkrTBVr8hpGmTZjiF7yDp/h4cqdMB8dMHqG+WSy0As490JP7ihvcZlhG+TNa Q9QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794232606; x=1794837406; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=bH1NcK58owAFfNz1rMYvOpmW3yirxjLJvVV2aCG4a+E=; b=BGQdS5bnxZEt4tp25szvfUBdVZHSK2eszF7cWLM8TYRoZXGrP52vTiehzWcJBta/iT INlVqoowhCjPznGO2Jvj4C39/h8bKtM2N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KDDf4oaKY2SyQLAdd5Uwwz/iG8300SXA== X-Received: by 2002:a05:6122:1d03:b0:5ec:41df:f110 with SMTP id 71dfb90a1353d-5ece73a84f0mr1252349e0c.23.1794232606121; Mon, 09 Nov 2026 05:56:46 -0800 (PST) From: Lucas Barros To: pve-devel@lists.proxmox.com Subject: [PATCH container] fix #7173: config: do not write out an empty tag list Date: Mon, 9 Nov 2026 10:56:40 -0300 Message-ID: <20261109135640.94964-1-lucasbarros.kam@gmail.com> X-Mailer: git-send-email 2.50.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.000 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: AF5WAZGQBVWYRTQF7ZOZGLJ32JBHGBQM X-Message-ID-Hash: AF5WAZGQBVWYRTQF7ZOZGLJ32JBHGBQM X-MailFrom: lucasbarros.kam@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Removing the last tag of a container, for example in the web UI, sets 'tags' to an empty string, which then ends up as an empty 'tags:' line in the container config and in the output of 'pct config'. This carries no information, is inconsistent with how unset options are handled and confuses tools that consume the config, as they need to special case an empty tag list. Drop the key when writing the config if the tag list is empty, which also cleans up configs that already contain such a line on the next write. The pending section is left alone, as an empty value there is still needed to apply the change. Signed-off-by: Lucas Barros --- A matching patch for qemu-server is sent separately. Only the main section is touched, the pending section keeps an empty value so that applying the change still removes the tags. Tested on a PVE 9 node (qemu-server 9.2.15, pve-container 6.1.18), adding and then removing the only tag of a VM and of a container: without the patches: $ qm set 9901 --tags foo; pvesh set /nodes//qemu/9901/config --tags '' $ grep -n tags /etc/pve/qemu-server/9901.conf | cat -A 6:tags: $ $ pct set 9902 --tags foo; pct set 9902 --tags '' $ grep -n tags /etc/pve/lxc/9902.conf | cat -A 7:tags: $ $ pvesh get /nodes//qemu/9901/config --output-format json | jq -c '{tags}' {"tags":" "} with the patches: $ grep -c tags /etc/pve/qemu-server/9901.conf /etc/pve/lxc/9902.conf /etc/pve/qemu-server/9901.conf:0 /etc/pve/lxc/9902.conf:0 $ pvesh get /nodes//qemu/9901/config --output-format json | jq -c '{tags}' {"tags":null} An existing empty 'tags:' line goes away on the next write of the config, removing the tag of a running VM leaves no line and no [PENDING] entry, and 'tags: a;b' is still written as before. The pve-container test suite passes before and after; it has no tests for writing the config. proxmox-perltidy reports no changes. This patch was prepared with the help of an LLM based coding assistant; I reviewed the change and ran the tests mentioned above myself. src/PVE/LXC/Config.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm index 13ff1bd..00da15b 100644 --- a/src/PVE/LXC/Config.pm +++ b/src/PVE/LXC/Config.pm @@ -1222,6 +1222,9 @@ sub write_pct_config { delete $conf->{snapstate}; # just to be sure + # an empty tag list carries no information, so do not write out the key + delete $conf->{tags} if defined($conf->{tags}) && $conf->{tags} =~ m/^[\s,;]*$/; + my $volidlist = PVE::LXC::Config->get_vm_volumes($conf); my $used_volids = {}; foreach my $vid (@$volidlist) { -- 2.47.3