Merge pull request #859 from jan-krieg/master

fix "creation"/"guid" regex detection
This commit is contained in:
Jim Salter 2024-01-13 16:33:01 -05:00 committed by GitHub
commit b100ba43ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

14
syncoid
View File

@ -1843,7 +1843,7 @@ sub getsnaps() {
if (!snapisincluded($snapname)) { next; } if (!snapisincluded($snapname)) { next; }
# only import snap guids from the specified filesystem # only import snap guids from the specified filesystem
if ($line =~ /\Q$fs\E\@.*guid/) { if ($line =~ /\Q$fs\E\@.*\tguid/) {
chomp $line; chomp $line;
my $guid = $line; my $guid = $line;
$guid =~ s/^.*\tguid\t*(\d*).*/$1/; $guid =~ s/^.*\tguid\t*(\d*).*/$1/;
@ -1852,7 +1852,7 @@ sub getsnaps() {
$snaps{$type}{$snap}{'guid'}=$guid; $snaps{$type}{$snap}{'guid'}=$guid;
} }
# only import snap creations from the specified filesystem # only import snap creations from the specified filesystem
elsif ($line =~ /\Q$fs\E\@.*creation/) { elsif ($line =~ /\Q$fs\E\@.*\tcreation/) {
chomp $line; chomp $line;
my $creation = $line; my $creation = $line;
$creation =~ s/^.*\tcreation\t*(\d*).*/$1/; $creation =~ s/^.*\tcreation\t*(\d*).*/$1/;
@ -1912,13 +1912,13 @@ sub getsnapsfallback() {
} }
if ($state eq 0) { if ($state eq 0) {
if ($line !~ /\Q$fs\E\@.*type\s*snapshot/) { if ($line !~ /\Q$fs\E\@.*\ttype\s*snapshot/) {
# skip non snapshot type object # skip non snapshot type object
$state = -2; $state = -2;
next; next;
} }
} elsif ($state eq 1) { } elsif ($state eq 1) {
if ($line !~ /\Q$fs\E\@.*guid/) { if ($line !~ /\Q$fs\E\@.*\tguid/) {
die "CRITICAL ERROR: snapshots couldn't be listed for $fs (guid parser error)"; die "CRITICAL ERROR: snapshots couldn't be listed for $fs (guid parser error)";
} }
@ -1930,7 +1930,7 @@ sub getsnapsfallback() {
if (!snapisincluded($snap)) { next; } if (!snapisincluded($snap)) { next; }
$snaps{$type}{$snap}{'guid'}=$guid; $snaps{$type}{$snap}{'guid'}=$guid;
} elsif ($state eq 2) { } elsif ($state eq 2) {
if ($line !~ /\Q$fs\E\@.*creation/) { if ($line !~ /\Q$fs\E\@.*\tcreation/) {
die "CRITICAL ERROR: snapshots couldn't be listed for $fs (creation parser error)"; die "CRITICAL ERROR: snapshots couldn't be listed for $fs (creation parser error)";
} }
@ -2003,14 +2003,14 @@ sub getbookmarks() {
foreach my $line (@rawbookmarks) { foreach my $line (@rawbookmarks) {
# only import bookmark guids, creation from the specified filesystem # only import bookmark guids, creation from the specified filesystem
if ($line =~ /\Q$fs\E\#.*guid/) { if ($line =~ /\Q$fs\E\#.*\tguid/) {
chomp $line; chomp $line;
$lastguid = $line; $lastguid = $line;
$lastguid =~ s/^.*\tguid\t*(\d*).*/$1/; $lastguid =~ s/^.*\tguid\t*(\d*).*/$1/;
my $bookmark = $line; my $bookmark = $line;
$bookmark =~ s/^.*\#(.*)\tguid.*$/$1/; $bookmark =~ s/^.*\#(.*)\tguid.*$/$1/;
$bookmarks{$lastguid}{'name'}=$bookmark; $bookmarks{$lastguid}{'name'}=$bookmark;
} elsif ($line =~ /\Q$fs\E\#.*creation/) { } elsif ($line =~ /\Q$fs\E\#.*\tcreation/) {
chomp $line; chomp $line;
my $creation = $line; my $creation = $line;
$creation =~ s/^.*\tcreation\t*(\d*).*/$1/; $creation =~ s/^.*\tcreation\t*(\d*).*/$1/;