Bug 998265 - clicking on a magnet link in firefox opens another instance of qbittorrent
clicking on a magnet link in firefox opens another instance of qbittorrent
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: firefox (Show other bugs)
19
x86_64 Linux
unspecified Severity low
: ---
: ---
Assigned To: Jan Horak
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-18 14:04 EDT by Alberto Segura
Modified: 2015-02-28 09:21 EST (History)
8 users (show)

See Also:
Fixed In Version: qbittorrent-3.1.5-3.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1072046 (view as bug list)
Environment:
Last Closed: 2014-01-27 23:38:40 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
this image shows two instances opened and and two processes running (1.45 MB, image/png)
2013-08-18 14:04 EDT, Alberto Segura
no flags Details

  None (edit)
Description Alberto Segura 2013-08-18 14:04:08 EDT
Created attachment 787819 [details]
this image shows two instances opened and and two processes running

Description of problem:
Hello, 

  When I click on a magnet link (or .torrent file) another instance of qbittorrent is opened instead of respecting the previous running one and pass it there.

  I think it's a firefox browser issue because epiphany-browser (web) does it correctly.

 I have contacted with qbittorrent's main developer and he was not sure what was causing the problem.

Version-Release number of selected component (if applicable):
Mozilla Firefox 23
qBittorrent-3.0.10

How reproducible:


Steps to Reproduce:
1.Start qbittorrent
2.Click in a magnet link or .torrent file in firefox
3.

Actual results:
Another instance of qbittorrent is opened.

Expected results:
Respecting previous instance opened and add the download there.

Additional info:
Comment 2 Asif Ali Rizvan 2013-12-31 12:20:10 EST
https://github.com/qbittorrent/qBittorrent/issues/867

incorrect use of /tmp directory by firefox leading to 'multiple' launching of qbittorrent (as qbitorrent and other Qt4 qt-singleapplications, use $TMP (.i.e., /tmp) to store the *lock* file to know the running app)

This bug is not affecting other distros. Fedora's firefox seems to be having a differnt $TMP  as decribed by this comment

https://github.com/qbittorrent/qBittorrent/issues/867#issuecomment-31397540

thanks.
Comment 3 V. Slobodyan 2014-01-06 13:26:02 EST
Problem with 2 and more instances of qBittorrent is problem with system-wide (Fedora) TMP variables.

When I have problem with multiple instances of QB, I check what is in TMP PATH variables of my systems:

> $TMPDIR
>
(empty)

> $TMP
bash: /tmp/.colorlsCGO: File or path not found
>

> echo $TMP
/tmp/.colorlsCGO
>

WTF is in $TMP ??

This is source of problem!
TMP PATH of our systems has incorrect values or do not have any of this..

Next I describe total solution for this problem, FIX and problem with Firefox, and Nautilus, and, maybe, other.

Open .bash_profile in your favorite editor, and append this lines:

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

After this logout from your account and re-login (or reboot).

And now we have good work one instance of qbittorrent in all. :)

Distro: Fedora 20
Comment 4 Martin Stransky 2014-01-07 03:20:12 EST
I wonder if it's a bug in tpmfs feature (http://fedoraproject.org/wiki/Features/tmp-on-tmpfs) introduced in Fedora.
Comment 5 Jan Horak 2014-01-13 09:38:46 EST
(In reply to V. Slobodyan from comment #3)
> Problem with 2 and more instances of qBittorrent is problem with system-wide
> (Fedora) TMP variables.
> 
> When I have problem with multiple instances of QB, I check what is in TMP
> PATH variables of my systems:
> 
> > $TMPDIR
> >
> (empty)
> 
> > $TMP
> bash: /tmp/.colorlsCGO: File or path not found
> >
> 
> > echo $TMP
> /tmp/.colorlsCGO
> >
> 
> WTF is in $TMP ??
> 
> This is source of problem!
> TMP PATH of our systems has incorrect values or do not have any of this..
> 
> Next I describe total solution for this problem, FIX and problem with
> Firefox, and Nautilus, and, maybe, other.
> 
> Open .bash_profile in your favorite editor, and append this lines:
> 
> TMP=/tmp; export TMP
> TMPDIR=$TMP; export TMPDIR
> 
> After this logout from your account and re-login (or reboot).
> 
> And now we have good work one instance of qbittorrent in all. :)
> 
> Distro: Fedora 20

Firefox uses temp dir in some cases when downloading file. This file can be bigger than limited space in /tmp as long as /tmp uses tmpfs and so we're using /var/tmp dir (which is on disk) instead of /tmp.

