mirror of https://github.com/jimsalterjrs/sanoid
fix(syncoid): Regression: Fallback recursion `$rhost` mutated already
An oversight during the merging of subroutine `getsnapsfallback` into `getsnaps` (https://github.com/jimsalterjrs/sanoid/pull/818/commits/e301b5b1) caused the recursive call to prepend `$sshcmd` to `$rhost` again, leading to this error: ```shell # syncoid --debug root@192.168.122.26:rpool/before syncoid-test-11/after … [TRUNCATED] … WARNING: snapshot listing failed, trying fallback command DEBUG: getting list of snapshots on rpool/before using ssh ssh -S /tmp/syncoid-root19216812226-1718239169-761069-2198 root@192.168.122.26 zfs get -Hpd 1 all ''"'"'rpool/before'"'"'' |... root@192.168.122.26: Command not found. CRITICAL ERROR: snapshots couldn't be listed for rpool/before (exit code 256) at /usr/sbin/syncoid line 1900. ``` Fixes: https://github.com/jimsalterjrs/sanoid/pull/818#issuecomment-2164155867
This commit is contained in:
parent
a7e6c2db68
commit
f16c15c9ba
4
syncoid
4
syncoid
|
|
@ -1874,6 +1874,8 @@ sub getsnaps {
|
|||
my $fsescaped = escapeshellparam($fs);
|
||||
if ($isroot) { $mysudocmd = ''; } else { $mysudocmd = $sudocmd; }
|
||||
|
||||
my $rhostOriginal = $rhost;
|
||||
|
||||
if ($rhost ne '') {
|
||||
$rhost = "$sshcmd $rhost";
|
||||
# double escaping needed
|
||||
|
|
@ -1895,7 +1897,7 @@ sub getsnaps {
|
|||
close FH or do {
|
||||
if (!$use_fallback) {
|
||||
writelog('WARN', "snapshot listing failed, trying fallback command");
|
||||
return getsnaps($type, $rhost, $fs, $isroot, 1, %snaps);
|
||||
return getsnaps($type, $rhostOriginal, $fs, $isroot, 1, %snaps);
|
||||
}
|
||||
die "CRITICAL ERROR: snapshots couldn't be listed for $fs (exit code $?)";
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue