opnsense-src/usr.bin/stat
Kyle Evans 60a521a894 stat: fix use of devname(3)
Besides being a little hard to parse through visually, this had its own
bug of inspecting st->st_mode to determine what to pass to devname(3),
which is only correct for st_rdev.

For st_dev, you're likely to be looking at files or directories and
attempting to assess what device they're located on, so the mode is
meaningless- we just have to assume that our filesystems are on
character devices and attempt to resolve st_dev as such.

Approved by:	re (cperciva)
Reviewed by:	des, kib (previous version)
Differential Revision:	https://reviews.freebsd.org/D56565

(cherry picked from commit 4d4acdbfc22c84081037f31cff4fb03d18373036)

stat: The devname test case requires root

Fixes:		4d4acdbfc22c ("stat: fix use of devname(3)")
(cherry picked from commit 72b1aae09bf0bcc01c76df757699e27ad7cf7ecc)

stat: Set the timezone before testing -t flag

The test assumes UTC, which is what I use on my development systems and
clearly what is used on our CI runners.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D56836

(cherry picked from commit 49e496d2776870fb36ed8ea4c8139b5eb9f7f747)

stat: Expand devname test case

Test what happens when we ask for the rdev of a non-device.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D56838

(cherry picked from commit 2c88636e0e7a0316d5e6d146874bdb2751f75c40)
(cherry picked from commit 88f5520fa564ef1050bab6e091ead4040eb6d170)
2026-05-07 13:18:48 -07:00
..
tests stat: fix use of devname(3) 2026-05-07 13:18:48 -07:00
Makefile Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
stat.1 stat: Add option to list holes 2025-09-23 12:57:30 +00:00
stat.c stat: fix use of devname(3) 2026-05-07 13:18:48 -07:00