summarylogtreecommitdiffstats
path: root/prefix_label_order.patch
diff options
context:
space:
mode:
Diffstat (limited to 'prefix_label_order.patch')
-rw-r--r--prefix_label_order.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/prefix_label_order.patch b/prefix_label_order.patch
new file mode 100644
index 000000000000..dc3598afd571
--- /dev/null
+++ b/prefix_label_order.patch
@@ -0,0 +1,28 @@
+diff --git a/src/zfs-auto-snapshot.sh b/src/zfs-auto-snapshot.sh
+index 5ef5bae..75ba11d 100755
+--- a/src/zfs-auto-snapshot.sh
++++ b/src/zfs-auto-snapshot.sh
+@@ -375,9 +375,7 @@ if [ -n "$opt_fast_zfs_list" ]
+ then
+ SNAPSHOTS_OLD=$(env LC_ALL=C zfs list -H -t snapshot -o name -s name | \
+ grep $opt_prefix | \
+- awk '{ print substr( $0, length($0) - 14, length($0) ) " " $0}' | \
+- sort -r -k1,1 -k2,2 | \
+- awk '{ print substr( $0, 17, length($0) )}') \
++ sort -t'@' -k2r,2 -k1,1) \
+ || { print_log error "zfs list $?: $SNAPSHOTS_OLD"; exit 137; }
+ else
+ SNAPSHOTS_OLD=$(env LC_ALL=C zfs list -H -t snapshot -S creation -o name) \
+@@ -537,10 +535,10 @@ SNAPPROP="-o com.sun:auto-snapshot-desc='$opt_event'"
+ DATE=$(date --utc +%F-%H%M)
+
+ # The snapshot name after the @ symbol.
+-SNAPNAME="$opt_prefix${opt_label:+$opt_sep$opt_label}-$DATE"
++SNAPNAME="${opt_prefix}_$DATE${opt_label:+$opt_sep$opt_label}"
+
+ # The expression for matching old snapshots. -YYYY-MM-DD-HHMM
+-SNAPGLOB="$opt_prefix${opt_label:+?$opt_label}????????????????"
++SNAPGLOB="${opt_prefix}????????????????${opt_label:+?$opt_label}"
+
+ if [ -n "$opt_do_snapshots" ]
+ then