Subject: bug#48960: stat v8.30 - device number in decimal shown as 16bit number instead of to converted 8bit

From: Paul Eggert <[email-masked]>
Date: Fri, 11 Jun 2021 10:11:15 -0700

The stat output is confusing in other ways. For example:

507-day $ ls -ld .; stat . | grep Device
drwxr-xr-x 4 eggert eggert 12288 May  5 14:48 .
Device: 10300h/66304d	Inode: 70388429    Links: 4
508-day $ ls -ld /dev/ptp0; stat /dev/ptp0 | grep Device
crw------- 1 root root 246, 0 Jun  3 13:09 /dev/ptp0
Device: 5h/5d	Inode: 321         Links: 1     Device type: f6,0

As you write, that "66304d" is useless on my platform, and the "5h/5d" 
uses a completely different notation from the "f6,0".

I suggest that we change the behavior of both "Device:" and "Device 
type:" to be consistent with that of 'ls', so that the output becomes:

507-day $ ls -ld .; stat . | grep Device
drwxr-xr-x 4 eggert eggert 12288 May  5 14:48 .
Device: 259, 0	Inode: 70388429    Links: 4
508-day $ ls -ld /dev/ptp0; stat /dev/ptp0 | grep Device
crw------- 1 root root 246, 0 Jun  3 13:09 /dev/ptp0
Device: 0, 5	Inode: 321         Links: 1     Device type: 246, 0