allanjude / zxfer

A continuation of development on zxfer, a popular script for managing ZFS snapshot replication
BSD 2-Clause "Simplified" License
124 stars 40 forks source link

zfs get output is language dependent #1

Closed cernst1980 closed 9 years ago

cernst1980 commented 10 years ago

If "LANG=de_DE.UTF-8", the sizes contain "," instead of ".", which breaks the script. This can be considered by adding 'tr "," "."' to line 1175 of the script or overwriting LANG in the script.

1164 transfer_properties() { 1165 # We have chosen to set all source properties in the case of -P 1166 # Any -o values will be set too, and will override any values from -P. 1167 # Where the destination does not exist, it will be created. 1168 1169 # Get the list of properties to enforce on the destination. This will be an 1170 # amalgam of -o options, and if -P exists, a list of the source properties. 1171 1172 # get source properties,values,sources in form 1173 # property1=value1=source1,property2=value2=source2,... 1174 source_pvs=$($LZFS get -Ho property,value,source all "$source"\ 1175 | tr "," "." | tr "\t" "=" | tr "\n" ",")

allanjude commented 10 years ago

A recent commit actually solves this problem. We pass zfs get -Hpo

https://github.com/allanjude/zxfer/commit/75e5997feb4ef14225a17f25e092c3f85372d339

We using machine readable, rather than human readable, it won't have , or . in it. As well, it solves the problem that the localization on some Macs uses 'Ki' rather than 'K' as the unit suffix, which also breaks things.

Can you grab the latest version from the master branch and confirm it solves the problem for you?

allanjude commented 10 years ago

This change was breaking replication in some instances because quota and refquota were not being applied properly when they were set to 'none' because -p shows 'none' as 0

This was exposed while working on support for the filesystem_count property, where 'none' prints as 18446744073709551615 (2^64 - 1) when using -p

allanjude commented 10 years ago

This should be fixed correctly in b8a759c035e491ccd71eeda3f0af4f9391a863fd such that is no longer breaks replication and complains about being unable to set quota