Skip to content

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
caco3:fix/ui-size-display
Open

fix: duc ui displays raw pointer value instead of human-readable size#361
caco3 wants to merge 1 commit intozevv:v1.5.0-rc2from
caco3:fix/ui-size-display

Conversation

@caco3
Copy link
Copy Markdown

@caco3 caco3 commented Apr 4, 2026

Problem

duc ui shows raw numbers like 140729715294144 for directory sizes instead of human-readable values like 45.2G.

Root cause

In src/duc/cmd-ui.c, the format string for printing the size column was %*s (correct — siz is a char[] filled by duc_human_size()). This was inadvertently changed to %*l in commit f767128 ("fix printf number size spec", Nov 1 2024), then to %*lu in d424b7b ("fix printf number size spec for real"). Finally, commit 83a579e ("cast value", Jun 2 2025) added an explicit (size_t) cast to silence the resulting compiler warning, cementing the bug: the stack address of the siz buffer 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:

- printw("%*lu", max_size_len, (size_t) siz);
+ printw("%*s", max_size_len, siz);

Introduced by: f767128 — Nov 1, 2024
Made explicit by: 83a579e — Jun 2, 2025

%*lu with (size_t) siz was printing the stack address of the char[]
buffer instead of its string content. Use %*s instead.
@caco3 caco3 mentioned this pull request Apr 4, 2026
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