Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-existent temporary desktop file appears on desktop #944

Closed
wxl opened this issue Apr 19, 2019 · 51 comments · Fixed by lxqt/libfm-qt#408
Closed

non-existent temporary desktop file appears on desktop #944

wxl opened this issue Apr 19, 2019 · 51 comments · Fixed by lxqt/libfm-qt#408

Comments

@wxl
Copy link
Member

wxl commented Apr 19, 2019

Especially when toggling desktop shortcuts on and off, the desktop displays non-existent files in the form {desktop shortcut}.desktop.{6 digit random alphanumeric string}.

Debian testing
computer.desktop.DXKO0Z in Debian testing

Lubuntu 19.04
user-home.desktop. in Lubuntu 19.04

Expected Behavior

  • non-existent files should not be displayed on the desktop
  • if shortcuts files are temporarily renamed with the random string appended, they should be recycled when finished

Current Behavior

The shortcuts display correctly, but the additional non-existent file sometimes shows. There is an unambiguous way to reproduce (see below), but it's not consistent:

  • Lubuntu 19.04 live does not have the problem
  • Lubuntu 19.04 install boots to the problem
  • Debian testing does not initially have the problem
  • When changing the display of the Home shortcut (and only that one), Debian testing gets the problem and it persists
  • When pcmanfm-qt is restarted in Lubuntu, the errant file goes away, but logging out and back in again returns the problem

Possible Solution

The shortcuts do display correctly, so my guess is this is a recycling issue, but I cannot be sure. The fact that it doesn't occur in all situations is interesting, as well. My guess is that this is an issue with a rename as I suggested above since I can see when things behave correctly, it looks like a file appears on the screen and then disappears. Maybe it's a timing thing?

Steps to Reproduce (for bugs)

Debian testing

  1. Boot to installed system
  2. Note that desktop shortcuts for Home, Trash, Computer, and Network are all displayed
  3. Right click on the desktop
  4. Click on "Desktop Preferences"
  5. Click on the "Advanced" tab
  6. Uncheck "Home"
  7. Click OK
  8. Note that the desktop shortcut for Home disappears but nothing else changes
  9. Repeat steps above, but check "Home" again
  10. Note that all of the desktop shortcuts are displayed, but also a new file, most likely computer.deskop, but with a 6 digit alphanumeric string appended to it.
  11. Note that the file does not exist (e.g. with the file manager)
  12. Log out and back in again
  13. Note that now there's a user.desktop instead of a computer.desktop

Lubuntu 19.04

  1. Boot to installed system
  2. Note that desktop shortcuts for Home, Trash, Computer, and Network are all displayed, along with a user-home.desktop with a 6 digit alphanumeric string appended to it
  3. Note that the file does not exist (e.g. with the file manager)
  4. Right click on the desktop
  5. Click on "Desktop Preferences"
  6. Click on the "Advanced" tab
  7. Uncheck "Home"
  8. Click OK
  9. Note that the desktop shortcut for Home and the extra non-existent file disappears but nothing else changes
  10. Repeat steps above, but check "Home" again
  11. Note that all of the desktop shortcuts are displayed, but also a new file, most likely computer.deskop, but with a 6 digit alphanumeric string appended to it.
  12. Note that the file does not exist (e.g. with the file manager)
  13. Log out and back in again
  14. Note that now there's a user.desktop instead of a computer.desktop

Context

Um, it would be nice to have a less messy desktop? ☺

System Information

Debian testing

  • Kernel: 4.19.0-4-amd64
  • Qt Version: 5.11.3
  • libfm-qt Version: 0.14.1-4
  • libqtxdg Version: 3.3.1-1
  • lxqt-build-tools Version: 0.6.0-2
  • Package version: 0.14.1-4

Lubuntu 19.04

  • Kernel: 5.0.0-13-generic
  • Qt Version: 5.12.2
  • libfm-qt Version: 0.14.1-0ubuntu2
  • libqtxdg Version: 3.3.1-0ubuntu2
  • lxqt-build-tools Version: 0.6.0-2ubuntu1
  • Package version: 0.14.1-0ubuntu1
@wxl wxl changed the title non-existent {desktop shortcut}.desktop.{6 digit random alphanumeric string} non-existent temporary desktop file appears on desktop Apr 19, 2019
@agaida
Copy link
Member

