MusicXML import hangs on `<other-notation>` without a `smufl` attribute (regression from 3.x)

Open Beginner friendly
#35,909 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start in src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp at MusicXmlParserNotations::otherNotation(); the issue identifies the element skip as conditional on the smufl attribute. Check nearby MusicXML import handling and run the supplied minimal file through the import command. Done when it imports without hanging when smufl is absent and still handles the smufl form.

Written by the indexing model from the issue text.

Description

Describe the bug
Importing a valid MusicXML file that contains <other-notation> without a smufl attribute never finishes. <other-notation> is part of the MusicXML 4.0 schema, and smufl is optional (type is the only required attribute). MuseScore 3.6.2 imports the same file.

To reproduce

  1. Save the file below as other-notation-minimal.musicxml (one measure, one note; it validates against the MusicXML 4.0 XSD).
<?xml version="1.0" encoding="UTF-8"?>
<score-partwise version="4.0">
  <part-list>
    <score-part id="P1"><part-name>Voice</part-name></score-part>
  </part-list>
  <part id="P1">
    <measure number="1">
      <attributes>
        <divisions>1</divisions>
        <key><fifths>0</fifths></key>
        <time><beats>4</beats><beat-type>4</beat-type></time>
        <clef><sign>G</sign><line>2</line></clef>
      </attributes>
      <note>
        <pitch><step>C</step><octave>4</octave></pitch>
        <duration>4</duration>
        <type>whole</type>
        <notations>
          <other-notation type="single">x</other-notation>
        </notations>
      </note>
    </measure>
  </part>
</score-partwise>
  1. Open it in MuseScore Studio 4.7.7, or run MuseScore4.exe -o out.pdf other-notation-minimal.musicxml.
  2. The import does not finish (I killed it after 40 s; the process does not exit by itself).

Expected
The file imports, ignoring the element, or importing it as the smufl form does. The same file with <other-notation type="single" smufl="articStaccatoAbove">x</other-notation> imports normally.

What I found

  • The hang happens for every form tried without smufl: type="single" with and without number, an empty element, text content, type="start"/"stop" pairs, and next to other <notations> children. <other-technical>, <other-ornament> and <other-direction> do not hang.
  • Reading the source at tag v4.7.7 (src/importexport/musicxml/internal/import/importmusicxmlpass2.cpp): MusicXmlParserNotations::otherNotation() (line 9668) calls m_e.skipCurrentElement() only inside if (!smufl.empty()). Without smufl the element is not consumed, so the reader is out of step with the document afterwards. That the desync causes the hang is my inference; I did not find the looping code. main has the same code (line 9749 when I read it).
  • 3.6.2 (importmxmlpass2.cpp) has no other-notation branch, so its generic skipLogCurrElem() skips the element.
  • Suggested fix: call m_e.skipCurrentElement() in the else case too (or after the if), so the element is always consumed.

Environment
MuseScore Studio 4.7.7 (4.7.7-261109195), Windows 11, command-line and the same behaviour expected from the GUI (the GUI was not tested).

Dominant language
C++
Stars
15.5k
Forks
3.5k
Avg merge
2d 19h
Merged PRs (30d)
124

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from musescore/MuseScore

All issues in musescore/MuseScore

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.