From c7420318e2c0bdc910fa81528b035dee7eea1255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 15 Sep 2017 05:25:42 +0200 Subject: [PATCH] udev: fix loop devices exclusion based on directory flagfile Getting loop device backing file path was broken: ${NAME%p*} for not-partitioned devices will cut the actual device name. Use full name instead. This probably breaks handling partitioned devices, but such devices should not appear in a directory flagged to be ignored (VM images) QubesOS/qubes-issues#3084 --- udev/udev-block-add-change | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev-block-add-change b/udev/udev-block-add-change index d3dce92..ecec920 100755 --- a/udev/udev-block-add-change +++ b/udev/udev-block-add-change @@ -45,7 +45,7 @@ refresh_another() { # launch this script for other device local devpath=$1 local launch_env=$(udevadm info -q all -x -p "$devpath" \ - | grep ^E: | cut -d ' ' -f 2-) + | grep ^E: | cut -d ' ' -f 2- | tr ' ' ':') env -i PATH=$PATH $launch_env $0 } @@ -122,7 +122,7 @@ fi # ... and loop devices from excluded directories if [[ "$NAME" = 'loop'* ]]; then - backing_file=$(cat /sys/block/${NAME%p*}/loop/backing_file) + backing_file=$(cat /sys/block/${NAME}/loop/backing_file) if [ -n "$backing_file" ]; then dir_to_check=$(dirname "$backing_file") while [ "$dir_to_check" != "/" -a "$dir_to_check" != "." ]; do