File Names & Corrupt Fie Error

• Sep 5, 2021 - 20:18

Howdy --

I know that it's contrary to most modern practice, but my preference is to have capitalized filename extensions (e.g.: .TXT, .MSCZ, .WAV, etc.). I prefer it because I like to be able to distinguish file types at a glance.

I just started working on my first score with MuseScore, and I saved my work with a .MSCZ extension. MuseScore did not complain, and appeared to be saving my work. Next day, I attempted to open the file on which I had been working, and I got a dialog box informing me that the file had become corrupted. One option presented was to open it anyway. I chose that option, and got a big empty nothing.

I had a feeling. I've been an IT professional for decades. I had a suspicion. I renamed the file, just changing the extension to lower case and, voilà, the file opened without error.

This error is reproducible. I tried restoring the upper case extension and the error returned.

OS: Windows 8.1 (6.3), Arch.: x86_64, MuseScore version (64-bit):, revision: 3224f34

-- Herb


MuseScore never by itself creates files with uppercase extensions though, not MuseScore 3.6.2 on Windows 10 anyhow.
If you try, it won't save at all.
So I guess you must be renaming them manually?

the fix seems an easy one-liner (for 3.x, seems more involved for master, AKA MuseScore 4?):

diff --git a/libmscore/scorefile.cpp b/libmscore/scorefile.cpp
index d40840adf..fd8c3f42c 100644
--- a/libmscore/scorefile.cpp
+++ b/libmscore/scorefile.cpp
@@ -942,7 +942,7 @@ Score::FileError MasterScore::loadMsc(QString name, QIODevice* io, bool ignoreVe
       ScoreLoad sl;
-      if (name.endsWith(".mscz") || name.endsWith(".mscz,"))
+      if (name.endsWith(".mscz", Qt::CaseInsensitive) || name.endsWith(".mscz,", Qt::CaseInsensitive))
             return loadCompressedMsc(io, ignoreVersionError);
       else {
             XmlReader r(io);

That at least allows opening them. Still won't allow for saving them with anything but an all lowercase extension.
Maybe similar changes are needed at some other places too, like all other import formats. That method is used already for .gtp, .gp and .gpx import (GuitarPro), but as far as I can tell those are the only ones.

Funny enough for .mscx vs. .MSCZ this is not an issue, neither for .XML, .MXL or .MUSICXML, so maybe only MSCZ is the problem here? In that case it really is just that one liner above (at least as far as opening such a score, not as far as creating it)

In reply to by Jojo-Schmitz

Jojo - -

I created the score in question from MuseScore directly with upper case extension. I did not rename the file outside of MuseScore.

The problem evidenced itself after having closed MuseScore, and then going back in to further edit the score. I was attempting to open the same filename that MuseScore had saved.

    • Herb

In reply to by Jojo-Schmitz

I can reproduce this error on two different machines: one is Windows 8.1, and the other is Windows 10. Both are on NTFS, on all drives.

No FAT32.

I'm currently at a different location. I can try on a third machine if you'd like.

Are you testing on the same build as mine?

This is exactly what I did:
1. Opened MuseScore.
2. Clicked New Score.
3. Set the title to test.
4. Selected the Grand Staff template
5. Used the default settings for everything else.
6. Hit Ctrl+S.
7. Saved as C:\Users\XXXXXX\Desktop\MuseScore\test.MSCZ
8. Closed MuseScore.
9. Double-clicked on the new test.MSCZ file.
10. Got the same result.

OS: Windows 10 (10.0), Arch.: x86_64, MuseScore version (64-bit):, revision: 3224f34
Also, the drive's file system was NTFS.

This is undeniably (well, you can deny it, but you would be wrong) a bug.

In reply to by ThePython10110

The fact that MuseScore reports a .MSCZ file corrupt indeed is a bug, and with a known fix.

The part with saving it that way is still to be determined, I still can't reproduce it not wuth any of the steps you mentioned so far, it just doesn't save the file at all in those cases (and without an error message, which certainly is a bug).

In reply to by ThePython10110

Step 7 simply doesn't work here; the file is not saved.
Changing ui/application/useNativeDialogs seems to not affect this. For me MuseScore simply does not save a file with an uppercase extension.

What we indeed can confirm is that if you have a file with an uppercase extension, it wrongly can't be opened (so step 9 and 10).
Are you by any chance using a different file manager than the default Windows File Explorer?

Do you still have an unanswered question? Please log in first to post your question.