Bug 1551678

Summary: RFE Qtsingleapplication should delete temporary file
Product: [Fedora] Fedora Reporter: Zdravko Mitov <zmitov>
Component: qtlockedfileAssignee: Raphael Groner <projects.rg>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: kevin, me, oget.fedora, projects.rg, zmitov
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-17 14:03:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zdravko Mitov 2018-03-05 17:03:26 UTC
Description of problem:
That happens with QupZilla. After closing the browser, „qtsingleapp-qupzil-xxxx-xxx-lockfile“ is always remains in /tmp directory, but should be deleted.

Version-Release number of selected component (if applicable):
2.6.1

How reproducible:


Steps to Reproduce:
1.Clean /tmp directory
2.Start QupZilla/Falkon built with system Qtsingleapplication
3.Exit QupZilla/Falkon

Actual results:
/tmp/qtsingleapp-qupzil-xxxx-xxx-lockfile are not deleted

Expected results:
The file to be deleted

Additional info:
If build QupZilla with bundled qtsingleapplication, the file is always deleted on application close.

Sorry for the bad English!

Comment 1 Raphael Groner 2018-03-05 22:35:53 UTC
> lockfile“ is always remains in /tmp directory, but should be deleted.

This sounds more like a bug in qtlockedfile that's used in qtsingleapplication used in qupzilla.

Taking package to get rid of orphan.

Comment 2 Raphael Groner 2018-03-05 22:39:06 UTC
Is the file in /tmp still there after you reboot?

As /tmp is normally mounted as tmpfs, all files will be dropped after shutdown.

Comment 3 Zdravko Mitov 2018-03-06 06:04:38 UTC
Actually, Kevin Kofler which is one from the packages maintainers (i thing), asked me to open a bug about that here. 
Ref: https://bugs.kde.org/show_bug.cgi?id=391370#c9

So if you thing that i'm wrong, just close the issue please!

Comment 4 Kevin Kofler 2018-03-06 10:37:01 UTC
Yes, I am the maintainer of QupZilla in Fedora, and have submitted a review request for the new Falkon.

It is true that /tmp is a tmpfs by default on Fedora and so will be wiped on a reboot, unless the user disables the tmpfs mount (which makes sense on machines with little RAM). But IMHO that is not a valid excuse for letting trash accumulate in it.

Comment 5 Zdravko Mitov 2018-03-06 16:30:20 UTC
Actually i noticed that this file is an extra file and probably should not be created. In fact, it has a different name.
Here is an example:

'/tmp/qtsingleapp-QupZil-b880-3e8' 
'/tmp/qtsingleapp-QupZil-b880-3e8-lockfile' 
'/tmp/qtsingleapp-qupzil-bd40-3e8-lockfile'

Comment 6 Raphael Groner 2018-03-06 18:13:33 UTC
A possible workaround could be to write the files in a tmpfs that is accessible for the actual user only, maybe use $XDG_CACHE_HOME or XDG_RUNTIME_DIR [1]. At least, the user logs out from the session and it would magically let drop the temporary stuff.

Also, we could run into a security issue with those files, /tmp can be accessed from everyone.

[1] https://wiki.archlinux.org/index.php/XDG_Base_Directory_support#User_directories

Comment 7 Raphael Groner 2018-03-06 18:19:18 UTC
Some related interesting discussion about using XDG:
https://news.ycombinator.com/item?id=4331969

Comment 8 Zdravko Mitov 2018-03-06 19:46:34 UTC
The problem here is why the 3rd file is being created.

The following lines are determining the file name:
    socketName = QLatin1String("qtsingleapp-") + prefix
                 + QLatin1Char('-') + QString::number(idNum, 16);

This: "QString::number(idNum, 16)" goes ===> "b880"

so where the "bd40" comes from!!!!???

Comment 9 Raphael Groner 2018-03-06 20:06:48 UTC
(In reply to Damage.inc from comment #8)
… 
> so where the "bd40" comes from!!!!???

Please ask upstream. We do the packaging only, upstream writes the code.
http://t-sato.in.coocan.jp/xvkbd/#author

Comment 10 Kevin Kofler 2018-03-07 03:25:47 UTC
So I think I see where the issue is. First, we construct the QtSingleApplication with the default appId, which calls sysInit() once. Then, setAppId is called, which calls sysInit(appId) and creates a new socket, without deleting the old one first.

I would blame the modifications from QupZilla/Falkon adding that setAppId method. But the bundled version in QupZilla/Falkon has that too, so I don't see why you are not seeing this bug with that version.

Comment 11 Raphael Groner 2018-03-07 05:45:16 UTC
(In reply to Kevin Kofler from comment #10)
…
> I would blame the modifications from QupZilla/Falkon adding that setAppId
> method. But the bundled version in QupZilla/Falkon has that too, so I don't
> see why you are not seeing this bug with that version.

This patch was applied because of unbundling.

https://src.fedoraproject.org/rpms/qupzilla/c/40782abac81326dfb8704c5dd559cfd98a5983fb?branch=master

Comment 12 Kevin Kofler 2018-03-07 10:53:06 UTC
I know, which is why I wrote "the modifications from QupZilla/Falkon", it is clear that they come from there.

Comment 13 Raphael Groner 2018-03-07 13:06:52 UTC
Does Falkon still need the mentioned patch? If yes, I would tend to say we should try to poke upstream to coordinate the missing functionality to get moved into the appropriate library.

Comment 14 Raphael Groner 2018-06-23 12:08:35 UTC
Wrong/useless link for upstream given in comment #9, sorry.

Maybe replace implementation with the alternative of itay-grudev?
https://github.com/itay-grudev/SingleApplication

As far as I can see, this solution uses an unique socket to connect to and ask for its server instance.

Comment 15 Kevin Kofler 2018-06-23 12:15:55 UTC
Falkon still uses the mentioned patch, yes.

Given that nobody understands why this bug happens and that it reportedly does not happen with the bundled version for unknown reasons, I think it may just be best to switch to the bundled copy and drop the patch from the system library. I used to be strictly against bundling, but the Fedora policies have been lightened and, in the end, shipping reliable software is most important.

Comment 16 Jan Kurik 2018-08-14 10:12:22 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 17 Raphael Groner 2018-09-01 08:08:22 UTC
Can we close here with WONTFIX?

Comment 18 Raphael Groner 2018-11-11 08:42:53 UTC
Friendly reminder.

Comment 19 Zdravko Mitov 2018-11-12 17:06:41 UTC
I do not mind it to be closed, thanks!

Comment 20 Raphael Groner 2018-12-17 14:05:09 UTC
As there's a workaround available by placing the temporary file into tmpfs, see below for explanation, I think it's better to close with WORKSFORME.

Comment 21 Kevin Kofler 2019-03-22 00:59:23 UTC
Falkon upstream now (as of Falkon 3.1.0) patched their QtSingleApplication to use D-Bus instead of lock files. I am simply going to drop the system-qtsingleapplication patch.