Qtorrent is inheriting Firefox environment variables when .torrent file is opened in Firefox. You can use following workaround in .bash_profile:

TMPDIR=/var/tmp
export TMPDIR
Otherwise you can run out of tmp space soon when you choose to open bigger file instead of downloading them in Firefox.

Drawback of this workaround is that you won't be using /tmp for all your executed programs which honours TMPDIR variable.

We might try to convince qtorrent package maintainer to let qtorrent use /var/tmp instead of tmp (for example by wrapping script with TMPDIR=/var/tmp). Let's ask him.
Comment 6 leigh scott 2014-01-13 10:41:48 EST
(In reply to Jan Horak from comment #5)

> TMPDIR=/var/tmp
> export TMPDIR
> Otherwise you can run out of tmp space soon when you choose to open bigger
> file instead of downloading them in Firefox.
> 
> Drawback of this workaround is that you won't be using /tmp for all your
> executed programs which honours TMPDIR variable.
> 
> We might try to convince qtorrent package maintainer to let qtorrent use
> /var/tmp instead of tmp (for example by wrapping script with
> TMPDIR=/var/tmp). Let's ask him.


I can't change the path as I don't use the bundled qtsingleapp

from qbittorrent spec file

%prep
%setup -q
%patch0 -p1
rm -rf src/qtsingleapp


from qbittorrent source

$ grep tempPath -r
src/qtsingleapp/qtlocalpeer.cpp:    QString lockName = QDir(QDir::tempPath()).absolutePath()
src/qtsingleapp/qtlocalpeer.cpp:        QFile::remove(QDir::cleanPath(QDir::tempPath())+QLatin1Char('/')+socketName);
src/addnewtorrentdialog.cpp:  TorrentTempData::setSavePath(m_hash, QString(QDir::tempPath() + QDir::separator() + m_hash).replace("\\", "/"));


https://github.com/qbittorrent/qBittorrent/issues/867#issuecomment-25537077


The qtsingleapplication package needs to be patched for this

https://koji.fedoraproject.org/koji/packageinfo?packageID=10602
Comment 7 Jan Horak 2014-01-13 10:54:30 EST
I didn't mean to patch qbittorent or qtsingleapplication source code. I meant to rename qbittorrent to qbittorrent-bin create qbittorrent file like:

TMPDIR=/var/tmp
/usr/bin/qbittorent-bin $*

I don't think it's a bug of qbittorrent nor firefox. As Martin mentioned it's more like side effect of http://fedoraproject.org/wiki/Features/tmp-on-tmpfs change.
Comment 8 Fedora Update System 2014-01-17 14:18:52 EST
qbittorrent-3.1.5-2.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/qbittorrent-3.1.5-2.fc19
Comment 9 Fedora Update System 2014-01-17 14:19:08 EST
qbittorrent-3.1.5-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/FEDORA-2014-0675/qbittorrent-3.1.5-2.fc20
Comment 10 Fedora Update System 2014-01-19 22:03:35 EST
Package qbittorrent-3.1.5-3.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing qbittorrent-3.1.5-3.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-1157/qbittorrent-3.1.5-3.fc19
then log in and leave karma (feedback).
Comment 11 Fedora Update System 2014-01-27 23:38:40 EST
qbittorrent-3.1.5-3.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 12 Fedora Update System 2014-01-27 23:40:37 EST
qbittorrent-3.1.5-3.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 13 joopbraak 2014-01-28 12:12:45 EST
I'm now getting the error message (four times):

I/O Error
"The torrent file does not exist"

when clicking on a torrent link in Firefox.

Fedora 19
$yum list installed |grep -E "firefox|qbit"
firefox.x86_64                             26.0-2.fc19                 @updates 
qbittorrent.x86_64                         1:3.1.5-3.fc19              @updates
Comment 14 joopbraak 2014-01-28 12:49:15 EST
After starting Qbittorrent:

$ll -gG /var/tmp/qtsingleapp*
srwxr-xr-x 1 0 Jan 28 18:25 /var/tmp/qtsingleapp-qBitto-160b-1398
-rw-r--r-- 1 0 Jan 28 18:25 /var/tmp/qtsingleapp-qBitto-160b-1398-lockfile

Lockfile doesn't get deleted after closing Qbittorrent:

$ll -gG /var/tmp/qtsingleapp*
-rw-r--r-- 1 0 Jan 28 18:25 /var/tmp/qtsingleapp-qBitto-160b-1398-lockfile

And further:

Clicking on Magnet link works.

Doubleclicking on a saved torrent file gives the same error.

Same on Fedora 20.
Comment 15 joopbraak 2014-01-29 06:56:43 EST
Can someone please reopen this bug? This is not solved.

Also the solution of a wrapper is a very ugly one.

Why don't other distributions have this problem in Firefox, regarding not having /tmp as tempdir because of potential disk space problems when downloading large files?
Comment 16 Jan Horak 2014-01-29 07:25:56 EST
(In reply to joopbraak from comment #15)
> Can someone please reopen this bug? This is not solved.
Please file another bug and clarify from where you're doing doubleclick (nautilus?). This bug is about magnet links. Thank you. I can't reproduce your issue though.

> Also the solution of a wrapper is a very ugly one.
This is opensource, feel free to come with better solution.

> Lockfile doesn't get deleted after closing Qbittorrent:
I can find "...-lockfile" file also when running qbittorent-bin (ie without wrapper) in /tmp after qbittorent quit, so this is no regression.

> Why don't other distributions have this problem in Firefox, regarding not
> having /tmp as tempdir because of potential disk space problems when
> downloading large files?
Others distributions doesn't use tmpfs for /tmp. You can find benefits of tmpfs here: http://fedoraproject.org/wiki/Features/tmp-on-tmpfs
Comment 17 joopbraak 2014-01-29 08:11:33 EST
This bug is not about a magnet link.

This bug is about Qbittorrent opening twice when clicking on a magnet OR torrent link from within Firefox. See bug description.

I have KDE, and it also happens when doubleclicking torrent file in Nautilus as well as in Dolphin.

Also in Fedora 20.
Comment 18 Jan Horak 2014-01-29 08:23:15 EST
If you downgrade you package does it fix your problem (nautilus, dolphin)? 

Now you reporting doubleclick in Nautilus or Dolphin. It has nothing to do with Firefox. That's why I'm suggesting opening a new bug.
Comment 19 leigh scott 2014-01-29 08:32:07 EST
Doubleclicking torrent file in nemo works fine here (Cinnamon).
Comment 20 joopbraak 2014-01-29 09:18:59 EST
I said the doubleclicking torrent files appeared as an extra problem.

The problem with torrent files within Firefox is also still there.

Only the magnet link creating another instance has been solved.

Fedora 19:

When I downgrade to qbittorrent-3.1.4-4.fc19:

-doubleclicking torrent files (nautilus or dolphin) works OK.
-Clicking torrent or magnet link in Firefox creates second instance.

Fedora 20:

When I downgrade to qbittorrent-3.1.4-4.fc20:

-doubleclicking torrent files (nautilus or dolphin) creates second instance.
-Clicking torrent or magnet link in Firefox works OK.

Very strange.
Comment 21 Jan Horak 2014-01-29 09:45:50 EST
What does these commands say:
xdg-mime query default application/x-bittorrent
xdg-mime query default x-scheme-handler/magnet
cat /usr/share/applications/`xdg-mime query default application/x-bittorrent`|grep Exec
cat /usr/share/applications/`xdg-mime query default x-scheme-handler/magnet`|grep Exec

for f19 and f20.
Comment 22 joopbraak 2014-01-29 10:06:27 EST
Fedora 19:

$xdg-mime query default application/x-bittorrent
qBittorrent.desktop
$xdg-mime query default application/x-bittorrent
qBittorrent.desktop
$cat /usr/share/applications/`xdg-mime query default application/x-bittorrent`|grep Exec
Exec=qbittorrent %U
$cat /usr/share/applications/`xdg-mime query default x-scheme-handler/magnet`|grep Exec
Exec=qbittorrent %U

Fedora 20 the same.

Especially for Fedora 20 I find it strange that it's not reproducible by other, since this system is rather pristine, it is a KDE system with all the updates installed, not much else has changed.

Both 64 bit, by the way.
Comment 23 joopbraak 2014-01-29 10:14:30 EST
Sorry copy and paste mixup.

$xdg-mime query default x-scheme-handler/magnet
qBittorrent.desktop

The same on both Fedora's
Comment 24 Adrián 2014-03-02 21:44:05 EST
Fedora 20 here. I'm getting the "I/O Error "The torrent file does not exist"" when opening torrent files.

With the client open, double click in nautilus or:

$ qbittorrent file.torrent

Produces spam or error pop-ups.

$ qbittorrent-bin file.torrent

Works ok.

So it must be related to this fix.
Comment 25 Elia Devito 2014-12-28 07:00:15 EST
Reopen the bug, Fedora 21 still has this issue

tested on fedora 21 with:
Mozilla Firefox: 34.0
qBittorrent-3.2.0alpha

Note You need to log in before you can comment on or make changes to this bug.