Aptivi<p><strong>GNOME fixes the Trash bug from 2009!</strong></p><p>GNOME Desktop had a bug in the Trash function where the leftover files from the user-wide expunged trash directory, found in <code>~/.local/share/Trash/expunged</code>, were not being deleted properly, and that the Nautilus file manager, which GNOME uses, inaccurately reported that the trash was empty. This bug was originally reported in Ubuntu’s Launchpad under the title of “<a href="https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/422012" rel="nofollow noopener noreferrer" target="_blank">Emptying the trash can lead to have files still on disk in expunged</a>.”</p><p>This caused problems with the free disk space, since the bug reporter had stated that they had about 70 GB of files in the expunged directory, which were handled incorrectly when emptying the trash. Furthermore, said directory was found in the hidden .local folder underneath your home directory, which was not obvious to the average user. This was said to be due to wrong permissions being applied to the offending files, and a reproducer was found:</p><pre><code>mkdir -p test/roottouch test/root/filesudo chown root:root test/root</code></pre><p>This followed the two chained rules, first for trashing and second for emptying, where, <em><a href="https://ignapk.blogspot.com/2025/06/taking-out-trash-or-just-sweeping-it.html" rel="nofollow noopener noreferrer" target="_blank">ipsis verbis</a></em>:</p><ul><li>when a directory A is in a directory owned by you and it’s owned by you, you can obviously move it.</li><li>when a directory B is in a directory A owned by you but you don’t own it, <strong>and it’s not empty</strong>, you can’t delete it.</li></ul><p>So, essentially, this boils down to:</p><ul><li>The <code>test</code> directory is made by the current user (assume that the current user is <code>aptivi</code>)</li><li>The <code>root</code> directory inside the user-owned <code>test</code> directory is made by <code>aptivi</code></li><li>A file, <code>file</code>, which <code>aptivi</code> owned, was created inside the <code>root</code> directory</li><li>The <code>root</code> directory’s owner had changed to the <code>root</code> user</li><li>The <code>test</code> directory can be moved to <code>aptivi</code>‘s trash, since the first chained rule has been followed<ul><li><em>Explanation:</em> <code>test</code> was owned by <code>aptivi</code> and had a parent directory that was also owned by <code>aptivi</code></li></ul></li><li>The <code>root</code> directory can’t be deleted from <code>aptivi</code>‘s trash, since the second chained rule has been followed<ul><li><em>Explanation:</em> <code>root</code>, a non-empty directory owned by <code>root</code>, was inside <code>test</code>, owned by <code>aptivi</code>, and the <code>root</code> directory can’t be removed</li></ul></li><li>The <code>root</code> directory can now be found underneath the <code>expunged</code> folder under <code>aptivi</code>‘s .local folder</li></ul><p>The <a href="https://gitlab.gnome.org/GNOME/glib/-/issues/1665" rel="nofollow noopener noreferrer" target="_blank">appropriate GNOME bug tracker ticket</a> was brought to the upstream developers six years ago from writing who confirmed that the issue was happening. According to this blog post, the <a href="https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4653" rel="nofollow noopener noreferrer" target="_blank">merge request</a> was submitted to the GNOME project, which was approved. The fix is now at the upstream GLib code.</p><p>An internal function was added to the I/O part of the GLib library, called <a href="https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4653/diffs#c12e9d12f961d46f8c4d0917bd27f5caa09824d4_2000_2010" rel="nofollow noopener noreferrer" target="_blank"><code>check_removing_recursively()</code></a>, that checked whether “subsequently deleting the original file from the trash (in the gvfsd-trash process) will succeed.” It also checked the ownership of the files before deletion and automatically assigned the file mode <code>(chmod)</code> to allow deletion.</p><p>That filled one of the <code>TODO</code> tasks in the I/O code that handled emptying the trash in the internal function, <a href="https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4653/diffs#c12e9d12f961d46f8c4d0917bd27f5caa09824d4_2380_2458" rel="nofollow noopener noreferrer" target="_blank"><code>g_local_file_trash()</code></a>. It said “Maybe we should verify that you can delete the file from the trash before moving it? OTOH, that is hard, as it needs a recursive scan.”</p><p>Now, you can empty the trash without worrying about the free disk space, but only if your Linux distribution uses a version of GNOME that contains this fix. We expect that this fix will land to several distributions in the coming days or weeks.</p><p><strong>Pro tip: to eliminate the remaining expunged files after installing the fixed version of GNOME, <a href="https://askubuntu.com/a/351408" rel="nofollow noopener noreferrer" target="_blank">use this trick</a> to free up disk space.</strong></p><p><span></span></p><p><a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/gnome/" target="_blank">#GNOME</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/gnome-desktop/" target="_blank">#GNOMEDesktop</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/linux/" target="_blank">#Linux</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/linux-desktop/" target="_blank">#LinuxDesktop</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/news/" target="_blank">#news</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/tech/" target="_blank">#Tech</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/technology/" target="_blank">#Technology</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/trash/" target="_blank">#Trash</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/trash-bin/" target="_blank">#TrashBin</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/update/" target="_blank">#update</a></p>