Allow snapshot datasets to contain spaces (#18)

Previously, the `read -r` command ignored content after the first space in a dataset/snapshot name. For example, when trying to remove `MyPool/Media/TV Shows@snapshot-name`, the program would try to instead destroy `MyPool/Media/TV` which (probably) doesn't exist and is a dataset as opposed to a snapshot. This change should be safe because the `zfs list` command will not return any extra information after the creation time, space used, and snapshot name, in that order.
This commit is contained in:
Ryan Petschek 2022-06-12 14:33:29 -04:00 committed by GitHub
parent f1be6dc83d
commit a9d24fc81a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -246,7 +246,7 @@ fi
# first pass of the pools (to calculate totals and filter unwanted datasets
lines=()
while read -r line; do
read -r creation used snapshot _ <<< "$line"
read -r creation used snapshot <<< "$line"
# ensure optional prefix matches
snapname=${snapshot#*@}
@ -317,7 +317,7 @@ echo "found $numsnapshots snapshots ($humantotal) on pools: $humanpools"
# process snapshots found
i=0
for line in "${lines[@]}"; do
read -r creation used snapshot _ <<< "$line"
read -r creation used snapshot <<< "$line"
((i++))