Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a 'Duplicate object member: "status"' bug with v3.00 daemon' #1354

Closed
wants to merge 1 commit into from

Conversation

ivzeivze
Copy link

This pull request fixes a bug, I've experienced with connecting Transmission Remote GUI to transmission-daemon v3.00.
The whole just wouldn't work, showing a pop-up message 'Duplicate object member: "status"'. The client OS is Linux x86_64.

The bug is related to sending 'status' field two times in one of the JSON-RPC calls.
This bug was supposedly triggered by changing the transmission-daemon RPC engine, as the duplicate record was no longer filtered in response.

The bug has been here before, it's just wasn't a problem to send duplicate fields with the older versions of transmission-daemon.

The solution for this bug is rather simple: sort by fields in those calls for RequestInfo(), which have non-trivial second array argument. A code review revealed that there is only one such case, most of the calls pass "array of const" for the first argument. To preserve code efficiency TStringList sorting is only done in the non-trivial case, but in the other cases TJSONArray is created by 'array of const', as it has been before.

It was not obvious for me, how the second argument of RequestInfo is formed, so a solution for removing "status" from where it comes from was abandoned. Sorting is a safe way, that would work without possibly breaking something else.

The program has been tested on linux, and it now works fine with all available daemon versions. Testing on other platforms should be done.

The bug is related to sending 'status' field two times in JSON-RPC.
This bug was supposedly triggered by changing the transmission-daemon
RPC engine, as the duplicate record was no longer filtered in responce.
@Boteium
Copy link

Boteium commented Nov 18, 2020

I just tried this out. It works perfectly.

@anna328p
Copy link

Duplicate of/supersedes #1329?

@ivzeivze
Copy link
Author

anna328p, yes, the very same issue, but my variant is less hacky.
It would filter out any duplicates, should someone decide to call RequestInfo with an arbitrary set of intersecting fields. Also it preserves efficiency of calling RequestInfo with an empty second argument.

@pbsds
Copy link

pbsds commented May 19, 2022

Tried this patch as newly merged in nixpkgs (PR mentioned above). Works like a charm!

@sniffer
Copy link

sniffer commented Jul 4, 2022

any chance on getting this reviewed? hit this couple days ago.

@PeterDaveHello
Copy link
Member

I get #1329 merged as it's sent earlier and touched less thing here, but I'm not sure which one is better, please feel free to test it, and also feel free to refactor it if needed.

myxomatosis added a commit to myxomatosis/transgui that referenced this pull request Nov 24, 2022
 Fixed a 'Duplicate object member: "status"' bug with v3.00 daemon' transmission-remote-gui#1354
Copy link
Contributor

@myxomatosis myxomatosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resolves the 'Duplicate object member: "status"' bug when connecting to a version 3.00 transmission daemon. Code looks good.

Copy link
Member

@PeterDaveHello PeterDaveHello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution, and sorry for the late response.

@PeterDaveHello
Copy link
Member

Hi @ivzeivze Thank you for your contribution! Just noticed that there is a git conflict in the changes. In order to proceed with merging your PR, would you like to resolve the conflict, and then we can continue with the merge process? Many thanks, again!

@PeterDaveHello PeterDaveHello force-pushed the master branch 3 times, most recently from edddb71 to be92509 Compare May 1, 2023 17:04
@PeterDaveHello PeterDaveHello requested a review from a team May 7, 2023 17:58
@ivzeivze
Copy link
Author

As far as I see, as a result of further development, the code patch has been amended with more understanding of the API internals. Thus my quick-fix from the past expires in favour of the new changes =)

@ivzeivze ivzeivze closed this Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants