Page MenuHomeFreeBSD

stat: fix use of devname(3)
Needs ReviewPublic

Authored by kevans on Wed, Apr 22, 1:02 AM.
Tags
None
Referenced Files
F153972796: D56565.id176047.diff
Sat, Apr 25, 4:58 AM
F153971746: D56565.id176230.diff
Sat, Apr 25, 4:49 AM
Unknown Object (File)
Fri, Apr 24, 5:30 AM
Unknown Object (File)
Wed, Apr 22, 2:58 AM
Subscribers

Details

Reviewers
kib
Group Reviewers
Klara
Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 72457
Build 69340: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Wed, Apr 22, 1:38 AM

Do we even need HAVE_DEVNAME at all? This was originally imported from OpenBSD via NetBSD, but we haven't pulled anything from upstream in 15 years and the diff is now massive. We may as well drop the pretense that we will ever want to build this code on a platform that doesn't have devname().

usr.bin/stat/tests/stat_test.sh
313

I would move this to right before mount, because of how you wrote the cleanup function.

324

rm

kevans marked 2 inline comments as done.

Small test cleanup:

  • mkdir mnt later, since we use it to signal that we need to try unmounting
  • use a local for the path to check as a portability aid, other systems may be able to make different asssumptions about their filesystem layout and avoid needing to mount anything
This revision now requires review to proceed.Thu, Apr 23, 2:51 AM
usr.bin/stat/tests/stat_test.sh
313

This should be at a global since we need it in cleanup