Package: mdadm Severity: important Version: 3.3.2-5+deb8u1
If you pass 'generate' to the mkconf script, it attempts to parse some existing values out of the file, then does an "exec >$CONFIG". At this point, the output file has been removed, and is effectively 0 bytes in size. All the existing content is gone.
Later on, if there is an error, the script might abort writing the full file out; this is because set -e is in place.
Please write to a temp file, and do an atomic move at the very end.