Can't open MSCZ or MXL files zipped in other programs
Decompression is done using Qt's QZipReader, but the ZIP format is not implemented in full so it can't handle zip files created with modern archival tools, such as zip
on macOS or CMake's built-in tar
utility. This means MuseScore is unable to open compressed MuseScore or MusicXML files created in other programs (unless those programs also use outdated ZIP libraries).
QZipReader and QZipWriter are not part of the public Qt API and are not intended for direct use by applications (see https://bugreports.qt.io/browse/QTBUG-3897). To get it working, it appears that Qt's private source files had to be copied into MuseScore's repository and the classes renamed MQZipReader and MQZipWriter to prevent conflicts.
The QZip classes should be replaced with a dedicated C/C++ library for zip files. This will improve compatibility and also have the added bonus of removing another Qt dependency from libmscore.
Comments
Worth mentioning that MXL and MSCZ files created with a new library probably wouldn't open in older versions of MuseScore, so if this isn't fixed before the release of MuseScore 3 then it probably couldn't be fixed until MuseScore 4, whenever that might be...
MusicXML files zipped in other programs still have to comply with the documented format (zip file as described in the 19970311 Info-ZIP note, using the DEFLATE algorithm).
See: https://www.musicxml.com/tutorial/compressed-mxl-files/compressed-file-…
Did you find examples of files meeting these requirements that MuseScore cannot open ?
I don't have any applications that support MusicXML other than MuseScore so I haven't been able to test that, but it can't open MSCZ files that are unzipped and then rezipped using CMake or the built-in
zip
utility on Linux or macOS. Seems to work with files zipped by Window though.The MusicXML page you link to says:
> [The MXL format] is based on the Info-ZIP format described at:
> http://www.info-zip.org/doc/appnote-19970311-iz.zip
I like how the Info-ZIP format specification is stored in a ZIP file... I wonder how you're supposed to read it?
A backwards-compatible way to implement this would be to carry on zipping with
QZipReader
and only use the new library for unzipping.Happily, this problem seems to have disappeared!
I guess I must have been doing something wrong before like zipping an extra directory, or something, but I wouldn't think that could be it because
zipinfo
was reporting a different zip version being required to unzip MuseScore files that for files zipped by CMake and macOS' built-in zip utility, whereas now it reports the same version. Maybe upgrading to Qt 5.12 fixed it, but that shouldn't have done anything because the QZip classes MuseScore uses are not actually part of Qt.Anyway, whatever the reason, I can no longer reproduce the problem.
I’ve recently had an issue where Norton Commander for DOS could not open a PKZIP archive created by “zip” from info-zip on Unix. Turns out that the Unix utilities often write extended attributes, and I now use
zip -D -X -9
(zip -D -X -9 -k
when insisting on 8.3 names inside the archive) to create them.I’ve also seen Windows®-based ZIP writers to use different compression algorithms than standard deflate (to compress better) or to add extra headers.
Perhaps cmake’s is no-frills enough to be able to be opened by Qt.
Automatically closed -- issue fixed for 2 weeks with no activity.