Thunar and Trash Applet report that Trash is empty when it is not

Bug #880533 reported by Gretha
38
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Thunar File Manager
Fix Released
Medium
thunar (Ubuntu)
Fix Released
High
Unassigned

Bug Description

System: Xubuntu 11.10, fully updated

The Thunar Trash icon in the xfce panel shows mouse-hover-balloon: "Wastebasket is empty", and the trash icon is displayed as the empty icon. Yet, the waste bin does contains one deleted file.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in thunar (Ubuntu):
status: New → Confirmed
Revision history for this message
Mike Kupfer (mkupfer37) wrote :

Hrm, I'm still seeing this issue (icon shows empty trash, even though it contains 2 files) with today's 12.10 beta bits (xfdesktop4 4.10.0-1ubuntu1, thunar 1.4.0-1ubuntu2). So either 861267 was incorrectly marked fixed, or this is not a duplicate of 861267.

What's really annoying is that when I open up the Trash, I can see the 2 files, and I can Restore them, but the "empty trash" operation is grayed out.

This is trivial for me to reproduce: delete a file in Thunar, then log out and login again.

Revision history for this message
Mike Kupfer (mkupfer37) wrote :

Minor correction about "empty trash": it's grayed out if I right-click on the trash icon or if I right-click on the "Trash" widget in the pathbar. But it's invocable from the File menu.

Revision history for this message
Mike Kupfer (mkupfer37) wrote :

Under the assumption that 861267 is really fixed, I cleared the duplicate linkage.

Revision history for this message
Mike Kupfer (mkupfer37) wrote :

Workaround: restart xfdesktop. For example, I have an application autostart entry that does "xfdesktop --reload".

Revision history for this message
Mike Kupfer (mkupfer37) wrote :

Sorry... I didn't read the original description as closely as I should have, so I didn't realize this bug report was referring to the trash applet, not the desktop icon. (I do see the same issue, though, with the desktop trash icon: it's shown as empty when it actually contains something). My workaround (comment #5) only works for the desktop trash icon, not the panel icon.

Revision history for this message
In , frenchy82 (cartes) wrote :

With Thunar 1.5.2 from PPA, if you put a file in the trash, then trash is not empty and you can empty the trash.

But if you close the session et open it then thunar shows an empty trash and you can't empty it

Revision history for this message
In , 8-nick (8-nick) wrote :

Fixed in 60e9680.

Revision history for this message
In , b3nmore (b3nmore) wrote :

Still an issue here with 1.6.0.

Closing all thunar windows and then opening a new one corrects the trash state. Alternatively calling 'gvfs-ls trash:' before opening thunar the first time also sets the correct trash state.

Revision history for this message
In , frenchy82 (cartes) wrote :

Still have this problem too with thuanr 1.6.0

Revision history for this message
In , 8-nick (8-nick) wrote :

Its a race, but the gvfs-trash daemon does not send a file-changed signal. With the idle it looked like it was fixed, but i can delay it too.

Revision history for this message
In , 8-nick (8-nick) wrote :

Delayed check to 2 seconds. Can someone check if this works?

Revision history for this message
In , i (iiiiii-deactivatedaccount) wrote :

Isn't working neither with xfdesktop nor with Thunar (1.6.1).

Revision history for this message
In , 8-nick (8-nick) wrote :

Code is checking for 15 seconds now with 3s intervals or files are found.

Revision history for this message
In , frenchy82 (cartes) wrote :

Sorry, but this is still not working with Thunar 1.6.2
But maybe this patch is not include in it

Revision history for this message
Travis Knight (dick-swift00) wrote :

12.04; 12.10; 13.04 all also exhibit this behavior from time to time (currently experiencing the "Empty Trash" icon on the desktop, but opening shows files/folders. Worse though is a recent update (I guess) to 13.04 has rendered the use of "Trash" inoperable:
From Thunar, keyboard "DEL" or right-click "move to trash" result in "Are you sure want to permanently delete...." Cancel/Delete choices.

Seems relevant to this bug vs. starting a new one...but I'm open to challenge there.

Revision history for this message
Thaddaeus Tintenfisch (thad-fisch-deactivatedaccount) wrote :

Still not fixed.

tags: added: trusty
Changed in thunar (Ubuntu):
importance: Undecided → High
Revision history for this message
pjotter (p-krawatski) wrote :

I have experienced this bug for some time in 12.04. And I can confirm still exists in the latest daily 14.04.

To reproduce the bug in daily 14.04:
1) Put a trash icon to one of the panels and enable the trash icon on the desktop.
2) Empty trash (all icons should indicate that the trash is now empty)
3) Create a dummy file and put it in the trash (All trash icons should indicate that something is in the trash)
4) Now, log off and log back in.
5) The Trash on the panel and in Thunar is showing 'empty' while the Trash on the desktop is showing full!

