entry-directories: skip entries whose desktop file id is not valid UTF-8 - #85
Merged
mtwebster merged 1 commit intoAug 18, 2026
Conversation
The desktop file id is the entry's path relative to the application directory, with the separators turned into dashes, so any byte of the file or directory name that is not valid UTF-8 is handed out as-is by gmenu_tree_entry_get_desktop_file_id(). Introspection bindings refuse to convert such a string. In Cinnamon the menu applet reads the id for every entry in appUtils.js loadDirectory(), so a single badly named file anywhere under an applications directory makes cjs throw "String from C value is invalid UTF-8 and cannot be safely stored", the exception propagates out of the applet constructor, and the applet is never created: the menu button disappears from the panel entirely. Reported as https://bugs.debian.org/893510 in 2018 and again as linuxmint#64 in 2023. Validate the id before handing it to the callback and skip the entry when it is not valid UTF-8, logging the offending path so it can be found and renamed. Doing it here rather than at load time also covers the case where the file name is fine but one of the directories leading to it is not. Assisted-by: Claude Code:claude-opus-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The desktop file id is the entry's path relative to the application directory with the separators turned into dashes, so any byte of the file or directory name that is not valid UTF-8 is handed out as-is by
gmenu_tree_entry_get_desktop_file_id().Introspection bindings refuse to convert such a string. The menu applet reads the id for every entry in
appUtils.jsloadDirectory(), so a single badly named file anywhere under an applications directory makes cjs throw, the exception propagates out of the applet constructor and the applet is never created — the menu button disappears from the panel entirely:Reported as Debian #893510 in 2018 and again as #64 here in 2023.
This validates the id before handing it to the callback and skips the entry when it is not valid UTF-8, logging the offending path so it can be found and renamed. Doing it here rather than at load time also covers the case where the file name is fine but one of the directories leading to it is not — that breaks the applet just the same.
Testing
Tested on Debian unstable with Cinnamon 6.6.9, rebuilding libcinnamon-menu-3-0 6.6.0 with the change. Two cases, a
.desktopfile with a0xE9byte in its name and a correctly named file inside a directory with a0xE9byte in its name:Ignoring "…": its name is not valid UTF-8