+ # last_snap by date.
+ last_snap="${snaps[0]}"
+
+ case $last_snap in
+ $root_dir/btrbk/$subvol_dir.20*) : ;;
+ *)
+ echo "$0: error: unexpected last_snap:$last_snap"
+ exit 1
+ ;;
+ esac
+
+ d last_snap=$last_snap
+ ## alternate slower alternative which would not rely on ls sorting:
+ # last_snap=$(
+ # for s in ${snaps[@]}; do
+ # f=${s##*/}
+ # unix_time=$(date -d $(sed -r 's/(.{4})(..)(.{5})(..)(.*)/\1-\2-\3:\4:\5/' <<<${f#$vol.}) +%s)
+ # printf "%s %s\n" $unix_time $s # part of the pipeline
+ # # sort will fail
+ # done | sort -r | head -n 1 | awk '{print $2}' || [[ ${PIPESTATUS[1]} == 141 || ${PIPESTATUS[0]} == 32 ]]
+ # )
+ # if [[ ! $last_snap ]]; then
+ # # should not happen.
+ # echo "$0: error: could not find latest snapshot for $svp among ${snaps[*]}" >&2
+ # exit 1
+ # fi
+
+ if [[ ! -e $svp ]]; then
+ echo "$0: warning: subvol does not exist: $svp"
+ echo "$0 assuming this host was just for receiving and latest snap is freshest"
+ freshest_snap=$last_snap
+ stale=true
+ stale-file
+ continue
+ fi
+