[pve-devel] [pve-zsync 2/2] Fix #1245: Fix snapshot parser.

Wolfgang Link w.link at proxmox.com
Tue Jan 10 10:56:52 CET 2017


Make the snapshot parser more exact.
This avoid that a wrong snap-name will returned
if two or more job names has the same beginning.
---
 pve-zsync | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pve-zsync b/pve-zsync
index 8bd437e..6a651b8 100644
--- a/pve-zsync
+++ b/pve-zsync
@@ -643,7 +643,7 @@ sub snapshot_get{
 
     while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
 	$line = $1;
-	if ($line =~ m/(rep_$name.*)$/) {
+	if ($line =~ m/(rep_\Q${name}\E_\d{4}-\d{2}-\d{2}_\d{2}:\d{2}:\d{2})$/) {
 
 	    $last_snap = $1 if (!$last_snap);
 	    $old_snap = $1;
-- 
2.1.4




More information about the pve-devel mailing list