GNU bug report logs - #13927
stat --printf %t, %T flags (major and minor device types) don't work on mount points

Previous Next

Package: coreutils;

Reported by: Tyler Hobbs <tyler <at> datastax.com>

Date: Mon, 11 Mar 2013 20:45:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tyler Hobbs <tyler <at> datastax.com>
To: bug-coreutils <at> gnu.org
Subject: stat --printf %t, %T flags (major and minor device types) don't work
	on mount points
Date: Mon, 11 Mar 2013 15:39:51 -0500
[Message part 1 (text/plain, inline)]
If I run stat --printf='%D', the result is "10ca70", which is correct.
However, if I run stat --printf='%t %T' /mountpoint, the result is
erroneously "0 0".  If I instead run stat against the device directly (stat
--printf='%t %T' /dev/xvdx), I get the correct result of "ca 170".

I believe the proper fix is to replace (in stat.c):

  out_uint_x (pformat, prefix_len, major (statbuf->st_rdev));

with:

  out_uint_x (pformat, prefix_len, major (statbuf->st_dev));

That is, use statbuf->st_dev instead of st_rdev, which is what the %d and
%D directives use.


I'm using coreutils 8.9, compiled from source, and this is the output of
uname -a:

Linux ip-10-39-122-238 2.6.32-276.el6.x86_64 #1 SMP Tue May 29 17:38:19 EDT
2012 x86_64 x86_64 x86_64 GNU/Linux

Thanks for your time.
- Tyler
[Message part 2 (text/html, inline)]

This bug report was last modified 12 years and 73 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.