From: Mark Wooding Date: Sun, 6 Mar 2022 23:53:21 +0000 (+0000) Subject: dvdrip: Check for the device size apparently changing during the copy. X-Git-Url: https://git.distorted.org.uk/~mdw/dvdrip/commitdiff_plain/8d83b9f6ad70dc0e3970ce15d2a10137eb4140bc dvdrip: Check for the device size apparently changing during the copy. This indicates something going horribly wrong. --- diff --git a/dvdrip b/dvdrip index 8ff1d98..9634fe0 100755 --- a/dvdrip +++ b/dvdrip @@ -96,6 +96,9 @@ info "copying \`$discid'" echo "$discid" >"$tmp/$tag/discid.new" mv "$tmp/$tag/discid.new" "$tmp/$tag/discid" +if [ -b "$dev" ]; then msz=$(blockdev --getsize64 "$dev") +else msz=nil; fi + echo "$dev" >"$tmp/$tag/device.new" mv "$tmp/$tag/device.new" "$tmp/$tag/device" @@ -152,6 +155,16 @@ if [ ! -f "$tmp/$tag/iso" ]; then if [ -f "$tmp/$tag/badblocks" ]; then fail "bad sectors found: check \`$tmp/$tag/iso', run again if ok" fi + case $msz in + nil) ;; + *) + newmsz=$(blockdev --getsize64 "$dev") + case $newmsz in + $msz) ;; + *) fail "medium size changed ($msz -> $newmsz): try again" ;; + esac + ;; + esac fi rm -f "$tmp/$tag/device"