-
Notifications
You must be signed in to change notification settings - Fork 171
Description
Environment:
- OS: Windows 11, though I would presume all of them given your typical apathy for win users.
- Frescobaldi version: 4.0.4 (August 2025)
Bug Description:
The snippet XML import feature fails silently on Windows. When importing snippets via the Snippet Manager Menu→Import:
- The import dialog opens correctly
- The XML file is parsed successfully and snippets are displayed in the dialog
- User selects snippets and clicks OK
- Dialog closes with no error message or anything,
- No snippets are actually added to the snippet manager
The dialog appears to work correctly but performs no actual import operation.
Steps to Reproduce:
- Export any existing snippet to XML (Menu→Export)
- Delete the snippet from the snippet manager
- Attempt to re-import the snippet via Menu→Import
- Select the snippet in the dialog and click OK
- Observe that the snippet does not appear in the snippet manager
Root Cause:
Turns out that Frescobaldi depressingly stores snippets in the Windows Registry at:
HKEY_CURRENT_USER\Software\frescobaldi\frescobaldi\snippets
or even
HKEY_USERS\Software\frescobaldi\frescobaldi\snippets
Given this, whats most likely, is that the import function appears to fail when writing multi-line string values (REG_SZ) to the registry. This is a known Windows limitation where multi-line REG_SZ values exported from the registry cannot be re-imported from .reg files - they must be encoded in hex(1) format for import to work.
Why This Is Problematic:
Storing user-editable content like snippets in the Windows Registry is already questionable design practice. It makes the data:
- Non-portable (can't easily copy between machines)
- Difficult to backup
- Harder to version control
- Inaccessible in locked-down enterprise/school environments
But what makes this particularly frustrating is that the XML import/export feature was presumably created to solve these exact problems - yet it doesn't actually work on Windows. So Windows users are stuck with the worst of both worlds: registry-based storage without the ability to import/export snippets that the feature promises.
It's especially ironic given that LilyPond itself is all about human-readable plain text files, yet Frescobaldi chose to store snippets in the Windows Registry - the antithesis of plain text. And when Windows users encounter issues stemming from this architectural choice, they're often met with "works fine on Linux" responses. Well, yes - Linux doesn't use the Windows Registry, so it avoids this entire class of problems.
The "install for current user only" option suggests Frescobaldi doesn't need admin/registry access, which makes the registry storage choice even more puzzling.
Workarounds:
Option 1 (Immediate fix): On Windows, use the Windows Registry API (via ctypes/winreg in Python) or PowerShell via subprocess to write registry values directly instead of generating/importing .reg files. This avoids the multi-line limitation entirely.
Option 2 (Better long-term solution): Store snippets in XML/JSON files in %APPDATA%\frescobaldi\snippets\ instead of the Windows Registry.
Additional Notes:
This bug affects Windows 7, 10, and 11 (likely all Windows versions) as it's a limitation of the Windows Registry Editor's .reg file format, not a specific Windows version issue.
The XML export feature works correctly - only import is affected.