GNU bug report logs -
#53209
stat shows wrong, non-existing device number
Previous Next
Reported by: Joachim Wagner <jo2l <at> mqzmail.eu>
Date: Wed, 12 Jan 2022 15:58:01 UTC
Severity: normal
Tags: notabug
Done: Joachim Wagner <jo2l <at> mqzmail.eu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53209 in the body.
You can then email your comments to 53209 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#53209
; Package
coreutils
.
(Wed, 12 Jan 2022 15:58:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Joachim Wagner <jo2l <at> mqzmail.eu>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 12 Jan 2022 15:58:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Issue: The device number shown in `stat` output does not match the device
numbers of any of the devices used by the filesystem.
On my system:
$ stat --version | head -n 1
stat (GNU coreutils) 8.32
$ cat /etc/os-release | fgrep -i pretty
PRETTY_NAME="openSUSE Leap 15.3"
$ ls -l /dev/nvme0n1p6 /dev/nvme1n1p3
brw-rw---- 1 root disk 259, 6 Jan 12 09:29 /dev/nvme0n1p6
brw-rw---- 1 root disk 259, 12 Jan 12 09:29 /dev/nvme1n1p3
$ fgrep home /etc/crypttab
cr_home0 /dev/disk/by-id/nvme-RETRACTED1-part6
cr_home1 /dev/disk/by-id/nvme-RETRACTED2-part3
$ ls -l /dev/mapper/cr_home?
lrwxrwxrwx 1 root root 7 Jan 12 09:29 /dev/mapper/cr_home0 -> ../dm-6
lrwxrwxrwx 1 root root 7 Jan 12 09:30 /dev/mapper/cr_home1 -> ../dm-5
$ ls -l /dev/dm-[56]
brw-rw---- 1 root disk 254, 5 Jan 12 09:30 /dev/dm-5
brw-rw---- 1 root disk 254, 6 Jan 12 09:29 /dev/dm-6
$ fgrep home /etc/fstab
/dev/mapper/cr_home0 /home btrfs defaults
0 0
$ history | fgrep cr_home | tail -n 3 | head -n 2
108 2022-01-05 17:01:22 mkfs.btrfs /dev/mapper/cr_home0
141 2022-01-05 17:16:49 btrfs device add /dev/mapper/cr_home1 /home
$ touch /home/test
$ stat /home/test | fgrep -i device
Device: 3ch/60d Inode: 2143351 Links: 1
$ ls -l /dev | grep "^b" | fgrep 60 | wc -l
0
Expected behaviour: Device should be one (or more) of
fe06h/65030d <-- most expected as this is the primary btrfs device
fe05h/65029d <-- the 2nd device (/dev/cr_home1)
10306h/66310d <-- backing device for cr_home0 (/dev/nvme0n1p6)
1030ch/66316d <-- backing device for cr_home1 (/dev/nvme1n1p3)
10300h/66304d <-- SSD 1 (/dev/nvme0n1)
10309h/66313d <-- SSD 2 (/dev/nvme1n1)
Speculation: Searching the mailing list for stat + major on https://
www.gnu.org/software/coreutils/ shows results indicating that stat uses only 8
bit for major and minor. However, since kernel 2.6.0 according to https://
stackoverflow.com/questions/14833467/maximum-values-of-major-and-minor-
numbers-in-linux , the major has 12 bit and the minor 20 bit. Output above
shows a major with at least 9 bits that may confuse `stat` if it doesn't stay
with the immediate device number of the top level dm-crypt device.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#53209
; Package
coreutils
.
(Wed, 12 Jan 2022 16:15:01 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
> and only filesystems
and only some filesystems
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#53209
; Package
coreutils
.
(Wed, 12 Jan 2022 16:26:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 53209 <at> debbugs.gnu.org (full text, mbox):
Further reading suggests this a not a bug but a feature and only some
filesystems choose (major<<8)+minor of the primary device specified when
mounting the filesystem as the filesystem's device number.
A sentence in the man page explaining this would be helpful.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#53209
; Package
coreutils
.
(Wed, 12 Jan 2022 16:29:01 GMT)
Full text and
rfc822 format available.
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
> Issue: The device number shown in `stat` output does not match the device
> numbers of any of the devices used by the filesystem.
Further reading suggests this a not a bug but a feature and only filesystems
choose (major<<8)+minor of the primary device specified when mounting the
filesystem.
I cloned git://git.sv.gnu.org/coreutils to add a sentence on this to stat's
man page but coreutils/man/stat.x is only a template, missing what I see in
`man stat` on my system. Trying to find out how to contribute to
documentation, I encountered the following cycle with no answer:
https://www.gnu.org/help/
https://www.gnu.org/philosophy/free-doc.html
https://www.gnu.org/doc/doc.html
https://www.gnu.org/help/help.html#helpgnu
Joachim
bug closed, send any further explanations to
53209 <at> debbugs.gnu.org and Joachim Wagner <jo2l <at> mqzmail.eu>
Request was from
Joachim Wagner <jo2l <at> mqzmail.eu>
to
control <at> debbugs.gnu.org
.
(Wed, 12 Jan 2022 17:03:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#53209
; Package
coreutils
.
(Wed, 12 Jan 2022 17:39:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 53209 <at> debbugs.gnu.org (full text, mbox):
On 1/12/22 16:35, Joachim Wagner wrote:
> I cloned git://git.sv.gnu.org/coreutils to add a sentence on this to stat's
> man page but coreutils/man/stat.x is only a template, missing what I see in
> `man stat` on my system. Trying to find out how to contribute to
> documentation, I encountered the following cycle with no answer:
>
> https://www.gnu.org/help/
> https://www.gnu.org/philosophy/free-doc.html
> https://www.gnu.org/doc/doc.html
> https://www.gnu.org/help/help.html#helpgnu
Typically, the first thing to look at are the README* files, especially
'README-hacking'.
Re. man pages of the coreutils:
a) they are generated during the build from the output of "$UTIL --help"
plus the information in "man/$UTIL.x".
b) The information in the man pages should be kept as terse as possible,
and more detailed information should go into the Texinfo manual (which also
gets uploaded to https://www.gnu.org/software/coreutils/manual/ in HTML,
PDF and other formats after each release).
Have a nice day,
Berny
Added tag(s) notabug.
Request was from
Paul Eggert <eggert <at> cs.ucla.edu>
to
control <at> debbugs.gnu.org
.
(Wed, 12 Jan 2022 19:04:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 10 Feb 2022 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 130 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.