]> git.ipfire.org Git - thirdparty/mdadm.git/commit - Detail.c
Detail: ensure --export names are acceptable as shell variables.
authorNeilBrown <neilb@suse.com>
Thu, 20 Apr 2017 02:40:06 +0000 (12:40 +1000)
committerJes Sorensen <jsorensen@fb.com>
Thu, 20 Apr 2017 16:59:22 +0000 (12:59 -0400)
commitb9c9bd9bacaab701d5b3cb3e4b6cb02ea8d36e47
tree00f30d4b1402f1969111bae2e51f0037cd7ebcd0
parent5c4b3b9aa9f576305b36d5ccbd4b929b51307ce9
Detail: ensure --export names are acceptable as shell variables.

If an array contains a device which has a name that
contains something other than alphnumerics and underscores,
then some values reported by "mdadm --detail --export" will
not be valid as variable assignment of the shell.
This particularly affects dm devices.
e.g.
   MD_DEVICE_dm-4_ROLE=1
   MD_DEVICE_dm-4_DEV=/dev/dm-4

As it is particularly useful to be able to work with these
in a shell script, and as the precise name is not important,
change all non-alphanumerics to '_'.

   MD_DEVICE_dm_4_ROLE=1
   MD_DEVICE_dm_4_DEV=/dev/dm-4

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Detail.c