beadm-1.2.8: erroneous beadm create

Michael Grimm trashcan at ellael.org
Sat Jul 7 20:40:34 UTC 2018


Hi --

I happen to run a boot environment with two zfs filesystems without any zfs property defined that trigger an error with the latest beadm-1.2.8.

Example BE of mine:
	zp0/ROOT/11r336056            13.5G    463M     95.1M  27.2G    972M  2.15x  /
	zp0/ROOT/11r336056/_jails      672M    672M         0  1.09G   1.09G  1.75x  /usr/home/jails
	zp0/ROOT/11r336056/usr        11.7G   6.42G     3.40G  24.2G   13.7G  2.22x  /usr
	zp0/ROOT/11r336056/usr/local   321M    299M     21.8M   505M    484M  1.77x  /usr/local
	zp0/ROOT/11r336056/usr/src    1.60G   1.51G     96.2M  2.91G   2.82G  2.13x  /usr/src
	zp0/ROOT/11r336056/var         586M    577M     8.64M   779M    764M  1.33x  /var

Both zp0/ROOT/11r336056/usr/local and zp0/ROOT/11r336056/usr/src do not have any zfs property defined, thus the new beadm-1.2.8 will run into an error when trying to create a new BE:
	root> beadm create B1
	cannot create 'zp0/ROOT/B1/usr/local': invalid property ''

Ok, after adding some debugging code and a comparison with the previous version I found the cause:
	root> ./beadm-1.2.8-patched create B1
	zp0/ROOT/11r336056  |  -o snapdir="hidden" -o mountpoint="/"
	zp0/ROOT/11r336056  |  -o mountpoint="/usr/home/jails"
	zp0/ROOT/11r336056  |  -o snapdir="hidden" -o setuid="on" -o mountpoint="/usr"
	zp0/ROOT/11r336056  |  -o =""
	cannot create 'zp0/ROOT/B1/usr/local': invalid property ''

The previous version didn't trigger missing zfs properties because it doesn't add an empty string "" to '-o':
	root> ./beadm-1.2.8-patched create B1
	zp0/ROOT/11r336056  |  -o snapdir=hidden -o mountpoint=/
	zp0/ROOT/11r336056  |  -o mountpoint=/usr/home/jails
	zp0/ROOT/11r336056  |  -o snapdir=hidden -o setuid=on -o mountpoint=/usr
	zp0/ROOT/11r336056  |  -o =
	zp0/ROOT/11r336056  |  -o mountpoint=/usr/src
	zp0/ROOT/11r336056  |  -o snapdir=hidden -o mountpoint=/var
	Created successfully

Workaround to me is the following patch (beadm-1.2.7 approach):

[snip]
root> diff -u beadm-1.2.8 beadm-1.2.8-patched
--- beadm-1.2.8	2018-07-07 16:17:19.231902000 +0200
+++ beadm-1.2.8-patched	2018-07-07 22:00:19.740611000 +0200
@@ -213,7 +213,7 @@
         local OPTS=""
         while read NAME PROPERTY VALUE
         do
-          local OPTS="-o ${PROPERTY}=\"${VALUE}\" ${OPTS}"
+          local OPTS="-o ${PROPERTY}=${VALUE} ${OPTS}"
         done << EOF
 $( zfs get -o name,property,value -s local,received -H all ${FS} | awk '!/[\t ]canmount[\t ]/' )
 EOF
[snap]

Well, I do see the point of embedding variables with ", but I do also believe that checking for a null string and removing that resulting …
	-o =""
… before applying the final 'zfs clone' command with it would be a much better patch. 

Regards,
Michael



More information about the freebsd-ports mailing list