Skip to content

Add the Version element to a written MPC XPM file - #346

Open
douglas-carmichael wants to merge 1 commit into
git-moss:mainfrom
douglas-carmichael:fix-mpc-xpm-version
Open

Add the Version element to a written MPC XPM file#346
douglas-carmichael wants to merge 1 commit into
git-moss:mainfrom
douglas-carmichael:fix-mpc-xpm-version

Conversation

@douglas-carmichael

Copy link
Copy Markdown
Contributor

A written XPM cannot be read back by ConvertWithMoss itself:

Analyzing: TestInst_C.xpm
Could not read metadata: Unknown Root

MPCKeygroupCreator.createXmlDocument creates the Version element and fills in the file version, but it never appends it to the document, so it does not reach the file. MPCModernDetector.getProgramElement needs the root, a Version child and a Program child, and reports "Unknown Root" for anything else - so every XPM written so far is rejected on the way back in.

The fix

Append the element, and write the platform next to the file version so the log line Detected MPC keygroup version %1, written on %2. has both of its values.

<MPCVObject>
    <Version>
        <File_Version>2.1</File_Version>
        <Platform>Linux</Platform>
    </Version>
    <Program type="Keygroup">

Verification

The unchanged reader of the current main accepts the file written by this branch:

Detected MPC keygroup version 2.1, written on Linux.
Analyze: 'TestInst_C' OK

That is the part worth pointing at - the reader was not touched, so this confirms the Version element is exactly what it was missing rather than a new requirement being introduced.

The written XPM is otherwise unchanged: diffing the output of main against this branch shows only the four added lines, and the sample files are byte-identical.

Not verified on a device. The element matches what hardware-written XPM files carry, and its absence was plainly an oversight rather than a deliberate omission, but I have no MPC here to load the result on.

The element was created and filled with the file version, but it was
never appended to the document, so it did not end up in the file. It is
the element by which the format is recognized: getProgramElement wants
the root, a Version child and a Program child, therefore a written XPM
was rejected when it was read back again.

  Analyzing: TestInst_C.xpm
  Could not read metadata: Unknown Root

Append it, and write the platform next to the file version so that the
'Detected MPC keygroup version %1, written on %2.' log line is complete.
The unchanged reader of the current release accepts the resulting file,
which confirms that this is the element it was missing. The written XPM
is otherwise unchanged and the samples are byte-identical.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant