Bug 73333 - stat reports wrong blocksizes
Summary: stat reports wrong blocksizes
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: stat
Version: 7.3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-09-03 04:54 UTC by Binand Sethumadhavan
Modified: 2007-04-18 16:46 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-09-03 04:57:20 UTC
Embargoed:


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

Description Binand Sethumadhavan 2002-09-03 04:54:27 UTC
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
stat-2.5-5

How Reproducible:

Always.

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
[snip]

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 04:57:13 UTC
Created attachment 74584 [details]
patch to stat.c

Comment 2 Ngo Than 2002-09-03 11:56:50 UTC
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.