One way to resolve this problem is to put a dummy file in the trash and then immediately remove it. The status of the trash is the updated and all trash icons show the correct status.

A temporary workaround I have been using:

On startup, run fixtrash.sh:

#!/bin/sh
until pidof gvfsd-trash
do
  sleep 1
done
echo > ~/.local/share/Trash/files/fixtrash
rm ~/.local/share/Trash/files/fixtrash

Hope this helps.

Revision history for this message
In , Thaddaeus Tintenfisch (thad-fisch-deactivatedaccount) wrote :

*** Bug 10655 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Thaddaeus Tintenfisch (thad-fisch-deactivatedaccount) wrote :

I cannot reproduce this issue anymore after telling xfdesktop(!) to display the trash icon on the desktop.

Revision history for this message
Thaddaeus Tintenfisch (thad-fisch-deactivatedaccount) wrote :

I cannot reproduce this issue anymore after I've changed the desktop settings and enabled the trash icon.

Xubuntu 14.04 (dev)

Revision history for this message
ToZ (toz) wrote :

Fresh Xubuntu 14.04 beta 2 install and am seeing the same thing. Desktop trash shows items, but thunar and panel trash icons show empty.

Revision history for this message
Ubuntu QA Website (ubuntuqa) wrote :

This bug has been reported on the Ubuntu ISO testing tracker.

A list of all reports related to this bug can be found here:
http://iso.qa.ubuntu.com/qatracker/reports/bugs/880533

tags: added: iso-testing
Forest (foresto)
summary: - Thunar reports Trash Empty when it is not
+ Thunar and Trash Applet report that Trash is empty when it is not
Changed in thunar:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xfce4-panel (Ubuntu):
status: New → Confirmed
Revision history for this message
In , Hjudt-l (hjudt-l) wrote :

Is this still an issue? If it is, please reopen.

Revision history for this message
In , b3nmore (b3nmore) wrote :

