Backup restore logging drops cog names and raises TypeError for failed libraries #6792
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#6792
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What Red version are you using?
3.5.25.dev1 (V3/develop @
61484f28f7)What were you trying to do?
Restore third-party cogs from a Red backup with
redbot-setup restore. I audited the failure reporting inredbot.core._downloader._restore_from_backup()because these messages are the only diagnostic output when a cog cannot be restored.What did you expect to happen?
Every restore failure should produce a normal log record containing the cog name, repository name, and failed shared-library names. Logging a recovery failure must not itself raise a formatting exception.
What actually happened?
Three log calls in the restore path have missing format arguments.
The commit that %r cog...without passingcog.name, so the literal placeholder is printed instead of the affected cog.failed_libsbranch at lines 1066-1069 has three placeholders but passes only two arguments. Python logging raisesTypeError: not enough arguments for format string, and the intended failure message is lost.Observed output:
How can we reproduce this error?
V3/developat61484f28f7fcfff81309cb2b0b0d5287c921f1adand install the test dependencies on Python 3.11.logging.StreamHandlertored.core.downloader._restore_from_backup(); both records retain a literal%r.CogInstallResultwith a non-emptyfailed_libstuple frominstall_cogs().The same failure can be isolated with the production format string:
Anything else?
Environment: Debian Bookworm arm64 container, Python 3.11.15. The unmodified baseline passes
313 passed, 7 skipped;pylint --errors-only redbotindependently reports E1206 at line 1066. I searched open and closed issues for the exact messages, backup restore logging errors, failed shared libraries, and missing commit metadata; no duplicate was found.Likely minimal fix: pass
cog.nameto both missing-commit messages, and passcog.name,cog.repo.name, then the joined library names to the failed-libraries message. I will add regression coverage for all three formatted records separately.Implemented and verified separately after filing.
Fix
Before/after proof
61484f28f7plus the regression: 1 failed, reproducing TypeError: not enough arguments for format string; the other two captured records contain literal %r.Tested on Debian Bookworm arm64 with Python 3.11.15. No Discord token or live bot connection is required for this restore-path test.
Apply and verify
Complete apply-ready patch