From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id AFFE21FF0E1 for ; Mon, 16 Nov 2026 02:01:36 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 4CD1421790; Mon, 16 Nov 2026 02:01:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794790854; x=1795395654; darn=lists.proxmox.com; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=XERovyrYp4GG39HABEKZ2v9QGLy4w5nqQ4N2673W3Xo=; b=Ze4+r+I3subsnORB4SkzFSQCY358dXzh8XDBKLZyDu4Aq5DGgbSggGTSfq3t2+hX9p y1kf9S8hU8AB7+aFHFIu2REn5nKXJ1aJG2z7Jw0aclwMdEO+kcodQMguGsiceXp+G+Qu NO/Ip0aJP6hMrcbZ548bb25R1h3B5o5UyWoAcb7lI2ooDzLF6DtIMbIK+9eVZ3kfyuid lBz83AB5atAJ7mA7cH0y2ghFc5IwHlD9AN/4r+fZ2uk8FMwMiUYYgOfH05KqmEEAgDZ0 oebZEoS4YeZgdpnlVzlgtPB3HgkdLw6a/ywFJCPjht8+QJ7IiMVHb1wwE86irxxjFmd+ a18Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794790854; x=1795395654; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=XERovyrYp4GG39HABEKZ2v9QGLy4w5nqQ4N2673W3Xo=; b=ut5Ks3pnJKI3tWZ9OEP5MXf8tGWUsuyUv6+jCflPtndDWRPLAIhblBCPsrIBUqnkTF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CzfCpZg9tNzqrPQ iEN4xnUkuw3o3ZUjYw2N73cMrPCLQhdiHOLPZMmm6 X-Received: by 2002:a05:6102:f83:b0:7c3:7286:b7ea with SMTP id ada2fe7eead31-7d64d75b395mr2436259137.17.1794790852159; Sun, 15 Nov 2026 17:00:52 -0800 (PST) From: Lucas Barros To: pve-devel@lists.proxmox.com Subject: [PATCH container v2 3/5] fix #7173: api: update: delete tags when an empty tag list is set Date: Sun, 15 Nov 2026 22:00:38 -0300 Message-ID: <20261116010040.90964-4-lucasbarros.kam@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261116010040.90964-1-lucasbarros.kam@gmail.com> References: <1794390075.ol4qipttrq.astroid@yuna.none> <20261116010040.90964-1-lucasbarros.kam@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.063 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 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: 2DJ5LLXBVKB6UHWPVPR35TSC5KMM6OON X-Message-ID-Hash: 2DJ5LLXBVKB6UHWPVPR35TSC5KMM6OON 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 CC: Lucas Barros X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Setting 'tags' to an empty string, as the web UI does when removing the last tag of a container, stores the empty value in the config and leaves an empty 'tags:' line behind, instead of removing the option. Handle an empty tag list like a deletion of 'tags', so that the option goes through the regular delete path, including the tag permission checks, and nothing is left in the config. Use split_list() to decide whether the list is empty, so a value consisting only of delimiters is handled the same way. Suggested-by: Fabian Grünbichler Signed-off-by: Lucas Barros --- changes since v1: * new patch, same as 1/5 for containers This patch was prepared with the help of an LLM based coding assistant; I reviewed the change and ran the tests mentioned in the cover letter myself. src/PVE/API2/LXC/Config.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/PVE/API2/LXC/Config.pm b/src/PVE/API2/LXC/Config.pm index 805eac0..7a6c1bb 100644 --- a/src/PVE/API2/LXC/Config.pm +++ b/src/PVE/API2/LXC/Config.pm @@ -165,6 +165,15 @@ __PACKAGE__->register_method({ my $revert_str = extract_param($param, 'revert'); my @revert = PVE::Tools::split_list($revert_str); + # an empty tag list means no tags, so remove the option instead of setting an empty value + if (defined($param->{tags}) && !grep { $_ eq 'tags' } @delete) { + my @tags = PVE::Tools::split_list($param->{tags}); + if (!scalar(@tags)) { + delete $param->{tags}; + push @delete, 'tags'; + } + } + $param->{cpuunits} = PVE::CGroup::clamp_cpu_shares($param->{cpuunits}) if defined($param->{cpuunits}); # clamp value depending on cgroup version -- 2.50.1 (Apple Git-155)