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 2C1BF1FF12C for ; Wed, 05 Aug 2026 10:24:26 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id EC5662173D; Wed, 05 Aug 2026 10:24:25 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 05 Aug 2026 10:24:22 +0200 Message-Id: From: "Elias Huhsovitz" To: "Thomas Ellmenreich" , Subject: Re: [PATCH qemu-server 3/3] removed some unnecessary undef checks. X-Mailer: aerc 0.20.0 References: <20260803121300.138287-1-t.ellmenreich@proxmox.com> <20260803121300.138287-4-t.ellmenreich@proxmox.com> In-Reply-To: <20260803121300.138287-4-t.ellmenreich@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785918249585 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.105 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low 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: 2PNR5OBJJ3OBQTAC2N4AAFMJMXEYLKJX X-Message-ID-Hash: 2PNR5OBJJ3OBQTAC2N4AAFMJMXEYLKJX X-MailFrom: e.huhsovitz@proxmox.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: Summary ------- * classify_drive_file() and drive_has_absolute_path() are not prepared to handle undef values, and therefore removing the undef checks causes a change in behaviour * commit message should be imperative, e.g., "remove some unnecessary undef checks" On Mon Aug 3, 2026 at 2:12 PM CEST, Thomas Ellmenreich wrote: > Signed-off-by: Thomas Ellmenreich > --- > src/PVE/QemuServer.pm | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm > index 0e998cbe..3141b298 100644 > --- a/src/PVE/QemuServer.pm > +++ b/src/PVE/QemuServer.pm > @@ -1818,11 +1818,10 @@ sub destroy_vm { > { include_unused =3D> 1 }, > sub { > my ($ds, $drive) =3D @_; > - return if drive_is_cdrom($drive); > =20 > - my $volid =3D $drive->{file}; > - return if !$volid || drive_has_absolute_path($drive); I think this might result in an edge case where $drive->{file} can be undef= , causing the underlying function classify_drive_file() that drive_has_absolu= te_path() calls, to emit a warning. To my understanding, classify_drive_file() is currently unpreparted to receive undef values. I believe a guard clause in classify_drive_file() resolves this. e.g., in classify_drive_file: my ($volid) =3D @_; return '' if (!$volid); > + return if drive_is_cdrom($drive) || drive_has_absolute_p= ath($drive); > =20 > + my $volid =3D $drive->{file}; > my $result =3D eval { PVE::Storage::volume_is_base_and_u= sed($storecfg, $volid) }; > # early check, removal of volume will fail later anyway,= so warning here is fine > log_warn("failed to check if volume '$volid' is used by = linked clones: $@") > @@ -1839,8 +1838,7 @@ sub destroy_vm { > return if drive_is_cdrom($drive, 1); > =20 > my $volid =3D $drive->{file}; > - return if !$volid || drive_has_absolute_path($drive); same here. > - return if $volids->{$volid}; > + return if drive_has_absolute_path($drive) || $volids->{$volid}; > =20 > my ($path, $owner) =3D eval { PVE::Storage::path($storecfg, $vol= id) }; > log_warn("failed to get path and owner of volume '$volid': $@") = if $@; > @@ -6510,11 +6508,9 @@ my $restore_cleanup_oldconf =3D sub { > sub { > my ($ds, $drive) =3D @_; > =20 > - return if drive_is_cdrom($drive, 1); > + return if drive_is_cdrom($drive, 1) || drive_has_absolute_pa= th($drive); > =20 > my $volid =3D $drive->{file}; > - return if !$volid || drive_has_absolute_path($drive); same here. > - > my ($path, $owner) =3D PVE::Storage::path($storecfg, $volid)= ; > return if !$path || !$owner || ($owner !=3D $vmid); > =20