]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdcheck: be careful when sourcing the output of "mdadm --detail --export"
authorNeilBrown <neilb@suse.de>
Tue, 3 Feb 2015 22:06:47 +0000 (09:06 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 3 Feb 2015 22:06:47 +0000 (09:06 +1100)
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 <neilb@suse.de>
misc/mdcheck

index ca5fe84a12846ddb4fac72054b6d8b355ffb4e1f..2c8f54d6e4cf6545cd464840c3882f0eace54d62 100644 (file)
@@ -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" ]