From 6c7da10e24904cce51978210d554a79a8e514545 Mon Sep 17 00:00:00 2001 From: Phil Kulin Date: Wed, 11 Jul 2018 17:32:57 +0300 Subject: [PATCH 1/2] Fix recursive snapshot --- src/zfs-auto-snapshot.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/zfs-auto-snapshot.sh b/src/zfs-auto-snapshot.sh index a97df0a..e3c5a54 100644 --- a/src/zfs-auto-snapshot.sh +++ b/src/zfs-auto-snapshot.sh @@ -447,6 +447,9 @@ do for jj in "$@" do if [ "$jj" = '//' -o "$jj" = "$ii" ] + then + IN_ARGS=$(( $IN_ARGS + 1 )) + elif [ -n "$opt_recursive" -a "$iii" != "${iii#$jjj}" ] then IN_ARGS=$(( $IN_ARGS + 1 )) fi From 6ee4553cf6cf291db19d1d8000c549f75208bacf Mon Sep 17 00:00:00 2001 From: Phil Kulin Date: Thu, 12 Jul 2018 13:03:07 +0300 Subject: [PATCH 2/2] Fix jjj vs jj bug in recursive snapshot selection --- src/zfs-auto-snapshot.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/zfs-auto-snapshot.sh b/src/zfs-auto-snapshot.sh index e3c5a54..680a667 100644 --- a/src/zfs-auto-snapshot.sh +++ b/src/zfs-auto-snapshot.sh @@ -442,10 +442,15 @@ do iii="$ii/" - # Exclude datasets that are not named on the command line. + # Exclude datasets + # * that are not named on the command line or + # * those whose prefix is not on the command line (if --recursive flag is set) IN_ARGS='0' for jj in "$@" do + # Ibid regarding iii. + jjj="$jj/" + if [ "$jj" = '//' -o "$jj" = "$ii" ] then IN_ARGS=$(( $IN_ARGS + 1 ))