Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 93294 - Incorrect man page for find: -printf %b and %k
Summary: Incorrect man page for find: -printf %b and %k
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Ciaran McCreesh
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-19 22:06 UTC by Jason Bucata
Modified: 2005-05-22 02:03 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
find.1: Word -printf %b the same way as %k (find.1.patch,321 bytes, patch)
2005-05-21 16:49 UTC, Jason Bucata
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Bucata 2005-05-19 22:06:59 UTC
The find(1) man page claims that the %b and %k formats for -printf return the size of the file in 512-byte and 1K-byte blocks, respectively, implying that they're merely mathematically tweaked versions of %s (size in bytes).  In fact, %b and %k report the amount of disk space allocated to the file, not the size of its contents.

See:
http://www.gnu.org/software/findutils/manual/html_node/find_html/Size-Directives.html

In addition, I inspected the source code and determined that it's using st_blocks from struct stat, which returns the amount of allocated disk space, not the size of the file's contents (but see bug 93292).
Comment 1 SpanKY gentoo-dev 2005-05-20 20:45:55 UTC
find(1) is provided by findutils
Comment 2 Ciaran McCreesh 2005-05-20 21:53:55 UTC
Hrm. According to find(1):

              %k     The amount of disk space used for this file in 1K  blocks
                     (rounded up).  This is different from %s/1024 if the file
                     is a sparse file.

That one at least looks fine to me...
Comment 3 Jason Bucata 2005-05-20 23:32:12 UTC
You must be running ~arch.  findutils-4.1.20-r1 doesn't word it that way.

Does %b say something similar to what %k says in your version?
Comment 4 Ciaran McCreesh 2005-05-21 04:03:17 UTC
              %b     File's size in 512-byte blocks (rounded up).

If that's not good enough, please provide a patch against findutils-4.2.20.
Comment 5 Jason Bucata 2005-05-21 16:49:48 UTC
Created attachment 59503 [details, diff]
find.1: Word -printf %b the same way as %k

Aped from %k, which was correct
Comment 6 Ciaran McCreesh 2005-05-22 01:57:26 UTC
In, thanks very much. I didn't do a rev bump for this as a I don't consider a
two line doc update to an ~arch package to be worth a rebuild for most people.
No backporting either, 4.2.20 will be going stable just as soon as the xfs init
scripts are fixed.
Comment 7 Ciaran McCreesh 2005-05-22 02:03:44 UTC
/me remembers the resolution thingie...