rakshasa / rtorrent

rTorrent BitTorrent client
https://github.com/rakshasa/rtorrent/wiki
GNU General Public License v2.0
4.05k stars 412 forks source link

rtorrent doesn't respect session directory CLI parameters #1130

Closed tonimelisma closed 2 years ago

tonimelisma commented 2 years ago

When supplying a session directory for rtorrent on the command line either via -o, -O or -s, rtorrent doesn't respect the parameter and tries to use the default one (probably from .rtorrent.rc if not from compiled default value). It also doesn't respect an empty -s parameter, implying no session directory as per the man page.

I'm trying to run a secondary rtorrent instance. The primary uses ~/.rtorrent-session.

toni@purkki:~$ cat .rtorrent.rc 
session = /home/toni/.rtorrent-session
toni@purkki:~$ rtorrent -o session=/home/toni/.rtorrent-session2
rtorrent: Could not lock session directory: "/home/toni/.rtorrent-session/", held by "purkki:+1448".
toni@purkki:~$ rtorrent -O "session=/home/toni/.rtorrent-session2"
rtorrent: Could not lock session directory: "/home/toni/.rtorrent-session/", held by "purkki:+1448".
toni@purkki:~$ rtorrent -s .rtorrent-session2/
rtorrent: Could not lock session directory: "/home/toni/.rtorrent-session/", held by "purkki:+1448".
toni@purkki:~$ rtorrent -s ""
rtorrent: Could not lock session directory: "/home/toni/.rtorrent-session/", held by "purkki:+1448".

Here's my version:

toni@purkki:~$ rtorrent -h
Rakshasa's BitTorrent client version 0.9.8.
...
toni@purkki:~$ cat /etc/issue
Ubuntu 21.10 \n \l

toni@purkki:~$ apt-cache show rtorrent
Package: rtorrent
Architecture: amd64
Version: 0.9.8-1build1
...
kannibalox commented 2 years ago

That's definitely counterintuitive, not sure if it's intended. In the meantime, if you don't want to have a separate config file, you can work around it with this:

rtorrent -n -o import="~/.rtorrent.rc" -s /home/toni/.rtorrent-session2

For posterity, the default value is an empty string, which disables the persistent session files entirely.

rakshasa commented 2 years ago

This is intended behavior, if you want to override the config file's sessions parameter, make the config file check if the session directory is set or not.