Distribution / versions
- Arch Linux, Cinnamon session on X11
- nemo 6.6.4, xapp 3.2.3, glib2 2.88.3, gtk3 3.24.52, cinnamon-desktop 6.6.2, glycin 2.1.5
- The code path is unchanged on current
master.
Issue
Nemo aborts when it shows the contents of a favorited folder through its favorites:///<name> location, and that folder contains a file that has no cached thumbnail yet. The same folder opens without problems through its normal file:// path.
(nemo): Nemo-WARNING **: File has symlink target, but is not marked as symlink
(nemo): GLib-GIO-CRITICAL **: g_file_new_for_uri: assertion 'uri != NULL' failed
**
Nemo:ERROR:../nemo/libnemo-private/nemo-file.c:679:nemo_file_get_internal: assertion failed: (location != NULL)
Bail out! Nemo:ERROR:../nemo/libnemo-private/nemo-file.c:679:nemo_file_get_internal: assertion failed: (location != NULL)
Steps to reproduce
- Add a folder that contains images (e.g. PNG/JPG/SVG) to Favorites, for example
~/tmp.
- Make sure those images have no thumbnails yet. For a clean test, run nemo with an empty cache:
XDG_CACHE_HOME=$(mktemp -d) nemo favorites:///tmp
- Nemo crashes with SIGABRT as soon as the list view renders the icons.
Control test: XDG_CACHE_HOME=$(mktemp -d) nemo ~/tmp works and creates the thumbnails.
Expected behaviour
Nemo shows the folder contents and creates thumbnails (or just shows the generic icons). It does not crash.
Stack trace (main thread)
#4 g_assertion_message_expr (libglib-2.0)
#5 nemo_file_get_internal nemo-file.c:679 (via nemo_file_get_by_uri)
#6 nemo_create_thumbnail nemo-thumbnails.c
#7 nemo_file_get_icon nemo-file.c
#8 nemo_list_model_get_value nemo-list-model.c
#17 gtk_cell_area_apply_attributes (libgtk-3)
...
#25 g_application_run
(Frames 5–8 were mapped against the 6.6.4 source. The binary has no symbols, but the assertion message and the call chain match.)
Analysis
In libnemo-private/nemo-thumbnails.c, nemo_create_thumbnail() does:
if (nemo_file_is_in_favorites (file)) {
uri = nemo_file_get_symbolic_link_target_uri (file);
real_file = nemo_file_get_by_uri (uri); /* uri can be NULL */
...
}
nemo_file_is_in_favorites() → nemo_directory_is_in_favorites() only checks whether the parent directory has the favorites URI scheme. That is true for the top-level items in favorites:///, which XApp exposes as symlinks. It is also true for every file inside a favorited folder opened as favorites:///<folder>. Those files are not symlinks, so symlink_name is NULL and nemo_file_get_symbolic_link_target_uri() returns NULL. That produces the "is not marked as symlink" warning. Then nemo_file_get_by_uri (NULL) → g_file_new_for_uri (NULL) returns NULL → g_assert (location != NULL) aborts.
Possible fix
At a minimum, only follow the link when there is one, for example:
if (nemo_file_is_in_favorites (file) && nemo_file_is_symbolic_link (file)) {
or check uri != NULL before calling nemo_file_get_by_uri(). A complete fix also needs to resolve the real file:// location for files below a favorited folder, so that they get thumbnails too.
Distribution / versions
master.Issue
Nemo aborts when it shows the contents of a favorited folder through its
favorites:///<name>location, and that folder contains a file that has no cached thumbnail yet. The same folder opens without problems through its normalfile://path.Steps to reproduce
~/tmp.XDG_CACHE_HOME=$(mktemp -d) nemo favorites:///tmpControl test:
XDG_CACHE_HOME=$(mktemp -d) nemo ~/tmpworks and creates the thumbnails.Expected behaviour
Nemo shows the folder contents and creates thumbnails (or just shows the generic icons). It does not crash.
Stack trace (main thread)
(Frames 5–8 were mapped against the 6.6.4 source. The binary has no symbols, but the assertion message and the call chain match.)
Analysis
In
libnemo-private/nemo-thumbnails.c,nemo_create_thumbnail()does:nemo_file_is_in_favorites()→nemo_directory_is_in_favorites()only checks whether the parent directory has thefavoritesURI scheme. That is true for the top-level items infavorites:///, which XApp exposes as symlinks. It is also true for every file inside a favorited folder opened asfavorites:///<folder>. Those files are not symlinks, sosymlink_nameis NULL andnemo_file_get_symbolic_link_target_uri()returns NULL. That produces the "is not marked as symlink" warning. Thennemo_file_get_by_uri (NULL)→g_file_new_for_uri (NULL)returns NULL →g_assert (location != NULL)aborts.Possible fix
At a minimum, only follow the link when there is one, for example:
or check
uri != NULLbefore callingnemo_file_get_by_uri(). A complete fix also needs to resolve the realfile://location for files below a favorited folder, so that they get thumbnails too.