(In reply to Harald Judt from comment #11)
> Is this still an issue? If it is, please reopen.

Yes, it is. Thunar build from git (afe91e9).

As Thaddaeus Tintenfisch said in #10, it works fine, *if* xfdesktop is configured to show the trash icon on the desktop. For all desktop configurations not enabling the desktop trash icon, thunar shows always an empty trash on startup after a fresh login. So do all further thunar instances started later. To get the correct status, one must delete a file/folder or close all open thunar windows. The next thunar window will then show the correct status.

Btw. my workaround for this issue is to create a autostart entry calling "gvfs-ls trash > /dev/null". So my guess is, that calling "gvfs-ls trash" initializes something thunar is relying on to determine the trash status.

Changed in thunar:
status: Confirmed → Fix Released
Revision history for this message
In , Hjudt-l (hjudt-l) wrote :

I've been looking into this a bit.

As some have observed, it happens when the gvfsd-trash daemon has not spawned and thunar accesses the trash for the first time (yet causing it to spawn). So for the trash bin having the correct state it is necessary that the daemon has already spawned when reading the info. The gvfs-trash ls command or any other application accessing the gvfs trash does this.

To reproduce this more easily, simply kill thunar and gvfsd-trash and start a new instance of thunar (daemon or window shouldn't matter).

The code added to thunar-session-client.c could work, but it never gets called on my machine, presumably because I do not start thunar with the session manager. If that is true, all people with a similar setup will suffer from this too. Also the thunar trash panel plugin could exhibit the same problem.

Revision history for this message
In , Hjudt-l (hjudt-l) wrote :

Created attachment 6251
fix-loading-the-trash-bin-status-at-startup-bug-9513.patch

Attached is a patch which fixes the issue for me. Please try it and report back if it fixes the issue for _you_ too. At the moment, I cannot think of a better solution. I hope it does not produce crashes. Maybe someone else has a better idea and can comment on this.

The first reload (in idle without timeout) fixes the shortcut/treeview status icon, but it needs at least a second reload (after two seconds) to fix the "go to" menu item entry. That symbol always shows "full" initially (though strangely thunar_file_get_item_count tells 0). The third reload is there just to be safe. Reloading the trash shouldn't be a very expensive operation.

Please check the behaviour with and without this patch.

Revision history for this message
In , Hjudt-l (hjudt-l) wrote :

Created attachment 6252
fix-loading-the-trash-bin-status-at-startup-bug-9513.patch

This is probably a better version of the patch. Instead of putting the checks into thunar_file_get, which could be called quite often for folders that contain a lot of files, put it into the main function which gets called only once per thunar instance.

Revision history for this message
In , b3nmore (b3nmore) wrote :

(In reply to Harald Judt from comment #15)
> Created attachment 6252 [details]
> fix-loading-the-trash-bin-status-at-startup-bug-9513.patch
>
> This is probably a better version of the patch. Instead of putting the
> checks into thunar_file_get, which could be called quite often for folders
> that contain a lot of files, put it into the main function which gets called
> only once per thunar instance.

Applied the second version of the patch and it fixes the issue for me. No side effects so far.

Revision history for this message
In , Hjudt-l (hjudt-l) wrote :
Revision history for this message
Forest (foresto) wrote :

Here's the "better version" patch backported to ubuntu 14.04.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "reload-trash-at-startup.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
In , Hjudt-l (hjudt-l) wrote :

The patch that I pushed to master and is included in thunar-1.6.9 has caused issues for other people (see bug #11913). I have pushed further patches to fix this, which should be included in the next bugfix release thunar-1.6.10. Could you please apply try these patches on thunar-1.6.9 in this order to see if you can find any issues?

Revert patch: http://git.xfce.org/xfce/thunar/commit/?id=e3b65ff628499248dadfe7cbdb027e17b7db03c2

Fix reload return type: http://git.xfce.org/xfce/thunar/commit/?id=9bf051a0005cef3d661493a44e7de911868cf5e7

Fix trash status: http://git.xfce.org/xfce/thunar/commit/?id=6010f71d865b624f5f58b81405764c4ce6b2afc4

Alternatively, you can build thunar-git of course.

Revision history for this message
In , Forest (foresto) wrote : Re: [Bug 880533]

Harald Judt reverted his previous fix and added a new one upstream today.
I imagine launchpad will import his comments here soon. In the mean time,
here are his latest two patches backported to ubuntu 14.04.

Changed in thunar:
status: Fix Released → Confirmed
Revision history for this message
In , b3nmore (b3nmore) wrote :

Build thunar from current master (6010f71). Trash status works fine and I haven't found any regressions so far. Admittedly I've looked primarily at the 'empty trash after first start'-issue.

Revision history for this message
In , Hjudt-l (hjudt-l) wrote :

Thanks for your report and test, so I will close this bug again.

Changed in thunar:
status: Confirmed → Fix Released
Revision history for this message
Istimsak (saqman2060) wrote :

I viewed the patch. Just curious, what language was used to produce this patch?

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package thunar - 1.6.10-1

---------------
thunar (1.6.10-1) unstable; urgency=medium

  [ Mateusz Łukasik ]
  * New upstream release:
    - Fix trash state at startup. (LP: #880533)

 -- Yves-Alexis Perez <email address hidden> Sun, 24 May 2015 15:26:49 +0200

Changed in thunar (Ubuntu):
status: Confirmed → Fix Released
Forest (foresto)
no longer affects: xfce4-panel (Ubuntu)
no longer affects: xfce4-panel
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.