Skip to content

upgrade(): log the response just read, not a stale variable - #8

Open
Cybis320 wants to merge 1 commit into
OpenIPC:masterfrom
Cybis320:fix-stale-debug-var-in-upgrade
Open

upgrade(): log the response just read, not a stale variable#8
Cybis320 wants to merge 1 commit into
OpenIPC:masterfrom
Cybis320:fix-stale-debug-var-in-upgrade

Conversation

@Cybis320

Copy link
Copy Markdown

upgrade()'s completion loop reads each response into data but logs reply:

while True:
    data, rcvd = self.recv_json(rcvd)
    self.logger.debug(reply)      # <- stale
    if data is None:
        ...

reply was last assigned in the upload loop above and is never reassigned here, so every iteration logs the same stale value rather than the upgrade response the line is meant to record.

Debug-level only, so it isn't visible by default — but it makes the upgrade log actively misleading once enabled, since the Ret values recorded can repeat or show a value the camera never sent at that point. I hit this while tracing why firmware upgrades on a GK7205V200 camera reported inconsistent results, and the log sent me the wrong way for a while.

One-line change, no behaviour difference outside logging.

Thanks for maintaining this after the original repo went away — the receive_json try/except and the get_command binary handling both fixed real crashes for us.

The completion loop reads each response into `data` but logs `reply`, which
was last assigned in the upload loop above and never changes afterwards. Every
iteration therefore logs the same stale value instead of the upgrade progress
the line is meant to record.

Debug-level only, so it is not visible by default, but it makes the upgrade log
actively misleading when someone does turn it on: the Ret values recorded can
repeat or show a value the camera never sent at that point.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Finding overflow, which tucks the rest behind 'View more'

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Log current firmware upgrade response

🐞 Bug fix 🕐 Less than 5 minutes

Grey Divider

AI Description

• Logs each newly received upgrade response instead of the previous upload reply.
• Prevents misleading debug output without changing firmware upgrade behavior.
High-Level Assessment

Logging data is the optimal approach because it directly references the response received during the current completion-loop iteration. Restructuring the loop or renaming variables would add unnecessary scope without improving the fix.

Files changed (1) +1 / -1

Bug fix (1) +1 / -1
dvrip.pyLog the current upgrade completion response +1/-1

Log the current upgrade completion response

• Changes the upgrade completion loop to debug-log 'data', the response just returned by 'recv_json', rather than the stale 'reply' retained from the upload loop. Runtime upgrade behavior remains unchanged outside debug output.

dvrip.py

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.

1 participant