public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-storage 1/1] fix #6587: parse snapshot names beginning from the first underscore
Date: Wed, 30 Jul 2025 12:37:05 +0200	[thread overview]
Message-ID: <20250730103705.98313-2-s.sterz@proxmox.com> (raw)

Since regular expressions are typically greedy the old regex here
matched as many underscores as it could (`\S` matches anything that is
not a whitespace, so also `_`). This lead to an issue where snapshots
that contained an underscore in their name would be truncated to only
contain the part of the name after the last underscore.

Use `[^\s_]` to match everything that is not a whitespace and not the
underscore character.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 src/PVE/Storage/LVMPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index 67fcfbd..c6586ac 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -472,7 +472,7 @@ my sub get_snap_name {
 my sub parse_snap_name {
     my ($name) = @_;
 
-    if ($name =~ m/^snap_\S+_(.*)\.qcow2$/) {
+    if ($name =~ m/^snap_[^\s_]+_(.*)\.qcow2$/) {
         return $1;
     }
 }
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2025-07-30 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 10:37 Shannon Sterz [this message]
2025-07-30 10:37 ` [pve-devel] [PATCH qemu-server 1/1] qemu-server: exit delete early if we cannot find a snapshot Shannon Sterz
2025-07-30 16:32   ` [pve-devel] applied: " Fiona Ebner
2025-07-30 15:43 ` [pve-devel] [PATCH pve-storage 1/1] fix #6587: parse snapshot names beginning from the first underscore Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250730103705.98313-2-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal