Skip to content

Ratio plugin: gate group.*.set call shape by rtorrent version#3071

Merged
xirvik merged 1 commit into
Novik:masterfrom
xirvik:fix/ratio-group-backcompat
Jun 26, 2026
Merged

Ratio plugin: gate group.*.set call shape by rtorrent version#3071
xirvik merged 1 commit into
Novik:masterfrom
xirvik:fix/ratio-group-backcompat

Conversation

@xirvik

@xirvik xirvik commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

#3066 fixed the ratio plugin on rtorrent 0.16.x by always sending (target_string, value) to group.NAME.ratio.{min,max,upload}.set, which is what the strict 0.16 signature requires. On older rtorrent the same set commands are the opposite — strictly a bare value, and the (target, value) shape is rejected with "Wrong object type".

Encapsulate the call-shape adaptation in
rTorrentSettings::getRatioGroupCommand so callers (ratio plugin flush(), but also any future consumer) do not have to know which signature applies. The helper:

  • always uses the canonical group.* prefix. group2.* was a transient alias name: stubbed and non-functional on 0.15.x and removed in 0.16. The old "if iVersion >= 0x904 and cmd in ratioCmds use group2." branch fell into both broken cases and produces fewer successful calls than the unconditional group.* path on every rtorrent version verified.

  • prepends an empty-string target to *.set commands only when iVersion >= 0x1000, so 0.15.x callers continue to receive the single-value shape they require and 0.16+ callers receive the (target, value) shape they require.

ratio.php is reverted to passing the bare value to the helper for the .set commands; the helper does the version-aware wrapping.

The unused $ratioCmds whitelist is dropped — only the group2.* branch consulted it, and that branch is gone.

Reported by @ml-1 in #3065 after upgrading to v5.3.3 with rtorrent 0.15.7.

Novik#3066 fixed the ratio plugin on rtorrent 0.16.x by always sending
(target_string, value) to group.NAME.ratio.{min,max,upload}.set,
which is what the strict 0.16 signature requires. On older rtorrent
the same set commands are the opposite — strictly a bare value, and
the (target, value) shape is rejected with "Wrong object type".

Encapsulate the call-shape adaptation in
rTorrentSettings::getRatioGroupCommand so callers (ratio plugin
flush(), but also any future consumer) do not have to know which
signature applies. The helper:

* always uses the canonical group.* prefix. group2.* was a transient
  alias name: stubbed and non-functional on 0.15.x and removed in
  0.16. The old "if iVersion >= 0x904 and cmd in ratioCmds use
  group2." branch fell into both broken cases and produces fewer
  successful calls than the unconditional group.* path on every
  rtorrent version verified.

* prepends an empty-string target to *.set commands only when
  iVersion >= 0x1000, so 0.15.x callers continue to receive the
  single-value shape they require and 0.16+ callers receive the
  (target, value) shape they require.

ratio.php is reverted to passing the bare value to the helper for
the .set commands; the helper does the version-aware wrapping.

The unused $ratioCmds whitelist is dropped — only the group2.*
branch consulted it, and that branch is gone.

Reported by @ml-1 in Novik#3065 after upgrading to v5.3.3 with rtorrent
0.15.7.
@xombiemp

Copy link
Copy Markdown
Collaborator

I tried these changes and I'm still getting ratio: Plugin failed to start. on 0.15.6.

@xirvik

xirvik commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

I tried these changes and I'm still getting ratio: Plugin failed to start. on 0.15.6.

I need complete logs here in order to figure it out - just the error message is not enough.

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 this pull request may close these issues.

2 participants