/usr/share/mdadm/mkconf attemps to read DEVICE out of /etc/mdadm/mdadm.conf, using sed. It does this, with a simple regex, "s/^DEVICE //p". This is not valid. mdadm.conf(5) says you can have any whitespace after it(space, tab, even newline). The first sentence of the SYNTAX section, says it's a series of words separated by whitespace.
Hi Adam, Doesn't mkconf merely transfer the value? I think the code works as expected. It may not work for other whitespace, as you point out. For multiple spaces, the field value is also not trimmed, but mkconf does not run repeatedly. Either way, I do not think there is a need for mkconf to parse the value the way you describe. Do you have a problem as a result of the code, or are you making an academic point? Thanks for helping to make mdadm better for everyone! Kind regards Felix Lechner