fix: duc ui displays raw pointer value instead of human-readable size#361
Open
caco3 wants to merge 1 commit intozevv:v1.5.0-rc2from
Open
fix: duc ui displays raw pointer value instead of human-readable size#361caco3 wants to merge 1 commit intozevv:v1.5.0-rc2from
caco3 wants to merge 1 commit intozevv:v1.5.0-rc2from
Conversation
%*lu with (size_t) siz was printing the stack address of the char[] buffer instead of its string content. Use %*s instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
duc uishows raw numbers like140729715294144for directory sizes instead of human-readable values like45.2G.Root cause
In src/duc/cmd-ui.c, the format string for printing the size column was
%*s(correct —sizis achar[]filled byduc_human_size()). This was inadvertently changed to%*lin commitf767128("fix printf number size spec", Nov 1 2024), then to%*luind424b7b("fix printf number size spec for real"). Finally, commit83a579e("cast value", Jun 2 2025) added an explicit(size_t)cast to silence the resulting compiler warning, cementing the bug: the stack address of thesizbuffer was being printed as an unsigned integer instead of the buffer's string content.Fix
Restore the correct format specifier and drop the erroneous cast:
Introduced by:
f767128— Nov 1, 2024Made explicit by:
83a579e— Jun 2, 2025