SHA256
1
0
forked from pool/mdadm
mdadm/mdcheck-careful.patch
Neil Brown 0fbbbc9233 - mdcheck-careful.patch
Be careful about reading all output of "mdadm --detail --export"
  as shell commands - it isn't quoted.
  (bnc#910500)

OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=126
2015-02-03 23:41:59 +00:00

28 lines
877 B
Diff

From 979b1feb093b1c2e0f8b58716329f2da092741d4 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Wed, 4 Feb 2015 09:06:47 +1100
Subject: [PATCH] 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 <neilb@suse.de>
diff --git a/misc/mdcheck b/misc/mdcheck
index ca5fe84a1284..2c8f54d6e4cf 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" ]