Bug 240411 - devd behaves odd when action uses single quotes
Summary: devd behaves odd when action uses single quotes
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-08 09:07 UTC by nvass
Modified: 2019-09-08 09:07 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nvass 2019-09-08 09:07:01 UTC
Using this rule on FreeBSD-12:
notify 10 {
        match "system"          "ZFS";
        match "type"            "misc.fs.zfs.scrub_start";
        action "touch /var/run/scrub_$pool_name; logger -t ZFS 'zpool $pool_name started scrubbing'";
};

notify 10 {
        match "system"          "ZFS";
        match "type"            "misc.fs.zfs.scrub_finish";
        action "rm /var/run/scrub_$pool_name; logger -t ZFS 'zpool $pool_name finished scrubbing'";
};

creates these messages in /var/log/messages
Sep  8 11:51:35 aurora ZFS[12797]: vdev state changed, pool_guid=$5355245379867352521 vdev_guid=$1907996185387027531
Sep  8 11:51:35 aurora ZFS[12798]: vdev state changed, pool_guid=$5355245379867352521 vdev_guid=$9030209902286509774
Sep  8 11:51:35 aurora ZFS[12799]: vdev state changed, pool_guid=$5355245379867352521 vdev_guid=$2872996488705391350
Sep  8 11:51:35 aurora ZFS[12800]: vdev state changed, pool_guid=$5355245379867352521 vdev_guid=$13633596582270114039
Sep  8 11:51:35 aurora ZFS[12801]: zpool $aurora-os started scrubbing

The pool name should be aurora-os without the leading dollar sign. This only happens when variables are enclosed in single quotes. The same rule behaves correctly on earlier versions. 

/var/run/devd.pipe on FBSD-12:
!system=ZFS subsystem=ZFS type=resource.fs.zfs.statechange  version=0 class=resource.fs.zfs.statechange pool_guid=5355245379867352521 vdev_guid=1907996185387027531
!system=ZFS subsystem=ZFS type=resource.fs.zfs.statechange  version=0 class=resource.fs.zfs.statechange pool_guid=5355245379867352521 vdev_guid=9030209902286509774
!system=ZFS subsystem=ZFS type=resource.fs.zfs.statechange  version=0 class=resource.fs.zfs.statechange pool_guid=5355245379867352521 vdev_guid=2872996488705391350
!system=ZFS subsystem=ZFS type=resource.fs.zfs.statechange  version=0 class=resource.fs.zfs.statechange pool_guid=5355245379867352521 vdev_guid=13633596582270114039
!system=ZFS subsystem=ZFS type=misc.fs.zfs.scrub_start  pool_name=aurora-os pool_guid=5355245379867352521
!system=ZFS subsystem=ZFS type=misc.fs.zfs.history_event  pool_name=aurora-os pool_guid=5355245379867352521 history_hostname=aurora.local history_internal_str=func=1 mintxg=0 maxtxg=1064734 history_internal_name=scan setup history_txg=1064734 history_time=1567933234



/var/run/devd.pipe on FBSD-10:
!system=ZFS subsystem=ZFS type=misc.fs.zfs.scrub_start  pool_name=clio pool_guid=1203689305036940146