public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-storage 1/1] fix #6587: parse snapshot names beginning from the first underscore
@ 2025-07-30 10:37 Shannon Sterz
  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 15:43 ` [pve-devel] [PATCH pve-storage 1/1] fix #6587: parse snapshot names beginning from the first underscore Fiona Ebner
  0 siblings, 2 replies; 4+ messages in thread
From: Shannon Sterz @ 2025-07-30 10:37 UTC (permalink / raw)
  To: pve-devel

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-30 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-30 10:37 [pve-devel] [PATCH pve-storage 1/1] fix #6587: parse snapshot names beginning from the first underscore Shannon Sterz
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

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