agaida commented Apr 20, 2019

ok, can confirm that the report is valid - played a bit with i guess we can break it down a bit - and make it far more simple to reproduce.

https://youtu.be/S6EQnJsTEHw

Steps to reproduce:

  • install a current debian testing live image in vbox (real iron or kvm not tested)
  • restart
  • open desktop-settings and go to the desktop icon tab
  • just click to apply some times

Thats all, i guess we are to fast with the desktop refresh,

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

I did it more than 10 times but couldn't reproduce it. I don't have Debian or Ubuntu but the distro shouldn't be important if there's a bug.

I may have seen a similar thing before fundamental changes to libfm-qt's folder.cpp but it was before 0.14 and didn't happen after the changes. It wasn't easily reproducible.

Would you please paste the name of that none-existent file (or attach a screenshot)?

BTW, a desktop reload from pcmanfm-qt's window may be enough; there's no need to log out and log in.

@agaida
Copy link
Member

agaida commented Apr 20, 2019

see the attached screencast 🕶️

Edit: ok - i really guess that it is a timing probkem with the repaint of the desktop

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

see the attached screencast

Oh, Falkon has a problem here (although this is my old laptop). I saw it after reloading the page.

@agaida
Copy link
Member

agaida commented Apr 20, 2019

falkon don't have any problems, falkon is a problem - would you knowingly run an far outdated chrome or chromium?

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

i really guess that it is a timing probkem with the repaint of the desktop

It's easy to know if you can reproduce it: when you see it, open the desktop folder inside pcmanfm-qt's window. If it's there, it isn't related to desktop repaint. Tell me the result please!

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

falkon don't have any problems, falkon is a problem

Don't blame falkon; I like it ;) The version installed here should be outdated.

@wxl
Copy link
Member Author

wxl commented Apr 20, 2019

The name of the file will change, ultimately, but it's always one of the desktop shortcuts, which means one of:

  • trash-can.desktop
  • user-home.desktop
  • computer.desktop
  • network.desktop

and it has a random six digit alphanumeric string appended to it.

There's two screenshots above that show examples:

  1. computer.desktop.DKXO0Z
  2. user-home.desktop.TVEK0Z

@agaida
Copy link
Member

agaida commented Apr 20, 2019

@wxl - one could see it in the screencast

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

There's two screenshots above that show examples:

Yes, I saw them after reloading the page.

Important question: Do you see them when you open dekstop inside pcmanfm's window?

@wxl
Copy link
Member Author

wxl commented Apr 20, 2019

Important question: Do you see them when you open dekstop inside pcmanfm's window?

Good question. Yes. But not in terminal, as with @agaida 's result above.

@agaida
Copy link
Member

agaida commented Apr 20, 2019

YES, Sir!

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

So, we can be sure that it isn't about desktop repaint. DAMN!! 2 bugs in one day (although the first one is solved).

@wxl
Copy link
Member Author

wxl commented Apr 20, 2019

What's really sad is that I saw this in development of Lubuntu 19.04 but we had so many other things to worry about and it wasn't always showing up that I just shrugged it off. At least the impact is relatively minor.

@agaida
Copy link
Member

agaida commented Apr 20, 2019

@tsujan - i don't blame falkon, the outdated part is QtWebengine - and i don't really know how it can work to have it up to date for distributions

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

@wxl I'm sure it'll disapper if you reload dektop inside pcmanfm-qt's window -- because it isn't about repaint.

@agaida This laptop is only for doing dirty jobs -- everything is a mess in it;) Falon has never had this probelm in my main laptop.

@agaida
Copy link
Member

agaida commented Apr 20, 2019

@wxl - no problem, shit happend. It's not nice, but don't have much negative impact. On the pro side - it did not occour such often, so most of the users will not see it, esp. on real machines i guess

@agaida
Copy link
Member

agaida commented Apr 20, 2019

ok, F5 in the pcmanfm-qt window let it disappear

@wxl
Copy link
Member Author

wxl commented Apr 20, 2019

ok, F5 in the pcmanfm-qt window let it disappear

Yes, refreshing inside pcmanfm-qt solves it. But logging out and back in brings it back, at least in Lubuntu.

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

For me, there is a serious problem here. I hate it when a FM shows a nonexistent file. The cause of this one may be different...

