Skip to content

fix(custom,disk): catch fmt::format_error - #5332

Merged
Alexays merged 2 commits into
Alexays:masterfrom
kylin-liwn:fix/custom-format-crash
Sep 24, 2026
Merged

Alexays merged 2 commits into
Alexays:masterfrom
kylin-liwn:fix/custom-format-crash

Conversation

@kylin-liwn

Copy link
Copy Markdown

What does this PR do?
Both modules call fmt::format() with user-controlled format strings. If a placeholder doesn't match any argument, fmt throws format_error. The custom module's catch was re-throwing instead of handling. Disk had none at all.

Either way the exception reaches GTK's signal handler — log fills with [error] traces and the bar can crash.

Handle it locally: log a warning, skip the affected path, fall back to plain text for the custom module.

Related issues
Closes #5275

Checklist

  • Code is formatted with clang-format
  • Builds locally (ninja -C build)
  • Man page updated for any new/changed user-facing option (man/)
  • Tested against the affected module(s)

@greptile-apps

greptile-apps Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 3/5

The PR is not safe to merge until the disk module's default positional format and the custom fallback's visibility handling are restored.

Findings

  1. P1 Default disk format breaks ▶
  2. P1 Fallback remains hidden ▶
  3. P2 Failed paths count as rendered ▶

Summary

This PR catches user-triggered fmt::format_error exceptions in the custom and disk modules to prevent them from escaping GTK callbacks.

  • Adds a plain-text fallback for custom-module label and tooltip formatting.
  • Catches label and tooltip formatting failures per disk path.
  • Accidentally removes the disk module's positional percentage argument, breaking its default format.
  • Leaves failed disk paths and custom fallback output with incomplete rendering-state handling.

Reviews (1) · Last reviewed commit: "fix(custom,disk): catch fmt::format_erro..."

Comment thread src/modules/disk.cpp Outdated
Comment thread src/modules/disk.cpp
Comment thread src/modules/custom.cpp
@kylin-liwn
kylin-liwn force-pushed the fix/custom-format-crash branch 2 times, most recently from ebf1ec3 to 6378a79 Compare September 17, 2026 12:24
Both modules call fmt::format() with user-controlled format strings.
If a placeholder doesn't match any argument, fmt throws format_error.
The custom module's catch was re-throwing instead of handling. Disk
had none at all.

Either way the exception reaches GTK's signal handler — log fills with
[error] traces and the bar can crash.

Handle it locally: log a warning, skip the affected path, fall back to
plain text for the custom module.
@kylin-liwn
kylin-liwn force-pushed the fix/custom-format-crash branch from 6378a79 to 436cddc Compare September 17, 2026 12:28
@Alexays
Alexays merged commit c071deb into Alexays:master Sep 24, 2026
10 checks passed
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.

what: argument not found

2 participants