Closed lhupitr closed 5 years ago
Yup, that sounds like a bug. It should list the torrents that match the filter so you can check if the list contains only the torrents you want to remove.
As a precaution, you should backup your transmission folder so you can restore if something goes wrong.
Does this happen in the TUI as well?
Does this happen only for certain filters or every time?
Yes it happens in the TUI as well. I know it doesn't occur when filtering by torrent id (id=xxxx) this will just list a single torrent. I haven't tested it extensively with other filters but it does seem to consistently occur when filtering by name=[torrent name]&path=[torrent path]
I can't reproduce this issue.
I've setup a test daemon like this:
mkdir transmission.tmp
transmission-daemon --log-debug -f -O -p 1234 -P 4321 \
-g ./transmission.tmp -w ./transmission.tmp
Then I created a bunch of test torrents with torf (you can use mktorrent similarly; it should be in most distros' repos):
for f in path/to/files/*; do torf "$f"; done
Then I called stig like this:
stig set connect.port 1234 and \
set remove.max-hits 0 and \
rm 'name~e&path=transmission.tmp'
As expected, it lists all the torrents that have an 'e' in their name and asks me whether I want to remove them with the correct number of torrents.
Maybe you could do something similar and figure out the exact steps that
reproduce this issue without risking data loss. (Just remember to always run
stig with set connect.port ...
.)
Well there does seem to be something inconsistent about the handling of spaces.
I can issue
stig ls "name=name of torrent&path=/path/of/torrent"
and get one result. but
stig rm "name=name of torrent&path=/path/of/torrent"
will result in a huge list as mentioned, but
stig rm "name=name\ of\ torrent&path=/path/of/torrent"
will list just one torrent
Thanks.
A quick fix should be to quote or escape individual filter values, e.g.:
stig ls name="name of torrent"
Are you sure you entered these exact commands with the unbalanced quotes? Did you enter them in bash/zsh/etc or in stig's TUI? Either way, unbalanced quotes should be detected and throw an error.
I'll investigate more later.
Should be fixed now. I was also wrong earlier: Quoting filter values wouldn't have changed anything.
Thanks for your report.
It's working fine for me now, cheers.
When I first started testing the stig remove command I set remove.max-hits to 0 in my rc file to make sure I didn't get any nasty surprises. However when I issue a remove command in the TUI or CLI along the lines of
stig rm "name=[torrent name]&path=[torrent path]"
it outputs almost all of my torrents and then says "Are you sure you want to remove 1 torrent [y|N]?"I'm still not sure under what basis the outputted torrent list is constructed as it doesn't consist of all of my torrents but is somewhere in the range of 75%
Maybe others are made of sterner stuff but I've never had it in me to pull the trigger, shouldn't it just output the 1 torrent as if I had issued a list command with the same filters?