My main problem is that I can't reproduce it. Sorry, I'll need you (@agaida and @wxl) to test this or that patch. For now, I have no clue.

@agaida
Copy link
Member

agaida commented Apr 20, 2019

dito in debian, but not every time, gone at the second and third re-login - there is something racy

@agaida
Copy link
Member

agaida commented Apr 20, 2019

no problem with testing it - i was surprised that i never seen it before

@wxl
Copy link
Member Author

wxl commented Apr 20, 2019

@tsujan Happy to test. I can absolutely get it to reproduce every time. What distro are you using BTW? I can see if I can't figure out the right steps to reproduce.

@agaida
Copy link
Member

agaida commented Apr 20, 2019

the only thing that makes me nervous is the existence of an unwanted temp file - it should never be created first hand.

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

It's another case of finding a needle in a haystack. It'll be found at last; I hope soon.

Anyhow, thanks for tellng me about it!

@agaida
Copy link
Member

agaida commented Apr 20, 2019

//me reduce the haystack to libfm-qt and pcmanfm-qt. Duck and crawling away ...

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

What distro are you using BTW?

Manjaro but it shouldn't make a difference. It's about a race. So, it depends on the computer.

@agaida
Copy link
Member

agaida commented Apr 20, 2019

@wxl - how many processors do you use in vbox - i use 4 out of 8 right now

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

//me reduce the haystack to libfm-qt and pcmanfm-qt

libfm-qt, more probably.

@wxl
Copy link
Member Author

wxl commented Apr 20, 2019

@wxl - how many processors do you use in vbox - i use 4 out of 8 right now

1/8

@agaida
Copy link
Member

agaida commented Apr 20, 2019

with 1 out of 8 and only 1024M it is reproducible nearly every time

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

@wxl @agaida
Please test this branch: https://github.com/lxqt/libfm-qt/tree/accumulated_changes (which has this commit: lxqt/libfm-qt@9a7c7a8)

Please don't forget to restart pcmanfm-qt's process after installation and before testing!

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

I changed it to a PR: lxqt/libfm-qt#408. It corrects a flaw that had remained in the logic.

@agaida
Copy link
Member

agaida commented Apr 20, 2019

- still there from time to time

And again - why is that file created first hand?

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

still there from time to time

Unbelievable! What I corrected was a flaw but, apparently, there's still another one.

why is that file created first hand?

When GLib creates the desktop file, it writes to a temp file and then deletes it. Qt does so too.

@tsujan
Copy link
Member

tsujan commented Apr 20, 2019

@agaida I added a commit to lxqt/libfm-qt#408; please try it again!

@tsujan
Copy link
Member

tsujan commented Apr 21, 2019

I installed Manjaro on VirtualBox, installed my LXQt packages on it and succeeded in reproducing this problem.

But when I open desktop inside a pcmafm-qt window too, no nonexistent file item is created. Only if desktop isn't opened inside a pcmanfm-qt window, nonexistent file items can be seen. Do you confirm this?

@agaida
Copy link
Member

agaida commented Apr 21, 2019

