Summary
Pressing Ctrl+D to bookmark the Home folder multiple times creates duplicate entries in ~/.config/gtk-3.0/bookmarks.
Steps to reproduce
- Open Nemo and navigate to your home directory (
/home/$USER)
- Press Ctrl+D (Add Bookmark)
- Press Ctrl+D again
- Open
~/.config/gtk-3.0/bookmarks — you will see multiple lines for the same location
Example file content:
file:///home/r Home
file:///home/r Home
file:///home/r Home
file:///home/r r
Root cause
The duplicate check in nemo_bookmark_list_contains() (src/nemo-bookmark-list.c:421-424) uses nemo_bookmark_compare_with(), which compares both the URI and the display name.
When a bookmark is first created by nemo_window_add_bookmark_for_current_location(), its initial name is the basename of the path (e.g. "r" for /home/r). Shortly after, bookmark_set_name_from_ready_file() asynchronously renames it to "Home" because nemo_file_is_home() returns TRUE.
On the next Ctrl+D:
- The existing bookmark has name
"Home"
- The new bookmark has name
"r" (not yet renamed)
nemo_bookmark_compare_with() sees "r" ≠ "Home" → reports not duplicate
- A second entry is appended
Proposed fix
In src/nemo-bookmark-list.c:423, change:
g_list_find_custom (bookmarks->list, (gpointer) bookmark, nemo_bookmark_compare_with)
to:
g_list_find_custom (bookmarks->list, (gpointer) bookmark, nemo_bookmark_compare_uris)
The function nemo_bookmark_compare_uris() already exists in libnemo-private/nemo-bookmark.c and compares only the URI. Bookmark identity should be based on location, not label.
Version
Nemo 6.6.3 (source 6.0.2 contains the same logic)
Summary
Pressing Ctrl+D to bookmark the Home folder multiple times creates duplicate entries in
~/.config/gtk-3.0/bookmarks.Steps to reproduce
/home/$USER)~/.config/gtk-3.0/bookmarks— you will see multiple lines for the same locationExample file content:
Root cause
The duplicate check in
nemo_bookmark_list_contains()(src/nemo-bookmark-list.c:421-424) usesnemo_bookmark_compare_with(), which compares both the URI and the display name.When a bookmark is first created by
nemo_window_add_bookmark_for_current_location(), its initial name is the basename of the path (e.g."r"for/home/r). Shortly after,bookmark_set_name_from_ready_file()asynchronously renames it to"Home"becausenemo_file_is_home()returns TRUE.On the next Ctrl+D:
"Home""r"(not yet renamed)nemo_bookmark_compare_with()sees"r"≠"Home"→ reports not duplicateProposed fix
In
src/nemo-bookmark-list.c:423, change:to:
The function
nemo_bookmark_compare_uris()already exists inlibnemo-private/nemo-bookmark.cand compares only the URI. Bookmark identity should be based on location, not label.Version
Nemo 6.6.3 (source 6.0.2 contains the same logic)