Merge pull request #882 from phreaker0/preserve-properties-handle-special-symbols

escape property key and value pair in case of property preservation
This commit is contained in:
Jim Salter 2024-01-13 15:41:57 -05:00 committed by GitHub
commit 4e8b881da7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -917,7 +917,8 @@ sub runsynccmd {
foreach my $key (keys %properties) {
my $value = $properties{$key};
writelog('DEBUG', "will set $key to $value ...");
$recvoptions .= " -o $key=$value";
my $pair = escapeshellparam("$key=$value");
$recvoptions .= " -o $pair";
}
} elsif (defined $args{'preserve-recordsize'}) {
my $type = getzfsvalue($sourcehost,$sourcefs,$sourceisroot,'type');

View File

@ -29,6 +29,7 @@ zfs create -V 100M -o volblocksize=16k -o primarycache=all "${POOL_NAME}"/src/zv
zfs create -V 100M -o volblocksize=64k "${POOL_NAME}"/src/zvol64
zfs create -o recordsize=16k -o primarycache=none "${POOL_NAME}"/src/16
zfs create -o recordsize=32k -o acltype=posixacl "${POOL_NAME}"/src/32
zfs set 'net.openoid:var-name'='with whitespace and !"§$%&/()= symbols' "${POOL_NAME}"/src/32
../../../syncoid --preserve-properties --recursive --debug --compress=none "${POOL_NAME}"/src "${POOL_NAME}"/dst
@ -64,3 +65,7 @@ fi
if [ "$(zfs get acltype -H -o value -t filesystem "${POOL_NAME}"/dst/32)" != "posix" ]; then
exit 1
fi
if [ "$(zfs get 'net.openoid:var-name' -H -o value -t filesystem "${POOL_NAME}"/dst/32)" != "with whitespace and !\"§$%&/()= symbols" ]; then
exit 1
fi