it trigger something, i guess you will not like it

  • when no nonexistent file is shown and the desktop view is open - no file will be created/shown
  • if there is such an item it will stay - but not regenerated (the diffenent file endings @wxl mentioned.

Hard to understand - here is the screencast
https://youtu.be/sRgacLGS1ns

@tsujan
Copy link
Member

tsujan commented Apr 21, 2019

Yes, I can see everything now but have no clue about the cause yet :( It took me 2 hours to install Manjaro + upgrade it + fix virtualbox additions in it (nasty, shouldn't have done it with virtualbox ISO) + upgrade to Testing + install my LXQt packages in it. But, at last, I can see it.

@tsujan
Copy link
Member

tsujan commented Apr 21, 2019

Found it, at last!

The cause was VERY hidden and fairly complex:

At the moment of clicking Apply or OK, desktop folder is reloaded and, simultaneously, that temp file is created by GLib, so that the directory list job adds it as an item (because it exists at that very moment). Then, the directory monitor starts emitting change events (because directory monitor starts before directory list job) and announces the creation of that file and, immediately after that, reports its deletion too. Our code sees a creation followed by a deletion and thinks it's a good idea to ignore both of them (1 + (-1) = 0). The final result is that an item is added independently from the directory monitor and its deletion is ignored afterward; hence a nonexistent file remains on desktop.

The solution is very simple: when deletion happens immediately after creation, take both of them into account, instead of ignoring both of them.

Now, I should find a way of adding a short comment to the code...

EDIT: I corrected my mistakes in the above explanation -- especially the orders.

tsujan added a commit to lxqt/libfm-qt that referenced this issue Apr 21, 2019
Fixes lxqt/pcmanfm-qt#944

Previously, if a file was in addition queue and then it came into the deletion queue, its addition and deletion were both ignored. That was wrong and could result in showing nonexistent files because addition can also happen in directory list job before being processed by file info job.

Also process accumulated changes only after finishing the current info job and don't clear all deletion paths after processing them (because, logically, only those paths that can be deleted should be removed).
@tsujan
Copy link
Member

tsujan commented Apr 21, 2019

Squashed the commits of lxqt/libfm-qt#408 and reworded its title and body.

Tested it with 1-2/8 CPU cores under VirtualBox. GLib temp files were immediately deleted after being created.

agaida pushed a commit to lxqt/libfm-qt that referenced this issue Apr 21, 2019
Fixes lxqt/pcmanfm-qt#944

Previously, if a file was in addition queue and then it came into the deletion queue, its addition and deletion were both ignored. That was wrong and could result in showing nonexistent files because addition can also happen in directory list job before being processed by file info job.

Also process accumulated changes only after finishing the current info job and don't clear all deletion paths after processing them (because, logically, only those paths that can be deleted should be removed).
@tsujan
Copy link
Member

tsujan commented Apr 21, 2019

@agaida @wxl What will you do with Debian and Ubuntu?

@agaida
Copy link
Member

agaida commented Apr 21, 2019

for debian it is easy, just uploaded - when built i will file a unblock bug again :) - for Lubuntu it is a bit different, it is already in the wild. Don't know the update/fixing policy for non-LTS versions, but if a update is possible i would suggest to do a cumulative update with all the things that are in sid (only bugfixing, no new functionality)

Edit: The changes is not that invasive, i hope that the release team will allow it.

@wxl
Copy link
Member Author

wxl commented Apr 23, 2019

I'm torn about this, frankly. I see some justification to getting it in Disco through the Stable Release Updates process, as it is kind of ugly, but it's a bit of work for a relatively small impact. Thoughts, @tsimonq2 ?

@tsujan
Copy link
Member

tsujan commented Apr 23, 2019

@wxl IMO, it was quite important and Lubuntu shouldn't let its users suffer from it.

@tsimonq2
Copy link
Member

Yeah @wxl, let's do it.

Want to do the paperwork or should I?

@wxl
Copy link
Member Author

wxl commented Apr 23, 2019 via email

@tannisroot
Copy link

Sorry, this issue is not exactly the place to discuss Lubuntu issues, but I am just wondering, when is the fix for this going to land in 19.04 if you guys actually decided to push it? It's just incredibly infuriating and it's the only thing that still keeps me on Xubuntu.

@tsujan
Copy link
Member

tsujan commented May 6, 2019

It's just incredibly infuriating

We knew and fixed it as soon as we became aware of it -- it didn't happen on our work systems.

@wxl and @tsimonq2 could answer your question about Lubuntu.

@wxl
Copy link
Member Author

wxl commented May 6, 2019

@tannisroot the fix is already in Debian. @tsimonq2 will have the fixes merged to Eoan/19.10 shortly. Meanwhile, we'll get an SRU bug filed to get it into Disco/19.04.

Meanwhile, there is a workaround that will keep the thing out of your field of vision for a session:

  1. Open pcmanfm-qt
  2. Go to the Desktop folder
  3. Refresh the folder (F5)

If you have further questions or comments about the status of this in Ubuntu, I would urge you to direct your comments at the downstream bug. Thanks!

pvdabeel pushed a commit to pvdabeel/gentoo that referenced this issue May 25, 2019
On some machines (slow enough?), visible desktop entries such as
'trash' would cause related temporary no longer existing files
being displayed on the desktop as well.

- lxqt/pcmanfm-qt#944
- lxqt/libfm-qt@f944be7d

Package-Manager: Portage-2.3.66, Repoman-2.3.12
Signed-off-by: Jimi Huotari <chiitoo@gentoo.org>
Closes: gentoo#12108
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants