dmraid: Handle spaces in names stored in vendor metadata.
Hi Heinz,
I sent you a few patches a few weeks ago which fixes some problems
with the dmraid Makefile, but haven't heard back? Let me know
if I should resend them.
Here is another patch. This is related to a rather ancient discussion
which included
I think I can get you the "dmraid -rD" output that you asked for in
that email if you are still interested, but the problem is fairly
simple to identify and affects ddf1 and isw metadata as they contain
strings that are included in the name.
This patch changes any spaces (and other special characters) in those
names to '_'.
Thanks,
NeilBrown
-------------
When dmraid activates an array, it builds a name from information in
the metadata. For two formats of metadata (isw and ddf1), the
information can include a textual string.
dmraid does not allow arrays be created with spaces in the name and
so makes no attempt to handle spaces well. So for consistency it
should not allow spaces stored in the metadata to get in to the name
either.
This patch changes every character that dmraid would not allow in a
name to be converted to '_'
- return snprintf(str, len, f->fmt, isw->family_num, f->what, num);
+ n = snprintf(str, len, f->fmt, isw->family_num, f->what, num);
+ /* As '->volume' could contain anything, we need to sanitise the name */
+ if (str)
+ mk_alphanum(lc, str, n);
+ return n;
}