[pve-devel] [PATCH pve-storage 1/1] fix #6587: parse snapshot names beginning from the first underscore
Shannon Sterz
s.sterz at proxmox.com
Wed Jul 30 12:37:05 CEST 2025
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 at 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
More information about the pve-devel
mailing list