From: NeilBrown Date: Tue, 3 Feb 2015 22:06:47 +0000 (+1100) Subject: mdcheck: be careful when sourcing the output of "mdadm --detail --export" X-Git-Tag: mdadm-3.3.3~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=979b1feb093b1c2e0f8b58716329f2da092741d4;p=thirdparty%2Fmdadm.git mdcheck: be careful when sourcing the output of "mdadm --detail --export" The output of "mdadm --detail --export" isn't quoted properly so fields that contain spaces can be a problem. We only want the MD_UUID field, and it has a very well defined format with no spaces. So use 'grep' to limit the output to just that. Signed-off-by: NeilBrown --- diff --git a/misc/mdcheck b/misc/mdcheck index ca5fe84a..2c8f54d6 100644 --- a/misc/mdcheck +++ b/misc/mdcheck @@ -88,7 +88,7 @@ do continue fi - mdadm --detail --export "$dev" > $tmp || continue + mdadm --detail --export "$dev" | grep '^MD_UUID=' > $tmp || continue source $tmp fl="/var/lib/mdcheck/MD_UUID_$MD_UUID" if [ -z "$cont" ]