#754170 fails to exclude RAID members

Package:
os-prober
Source:
os-prober
Description:
utility to detect other OSes on a set of drives
Submitter:
Matus UHLAR - fantomas
Date:
2014-07-08 11:03:05 UTC
Severity:
normal
#754170#5
Date:
2014-07-08 10:47:24 UTC
From:
To:
Hello,

the os-prober fails to exclude partittions that are members of md RAID, when
dash is installed as /bin/sh.

The parse_proc_mdstat() function fails to detect them. I found the bug to
lie in line:

                        dev="${word%%[*}"

dash fails to strip opening square bracke to the rest of the line.
Escaping it with backslash works with both bash and dash.
Here's the patch that fixes the behaviour:
--- os-prober.orig	2012-08-02 02:49:55.000000000 +0200
+++ os-prober	2014-07-08 12:46:41.173761806 +0200
@@ -81,7 +81,7 @@
 	fi
 	while read line; do
 		for word in $line; do
-			dev="${word%%[*}"
+			dev="${word%%\[*}"
 			# TODO: factor this out to something in di-utils if
 			# it's needed elsewhere
 			if [ -d /sys/block ] && type udevinfo >/dev/null 2>&1; then