Bug 73333 - stat reports wrong blocksizes
stat reports wrong blocksizes
Product: Red Hat Linux
Classification: Retired
Component: stat (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Ngo Than
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2002-09-03 00:54 EDT by Binand Sethumadhavan
Modified: 2007-04-18 12:46 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-09-03 00:57:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch to stat.c (955 bytes, patch)
2002-09-03 00:57 EDT, Binand Sethumadhavan
no flags Details | Diff

  None (edit)
Description Binand Sethumadhavan 2002-09-03 00:54:27 EDT
Description of Problem:

The block sizes reported by stat are obviously wrong.

Version-Release number of selected component (if applicable):

binand@binand[~/Stattest]:(82) rpm -q stat

How Reproducible:


Steps to Reproduce:
1. Run stat on anything. You get output like:

binand@binand[~]:(12) stat ./.profile
  File: "./.profile"
  Size: 3317            Blocks: 8          IO Block: -4611700930553835520 
Regular File

Expected Results:

The correct IO Block size (4096, I guess).

Additional Information:
A printf format string in stat.c is wrong, I think. statbuf.st_blksize is of 
type blksize_t' which is long int on my system, but the printf format used is 
%lld in stat.c. Changing it to %ld got me correct results.

Incidentally, there are lots of anomalies in the printf format strings used in 
stat.c. When -t is given, for the block size, %llu is used, but otherwise, %lld 
is used. Please fix. I haven't done a full check on all the other format 
specifiers used, but the above two can be fixed using the attached patch.
Comment 1 Binand Sethumadhavan 2002-09-03 00:57:13 EDT
Created attachment 74584 [details]
patch to stat.c
Comment 2 Ngo Than 2002-09-03 07:56:50 EDT
3.3-1 or new in rawhide already fixed this bug. nevertheless, thanks for your patch.

Note You need to log in before you can comment on or make changes to this bug.