I've installed the SPECTRUM installation profile which comes with CA 1.6.1. I've made a few minor modification to the data model to match with my own organisations' business requirements.
I can export the installation profile, but when I try to use it again, it fails with an error: "There were errors parsing the profile(s): Profile validation failed. Your profile doesn't conform to the required XML schema."
I've validated the resulting profile with xmllint using this command:
xmllint --no-out --schema profile.xsd myschema.xml
Validation fails because of this error: placement with duplicate key "ca_attribute_fieldCollectionEv"
When I go check inside myschema.xml, I can see that I have indeed two elements with the same code attribute:
Obviously, this is a bug. I've hunted through the CA codebase and found the cause:
In ConfigurationExporter.php on line 738: this happens to generate the code attribute value:
The function signature of the makeIDNO() method accepts a $pn_length parameter which is by default set to 30 characters.
This means that any placement code or ca_attribute prefixed attribute name which is longer then 30 characters, will get truncated. This means that you risk creating duplicate keys.
Suggestion: get rid of the truncation logic in the makeIDNO method on line 1277.
It's not advisable to truncate a machine key in the first place. In this case, the profile wouldn't work on installation, worst case would be that it does work but you risk ending up with an inconsistent database if other parts of the profile refer to a the original, unaltered machine code.