Remove "blockdev --setro" code path
authorColin Watson <cjwatson@debian.org>
Wed, 18 Jan 2017 16:17:40 +0000 (16:17 +0000)
committerColin Watson <cjwatson@debian.org>
Thu, 19 Jan 2017 21:01:49 +0000 (21:01 +0000)
Remove the "blockdev --setro" code path entirely, since the read-only
device-mapper arrangement supersedes it and should be safer
(closes: #648208).

common.sh
debian/changelog
linux-boot-probes/common/50mounted-tests
os-probes/common/50mounted-tests

index f17a72c..c1834ef 100644 (file)
--- a/common.sh
+++ b/common.sh
@@ -3,13 +3,7 @@ newns () {
 }
 
 cleanup_tmpdir=false
-cleanup_ro_partitions=
 cleanup () {
-  local partition
-  for partition in $cleanup_ro_partitions; do
-    blockdev --setrw "$partition"
-    debug "partition $partition set to read-write"
-  done
   if $cleanup_tmpdir; then
     rm -rf "$OS_PROBER_TMP"
   fi
@@ -170,18 +164,6 @@ unescape_mount () {
                sed 's/\\011/   /g; s/\\012/\n/g; s/\\040/ /g; s/\\134/\\/g'
 }
 
-ro_partition () {
-       if type blockdev >/dev/null 2>&1 && \
-          [ "$(blockdev --getro "$1")" = 0 ] && \
-          blockdev --setro "$1"; then
-               debug "partition $1 set to read-only"
-               cleanup_ro_partitions="${cleanup_ro_partitions:+$cleanup_ro_partitions }$1"
-               trap cleanup EXIT HUP INT QUIT TERM
-       else
-               warn "setting partition $1 to read-only failed"
-       fi
-}
-
 find_label () {
        local output
        if type blkid >/dev/null 2>&1; then
@@ -318,13 +300,6 @@ linux_mount_boot () {
                                                else
                                                        error "failed to mount $dm_device on $tmpmnt/boot: $mountinfo"
                                                fi
-                                       else
-                                               ro_partition "$boottomnt"
-                                               if mount -o ro "$boottomnt" "$tmpmnt/boot" -t "$3"; then
-                                                       mounted=1
-                                               else
-                                                       error "failed to mount $boottomnt on $tmpmnt/boot"
-                                               fi
                                        fi
                                fi
                        fi
index 4059a9d..04e586e 100644 (file)
@@ -6,6 +6,9 @@ os-prober (1.72) UNRELEASED; urgency=medium
     underlying device to read-only (thanks, Ivo De Decker; closes: #701814).
     Note that this introduces a dependency on dmsetup on Linux
     architectures.
+  * Remove the "blockdev --setro" code path entirely, since the read-only
+    device-mapper arrangement supersedes it and should be safer (closes:
+    #648208).
 
  -- Colin Watson <cjwatson@debian.org>  Sat, 31 Dec 2016 17:11:49 +0000
 
index 407c9c4..bb7e005 100755 (executable)
@@ -73,17 +73,6 @@ elif dm_device="$(do_dmsetup osprober-linux "$partition")" && \
                        debug "mounting $dm_device ($partition) as $type failed: $mountinfo"
                fi
        done
-else
-       ro_partition "$partition"
-       for type in $types; do
-               if mountinfo=`mount -o ro -t "$type" "$partition" "$tmpmnt" 2>&1`; then
-                       debug "mounted as $type filesystem"
-                       mounted=1
-                       break
-               else
-                       debug "mounting $partition as $type failed: $mountinfo"
-               fi
-       done
 fi
 
 if [ "$mounted" ]; then
index 51ee254..f2a007d 100755 (executable)
@@ -82,17 +82,6 @@ elif dm_device="$(do_dmsetup osprober "$partition")" && \
                        debug "mounting $dm_device ($partition) as $type failed: $mountinfo"
                fi
        done
-else
-       ro_partition "$partition"
-       for type in $types $delaytypes; do
-               if mountinfo=`mount -o ro -t "$type" "$partition" "$tmpmnt" 2>&1`; then
-                       debug "mounted as $type filesystem"
-                       mounted=1
-                       break
-               else
-                       debug "mounting $partition as $type failed: $mountinfo"
-               fi
-       done
 fi
 
 if [ "$mounted" ]; then