Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Jul 2018 22:40:26 +0200
From:      Michael Grimm <trashcan@ellael.org>
To:        Mailing List FreeBSD Ports <freebsd-ports@FreeBSD.org>
Cc:        bdrewery@FreeBSD.org
Subject:   beadm-1.2.8: erroneous beadm create
Message-ID:  <5A4EB662-9562-47E4-A436-FAAAFFF524C6@ellael.org>

next in thread | raw e-mail | index | archive | help
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=3D"hidden" -o mountpoint=3D"/"
	zp0/ROOT/11r336056  |  -o mountpoint=3D"/usr/home/jails"
	zp0/ROOT/11r336056  |  -o snapdir=3D"hidden" -o setuid=3D"on" -o =
mountpoint=3D"/usr"
	zp0/ROOT/11r336056  |  -o =3D""
	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=3Dhidden -o mountpoint=3D/
	zp0/ROOT/11r336056  |  -o mountpoint=3D/usr/home/jails
	zp0/ROOT/11r336056  |  -o snapdir=3Dhidden -o setuid=3Don -o =
mountpoint=3D/usr
	zp0/ROOT/11r336056  |  -o =3D
	zp0/ROOT/11r336056  |  -o mountpoint=3D/usr/src
	zp0/ROOT/11r336056  |  -o snapdir=3Dhidden -o mountpoint=3D/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=3D""
         while read NAME PROPERTY VALUE
         do
-          local OPTS=3D"-o ${PROPERTY}=3D\"${VALUE}\" ${OPTS}"
+          local OPTS=3D"-o ${PROPERTY}=3D${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 =E2=80=
=A6
	-o =3D""
=E2=80=A6 before applying the final 'zfs clone' command with it would be =
a much better patch.=20

Regards,
Michael




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5A4EB662-9562-47E4-A436-FAAAFFF524C6>